Exemple #1
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <typeparam name="valueType">数据类型</typeparam>
 /// <typeparam name="modelType">模型类型</typeparam>
 /// <param name="sqlTool">SQL操作工具</param>
 /// <param name="value">待更新数据自增id标识</param>
 /// <param name="sqlExpression">待更新数据</param>
 /// <param name="memberMap">目标成员位图</param>
 /// <returns>更新前的数据对象,null表示失败</returns>
 protected override valueType updateByIdentity <valueType, modelType>(fastCSharp.emit.sqlTable.sqlTool <valueType, modelType> sqlTool
                                                                      , valueType value, ref fastCSharp.emit.sqlTable.updateExpression sqlExpression, fastCSharp.code.memberMap <modelType> memberMap)
 {
     log.Error.Throw(log.exceptionType.ErrorOperation);
     return(null);
 }
Exemple #2
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <typeparam name="valueType">数据类型</typeparam>
        /// <typeparam name="modelType">模型类型</typeparam>
        /// <param name="sqlTool">SQL操作工具</param>
        /// <param name="value">待插入数据</param>
        /// <param name="memberMap">目标成员位图</param>
        /// <param name="isIgnoreTransaction">是否忽略应用程序事务</param>
        /// <param name="onInserted"></param>
        protected override void insert <valueType, modelType>
            (fastCSharp.emit.sqlTable.sqlTool <valueType, modelType> sqlTool, valueType value, fastCSharp.code.memberMap <modelType> memberMap, bool isIgnoreTransaction, ref Action <valueType> onInserted)
        {
            inserter <valueType, modelType> inserter;
            bool isTransaction = false;

            if (!isIgnoreTransaction && sqlTool.IsDeleteTransaction)
            {
                if (fastCSharp.domainUnload.TransactionStart(false))
                {
                    isTransaction = true;
                    inserter      = inserter <valueType, modelType> .Get();
                }
                else
                {
                    inserter = null;
                }
            }
            else
            {
                inserter = inserter <valueType, modelType> .Get();
            }
            if (inserter != null)
            {
                inserter.Insert(this, sqlTool, value, ref onInserted, isTransaction);
            }
            else if (isTransaction)
            {
                fastCSharp.domainUnload.TransactionEnd();
            }
        }
Exemple #3
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <typeparam name="valueType">数据类型</typeparam>
 /// <typeparam name="modelType">模型类型</typeparam>
 /// <param name="sqlTool">SQL操作工具</param>
 /// <param name="value">待更新数据</param>
 /// <param name="memberMap">目标成员位图</param>
 /// <param name="isIgnoreTransaction">是否忽略应用程序事务</param>
 /// <param name="onUpdated">是否成功</param>
 public override void UpdateByIdentity <valueType, modelType>
     (fastCSharp.emit.sqlTable.sqlTool <valueType, modelType> sqlTool, valueType value, fastCSharp.code.memberMap <modelType> memberMap, bool isIgnoreTransaction, Action <valueType, valueType, fastCSharp.code.memberMap> onUpdated)
 {
     using (memberMap) onUpdated(null, null, null);
     log.Error.Throw(log.exceptionType.ErrorOperation);
 }
Exemple #4
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <typeparam name="valueType">数据类型</typeparam>
        /// <typeparam name="modelType">模型类型</typeparam>
        /// <param name="sqlTool">SQL操作工具</param>
        /// <param name="value">待插入数据</param>
        /// <param name="memberMap">目标成员位图</param>
        /// <returns>是否成功</returns>
        protected override bool insert <valueType, modelType>
            (fastCSharp.emit.sqlTable.sqlTool <valueType, modelType> sqlTool, valueType value, fastCSharp.code.memberMap <modelType> memberMap)
        {
            DbConnection connection = GetConnection(false);

            if (connection != null)
            {
                byte isExecute = 0;
                try
                {
                    subArray <valueType> values = subArray <valueType> .Unsafe(new valueType[] { value }, 0, 1);

                    import(connection, sqlTool.GetDataTable(ref values));
                    return(true);
                }
                catch (Exception error)
                {
                    fastCSharp.log.Error.Add(error, null, false);
                }
                finally
                {
                    if (isExecute == 0)
                    {
                        connection.Dispose();
                    }
                    else
                    {
                        pushConnection(ref connection, false);
                    }
                }
            }
            return(false);
        }
Exemple #5
0
 /// <summary>
 /// 查询对象
 /// </summary>
 /// <typeparam name="valueType">对象类型</typeparam>
 /// <typeparam name="modelType">模型类型</typeparam>
 /// <param name="sqlTool">SQL操作工具</param>
 /// <param name="value">匹配成员值</param>
 /// <param name="memberMap">成员位图</param>
 /// <param name="onGet"></param>
 public override void GetByPrimaryKey <valueType, modelType>
     (fastCSharp.emit.sqlTable.sqlTool <valueType, modelType> sqlTool, valueType value, fastCSharp.code.memberMap <modelType> memberMap, Action <valueType> onGet)
 {
     onGet(null);
     log.Error.Throw(log.exceptionType.ErrorOperation);
 }
Exemple #6
0
 /// <summary>
 /// 查询对象
 /// </summary>
 /// <typeparam name="valueType">对象类型</typeparam>
 /// <typeparam name="modelType">模型类型</typeparam>
 /// <param name="sqlTool">SQL操作工具</param>
 /// <param name="value">匹配成员值</param>
 /// <param name="memberMap">成员位图</param>
 /// <returns>对象集合</returns>
 public override valueType GetByPrimaryKey <valueType, modelType>
     (fastCSharp.emit.sqlTable.sqlTool <valueType, modelType> sqlTool, valueType value, fastCSharp.code.memberMap <modelType> memberMap)
 {
     log.Error.Throw(log.exceptionType.ErrorOperation);
     return(null);
 }
Exemple #7
0
 /// <summary>
 /// 查询对象集合
 /// </summary>
 /// <typeparam name="valueType">对象类型</typeparam>
 /// <typeparam name="modelType">模型类型</typeparam>
 /// <param name="sqlTool">SQL操作工具</param>
 /// <param name="query">查询信息</param>
 /// <param name="memberMap">成员位图</param>
 /// <param name="onGet"></param>
 public override void Select <valueType, modelType>
     (fastCSharp.emit.sqlTable.sqlTool <valueType, modelType> sqlTool, selectQuery <modelType> query, fastCSharp.code.memberMap <modelType> memberMap, Action <subArray <valueType> > onGet)
 {
     onGet(default(subArray <valueType>));
     log.Error.Throw(log.exceptionType.ErrorOperation);
 }
Exemple #8
0
 /// <summary>
 /// 查询对象集合
 /// </summary>
 /// <typeparam name="valueType">对象类型</typeparam>
 /// <typeparam name="modelType">模型类型</typeparam>
 /// <param name="sqlTool">SQL操作工具</param>
 /// <param name="query">查询信息</param>
 /// <param name="memberMap">成员位图</param>
 /// <returns>对象集合</returns>
 protected override IEnumerable <valueType> selectPushMemberMap <valueType, modelType>
     (fastCSharp.emit.sqlTable.sqlTool <valueType, modelType> sqlTool, selectQuery <modelType> query, fastCSharp.code.memberMap <modelType> memberMap)
 {
     memberMap.Dispose();
     log.Error.Throw(log.exceptionType.ErrorOperation);
     return(null);
 }