我刚刚将一些代码转换为异步等待......例如:
public async Task<User> StoreAsync(User user)
{
using (var db = DbFactory.Open())
{
await db.SaveAsync(user).ConfigureAwait(false);
}
return user;
}
(我也尝试过没有ConfigureAwait(false))
当然,它的用途已经改变了:
await UserRepo.StoreAsync(user);
方法签名:
public async Task<RegisterExpertResponse> Post(RegisterExpert request)
之前一切正常,如果我将下面的内容评论如下,一切正常:
var connectionString = ConfigUtils.GetConnectionString("AppDb");
container.Register<IDbConnectionFactory>(c =>
new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider)
// Commented out because it fails with "unable to cast object of type Servicestack.MiniProfiler.Data.ProfiledDbCommand to System.Data.SqlClient.SqlCommand"
//{ ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current) }
);
如果我在“我得到:
”中评论连接过滤器无法转换类型的对象 Servicestack.MiniProfiler.Data.ProfiledDbCommand to System.Data.SqlClient.SqlCommand
(所有最新的prod发布servicestack nuget包)