ServiceStack OrmLite更新

时间:2013-10-26 07:32:31

标签: c# ormlite-servicestack

以下代码运行正常。

public static void UpdateCategory(Category category) {
  var dbFactory = new OrmLiteConnectionFactory(connString, SqlServerDialect.Provider);
  using (IDbConnection db = dbFactory.OpenDbConnection()) {
    try{
      db.Update<Category>(category);
    }
    catch (Exception e) {
      throw new Exception(string.Format("Error within {0}", e.Message));
    }
  }
}

下面的代码没有?

public static int UpdateRowInTable<T>(object value) {
  var dbFactory = new OrmLiteConnectionFactory(connString, SqlServerDialect.Provider);
  using (IDbConnection db = dbFactory.OpenDbConnection()) {
    try {
      result = db.Update<T>(value);
    }
    catch (Exception e) {
      throw new Exception(string.Format("Error within {0}", e.Message));
    }
  }
}

感谢

0 个答案:

没有答案