/// <summary> /// 添加数据 /// </summary> /// <typeparam name="valueType">数据类型</typeparam> /// <typeparam name="modelType">模型类型</typeparam> /// <param name="sqlTool">SQL操作工具</param> /// <param name="transaction">事务操作</param> /// <param name="value">添加数据</param> /// <param name="query">添加数据查询信息</param> /// <returns></returns> internal abstract bool Insert <valueType, modelType>(Sql.Table <valueType, modelType> sqlTool, Transaction transaction, valueType value, ref InsertQuery query) where valueType : class, modelType where modelType : class;
/// <summary> /// 添加数据 /// </summary> /// <typeparam name="valueType">数据类型</typeparam> /// <typeparam name="modelType">模型类型</typeparam> /// <param name="sqlTool">SQL操作工具</param> /// <param name="connection">SQL连接</param> /// <param name="value">添加数据</param> /// <param name="query">添加数据查询信息</param> /// <param name="isIgnoreTransaction">是否忽略应用程序事务</param> /// <returns></returns> internal bool Insert <valueType, modelType>(Sql.Table <valueType, modelType> sqlTool, ref DbConnection connection, valueType value, ref InsertQuery query, bool isIgnoreTransaction) where valueType : class, modelType where modelType : class { if (sqlTool.CallOnInsert(value)) { if (isIgnoreTransaction) { return(Insert(sqlTool, ref connection, value, ref query)); } if (AutoCSer.DomainUnload.Unloader.TransactionStart(false)) { try { return(Insert(sqlTool, ref connection, value, ref query)); } finally { AutoCSer.DomainUnload.Unloader.TransactionEnd(); } } } return(false); }
internal bool Insert <valueType, modelType>(Sql.Table <valueType, modelType> sqlTool, valueType value, MemberMap <modelType> memberMap, ref InsertQuery query) where valueType : class, modelType where modelType : class { if (memberMap == null) { memberMap = MemberMap <modelType> .Default; } if (DataModel.Model <modelType> .Verifyer.Verify(value, memberMap, sqlTool)) { insert(sqlTool, value, memberMap, ref query); return(true); } return(false); }
/// <summary> /// 获取添加数据 SQL 语句 /// </summary> /// <typeparam name="valueType">数据类型</typeparam> /// <typeparam name="modelType">模型类型</typeparam> /// <param name="sqlTool">SQL操作工具</param> /// <param name="value">添加数据</param> /// <param name="memberMap">成员位图</param> /// <param name="query">添加数据查询信息</param> internal abstract void insert <valueType, modelType>(Sql.Table <valueType, modelType> sqlTool, valueType value, MemberMap <modelType> memberMap, ref InsertQuery query) where valueType : class, modelType where modelType : class;
/// <summary> /// 删除数据 /// </summary> /// <typeparam name="valueType">数据类型</typeparam> /// <typeparam name="modelType">模型类型</typeparam> /// <param name="sqlTool">SQL操作工具</param> /// <param name="connection">SQL连接</param> /// <param name="value">添加数据</param> /// <param name="query">添加数据查询信息</param> /// <returns></returns> internal abstract bool Delete <valueType, modelType>(Sql.Table <valueType, modelType> sqlTool, ref DbConnection connection, valueType value, ref InsertQuery query) where valueType : class, modelType where modelType : class;