Exemplo n.º 1
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="creator"></param>
        /// <returns></returns>
        public int Execute(InsertCreator creator)
        {
            if (creator.Table == null)
            {
                throw new DataException("用创建器操作时,表不能为null!");
            }

            object retVal;

            return(dbProvider.Insert <ViewEntity>(creator.Table, creator.FieldValues, this, creator.IdentityField, creator.SequenceName, false, out retVal));
        }
Exemplo n.º 2
0
        /// <summary>
        ///  插入数据
        /// </summary>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="creator"></param>
        /// <param name="identityValue"></param>
        /// <returns></returns>
        public int Execute <TResult>(InsertCreator creator, out TResult identityValue)
        {
            identityValue = default(TResult);

            if (creator.Table == null)
            {
                throw new DataException("用创建器操作时,表不能为null!");
            }

            if ((IField)creator.IdentityField == null)
            {
                throw new DataException("返回主键值时需要设置KeyField!");
            }

            object retVal;
            int    ret = dbProvider.Insert <ViewEntity>(creator.Table, creator.FieldValues, this, creator.IdentityField, creator.SequenceName, true, out retVal);

            identityValue = CoreHelper.ConvertValue <TResult>(retVal);

            return(ret);
        }
Exemplo n.º 3
0
 /// <summary>
 ///  插入数据
 /// </summary>
 /// <typeparam name="TResult"></typeparam>
 /// <param name="creator"></param>
 /// <param name="identityValue"></param>
 /// <returns></returns>
 public int Execute <TResult>(InsertCreator creator, out TResult identityValue)
 {
     return(dbTrans.Execute(creator, out identityValue));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name="creator"></param>
 /// <returns></returns>
 public int Execute(InsertCreator creator)
 {
     return(dbTrans.Execute(creator));
 }