應該使用這個方法開啓事務ide
public static IDbTransaction OpenTransaction(this IDbConnection dbConn)
{
return new OrmLiteTransaction(dbConn, dbConn.BeginTransaction());
}this
或者IDbConnection對象用OrmLiteConnectionFactory來建立對象
var factory = new OrmLiteConnectionFactory(ConnectionString, SqlServerDialect.Provider);事務