2014年3月26日

ServiceStack.Ormlit 事务

摘要: 应该使用这个方法开启事务public static IDbTransaction OpenTransaction(this IDbConnection dbConn) { return new OrmLiteTransaction(dbConn, dbConn.BeginTransaction()); }或者IDbConnection对象用OrmLiteConnectionFactory来创建var factory = new OrmLiteConnectionFactory(ConnectionString, SqlServerDialect.Provider... 阅读全文

posted @ 2014-03-26 15:01 少明 阅读(679) 评论(0) 推荐(1) 编辑

ServiceStack.Ormlit 使用Insert的时候自增列不会被赋值

摘要: Insert签名是这样的,将第2个参数设置为true就会返回刚插入的自增列ID了,然后可以手工赋值到对象上面去public static long Insert(this IDbConnection dbConn, T obj, bool selectIdentity = false) { return dbConn.Exec(dbCmd => dbCmd.Insert(obj, selectIdentity)); } 阅读全文

posted @ 2014-03-26 14:59 少明 阅读(295) 评论(0) 推荐(0) 编辑

ServiceStack.Ormlit sqlserver枚举类型映射字段类型为varchar

摘要: 请当枚举类型上面加上[Flags]特性就可以了. 阅读全文

posted @ 2014-03-26 14:57 少明 阅读(527) 评论(0) 推荐(0) 编辑

导航