コード例 #1
0
ファイル: DBTableAdapterBase.cs プロジェクト: jxdking/ADOExt
        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));
        }
コード例 #2
0
ファイル: DBTableAdapterBase.cs プロジェクト: jxdking/ADOExt
        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);
        }
コード例 #3
0
ファイル: DBTableAdapterBase.cs プロジェクト: jxdking/ADOExt
        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));
        }
コード例 #4
0
ファイル: DBTableAdapterBase.cs プロジェクト: jxdking/ADOExt
 public virtual int Insert(ref T obj, DBConnectionWrapper conn, DBTransactionWrapper trans = null)
 {
     return(InsertCommand.Execute(ref obj, conn, trans));
 }