diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml index a89a4d64..ac93e9cc 100644 --- a/FreeSql/FreeSql.xml +++ b/FreeSql/FreeSql.xml @@ -2267,7 +2267,181 @@ CodeFirst迁移,执行完成触发 - + + + + + Insert/Update自动值处理 + + + + + 内置解析功能,可辅助您进行解析 + + + + + 需要您解析的表达式 + + + + + 解析后的内容 + + + + + 实体类型 + + + + + 实体配置 + + + + + 索引配置 + + + + + 实体类型 + + + + + 实体的属性 + + + + + 实体的属性配置 + + + + + 标识符,可将 CurdBefore 与 CurdAfter 进行匹配 + + + + + 操作类型 + + + + + 实体类型 + + + + + 实体类型的元数据 + + + + + 执行的 SQL + + + + + 参数化命令 + + + + + 发生的错误 + + + + + 执行SQL命令,返回的结果 + + + + + 耗时(单位:Ticks) + + + + + 耗时(单位:毫秒) + + + + + 标识符,可将 SyncStructureBeforeEventArgs 与 SyncStructureAfterEventArgs 进行匹配 + + + + + 实体类型 + + + + + 执行的 SQL + + + + + 发生的错误 + + + + + 耗时(单位:Ticks) + + + + + 耗时(单位:毫秒) + + + + + 类型 + + + + + 属性列的元数据 + + + + + 反射的属性信息 + + + + + 获取实体的属性值,也可以设置实体的属性新值 + + + + + 【开发环境必备】自动同步实体结构到数据库,程序运行中检查实体表是否存在,然后创建或修改 + + + + + 转小写同步结构 + + + + + 转大写同步结构 + + + + + 将数据库的主键、自增、索引设置导入,适用 DbFirst 模式,无须在实体类型上设置 [Column(IsPrimary)] 或者 ConfigEntity。此功能目前可用于 mysql/sqlserver/postgresql/oracle。 + 本功能会影响 IFreeSql 首次访问的速度。 + 若使用 CodeFirst 创建索引后,又直接在数据库上建了索引,若无本功能下一次 CodeFirst 迁移时数据库上创建的索引将被删除 + + + 不使用命令参数化执行,针对 Insert/Update @@ -2818,160 +2992,6 @@ CodeFirst 模式开发相关方法 - - - DbFirst 模式开发相关方法 - - < - - - true 时生效 - - - - - - 使用 or 拼接两个 lambda 表达式 - - - - - - 使用 or 拼接两个 lambda 表达式 - - - - true 时生效 - - - - - - 将 lambda 表达式取反 - - - - true 时生效 - - - - - 生成类似Mongodb的ObjectId有序、不重复Guid - - - - - - 插入数据 - - - - - - - 插入数据,传入实体 - - - - - - - - 插入数据,传入实体数组 - - - - - - - - 插入数据,传入实体集合 - - - - - - - - 插入数据,传入实体集合 - - - - - - - - 修改数据 - - - - - - - 修改数据,传入动态对象如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} - - - 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 - - - - - 查询数据 - - - - - - - 查询数据,传入动态对象如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} - - - 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 - - - - - 删除数据 - - - - - - - 删除数据,传入动态对象如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} - - - 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 - - - - - 开启事务(不支持异步),60秒未执行完将自动提交 - - 事务体 () => {} - - - - 开启事务(不支持异步) - - 事务体 () => {} - 超时,未执行完将自动提交 - - - - 数据库访问对象 - - - - - 所有拦截方法都在这里 - - - - - CodeFirst 模式开发相关方法 - - DbFirst 模式开发相关方法 diff --git a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleDbFirst.cs b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleDbFirst.cs index dfcbfa6b..618b5b16 100644 --- a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleDbFirst.cs +++ b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleDbFirst.cs @@ -276,8 +276,8 @@ where a.owner in ({1}) and {0} ds2item[1] = row[1]; ds2item[2] = Regex.Replace(string.Concat(row[2]), @"\(\d+\)", ""); ds2item[4] = OdbcOracleCodeFirst.GetOracleSqlTypeFullName(new object[] { row[1], row[2], row[3], row[4], row[5], row[6] }); - ds2item[5] = string.Concat(row[7]) == "1"; - ds2item[6] = string.Concat(row[8]) == "1"; + ds2item[5] = string.Concat(row[7]); + ds2item[6] = string.Concat(row[8]); ds2item[7] = string.Concat(row[9]); ds2.Add(ds2item); } @@ -321,7 +321,7 @@ a.table_owner || '.' || a.table_name, nvl(freesql_long_2_varchar(a.index_name, c.table_name, c.column_position), c.column_name), c.index_name, case when a.uniqueness = 'UNIQUE' then 1 else 0 end, -0, +case when exists(select 1 from all_constraints where constraint_name = a.index_name and constraint_type = 'P') then 1 else 0 end, 0, case when c.descend = 'DESC' then 1 else 0 end, c.column_position @@ -331,7 +331,6 @@ where a.index_name = c.index_name and a.table_owner = c.table_owner and a.table_name = c.table_name and a.table_owner in ({1}) and {0} -and not exists(select 1 from all_constraints where constraint_name = a.index_name and constraint_type = 'P') ", loc8, databaseIn); ds = _orm.Ado.ExecuteArray(CommandType.Text, sql); if (ds == null) return loc1; @@ -352,6 +351,7 @@ and not exists(select 1 from all_constraints where constraint_name = a.index_nam if (loc3.ContainsKey(table_id) == false || loc3[table_id].ContainsKey(column) == false) continue; var loc9 = loc3[table_id][column]; if (loc9.IsPrimary == false && is_primary_key) loc9.IsPrimary = is_primary_key; + if (is_primary_key) continue; Dictionary loc10 = null; DbIndexInfo loc11 = null; diff --git a/Providers/FreeSql.Provider.Oracle/OracleDbFirst.cs b/Providers/FreeSql.Provider.Oracle/OracleDbFirst.cs index 8f24499e..dfd9fef0 100644 --- a/Providers/FreeSql.Provider.Oracle/OracleDbFirst.cs +++ b/Providers/FreeSql.Provider.Oracle/OracleDbFirst.cs @@ -276,8 +276,8 @@ where a.owner in ({1}) and {0} ds2item[1] = row[1]; ds2item[2] = Regex.Replace(string.Concat(row[2]), @"\(\d+\)", ""); ds2item[4] = OracleCodeFirst.GetOracleSqlTypeFullName(new object[] { row[1], row[2], row[3], row[4], row[5], row[6] }); - ds2item[5] = string.Concat(row[7]) == "1"; - ds2item[6] = string.Concat(row[8]) == "1"; + ds2item[5] = string.Concat(row[7]); + ds2item[6] = string.Concat(row[8]); ds2item[7] = string.Concat(row[9]); ds2.Add(ds2item); } @@ -321,7 +321,7 @@ a.table_owner || '.' || a.table_name, nvl(freesql_long_2_varchar(a.index_name, c.table_name, c.column_position), c.column_name), c.index_name, case when a.uniqueness = 'UNIQUE' then 1 else 0 end, -0, +case when exists(select 1 from all_constraints where constraint_name = a.index_name and constraint_type = 'P') then 1 else 0 end, 0, case when c.descend = 'DESC' then 1 else 0 end, c.column_position @@ -331,7 +331,6 @@ where a.index_name = c.index_name and a.table_owner = c.table_owner and a.table_name = c.table_name and a.table_owner in ({1}) and {0} -and not exists(select 1 from all_constraints where constraint_name = a.index_name and constraint_type = 'P') ", loc8, databaseIn); ds = _orm.Ado.ExecuteArray(CommandType.Text, sql); if (ds == null) return loc1; @@ -352,6 +351,7 @@ and not exists(select 1 from all_constraints where constraint_name = a.index_nam if (loc3.ContainsKey(table_id) == false || loc3[table_id].ContainsKey(column) == false) continue; var loc9 = loc3[table_id][column]; if (loc9.IsPrimary == false && is_primary_key) loc9.IsPrimary = is_primary_key; + if (is_primary_key) continue; Dictionary loc10 = null; DbIndexInfo loc11 = null;