public virtual int Delete(T obj, DBConnectionWrapper conn, DBTransactionWrapper trans = null) { if (DeleteCommand == null) { throw new NotSupportedException("Delete is not support for this [" + typeof(T).FullName + "], make sure you have primary key defined in Entity Metadata for this type."); } return(DeleteCommand.Execute(ref obj, conn, trans)); }
public virtual T Load(T obj, DBConnectionWrapper conn, DBTransactionWrapper trans = null) { if (LoadCommand == null) { throw new NotSupportedException("Load is not support for this [" + typeof(T).FullName + "], make sure you have primary key defined in Entity Metadata for this type."); } int cnt = LoadCommand.Execute(ref obj, conn, trans); if (cnt == 0) { return(default(T)); } return(obj); }
public virtual int Update(ref T obj, DBConnectionWrapper conn, DBTransactionWrapper trans = null, params Expression <Func <T, object> >[] targetProperties) { if (UpdateCommand == null) { throw new NotSupportedException("Update is not support for this [" + typeof(T).FullName + "], make sure you have primary key defined in Entity Metadata for this type."); } IDBTableAdapterCommand <T> cmd = UpdateCommand; if (targetProperties.Length > 0) { cmd = CreateUpdateCommand(targetProperties); } return(cmd.Execute(ref obj, conn, trans)); }
public virtual int Insert(ref T obj, DBConnectionWrapper conn, DBTransactionWrapper trans = null) { return(InsertCommand.Execute(ref obj, conn, trans)); }