【发布时间】:2016-06-29 22:59:56
【问题描述】:
我有一个从数据库中获取Filename 和Path(2 列)的存储过程。我需要创建一个 WCF 服务,将数据返回为任何使用该服务的应用程序都可以使用的格式,例如 List<string> 或类似的东西。
最好的方法是什么(设计和实现方面)?
这是我尝试通过 Dapper ORM 执行的操作,但我不确定它是否会按预期工作。
public IEnumerable<dynamic> RetrieveIncompletedFiles(int type)
{
try
{
using (_connection = new SqlConnection(_sqlConnectionString))
{
_connection.Open();
var files = _connection.Query("SelectIncompletedFilesByFiletypeFromAsyncFileProcessingQueue", new { Filetype = type }, commandType: CommandType.StoredProcedure);
return files;
}
}
catch (Exception ex)
{
return null;
}
}
【问题讨论】:
标签: sql asp.net-mvc wcf dapper