mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 修复 DbFirst Oracle 序列值使用复杂的问题,结合 [Column(InsertValueSql = "xxx.nextval")];
This commit is contained in:
parent
9b87829d53
commit
a4367ebc5a
@ -211,6 +211,15 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:FreeSql.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
|
||||||
|
<summary>
|
||||||
|
批量注入 Repository,可以参考代码自行调整
|
||||||
|
</summary>
|
||||||
|
<param name="services"></param>
|
||||||
|
<param name="globalDataFilter"></param>
|
||||||
|
<param name="assemblies"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:FreeSql.IBaseRepository.AsType(System.Type)">
|
<member name="M:FreeSql.IBaseRepository.AsType(System.Type)">
|
||||||
<summary>
|
<summary>
|
||||||
动态Type,在使用 Repository<object> 后使用本方法,指定实体类型
|
动态Type,在使用 Repository<object> 后使用本方法,指定实体类型
|
||||||
|
@ -322,6 +322,14 @@ namespace FreeSql.Tests
|
|||||||
Assert.NotNull(mt_code);
|
Assert.NotNull(mt_code);
|
||||||
Assert.Equal(mt_codeId, mt_code.ID);
|
Assert.Equal(mt_codeId, mt_code.ID);
|
||||||
Assert.Equal("mt_code2", mt_code.Code);
|
Assert.Equal("mt_code2", mt_code.Code);
|
||||||
|
|
||||||
|
var id = g.oracle.Insert(new TestORC12()).ExecuteIdentity();
|
||||||
|
}
|
||||||
|
|
||||||
|
class TestORC12
|
||||||
|
{
|
||||||
|
[Column(IsIdentity = true, InsertValueSql = "\"CLASS1_seq_ID\".nextval")]
|
||||||
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Table(Name = "t_text")]
|
[Table(Name = "t_text")]
|
||||||
|
@ -86,7 +86,8 @@ namespace FreeSql
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
int ExecuteAffrows();
|
int ExecuteAffrows();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行SQL语句,返回被删除的记录
|
/// 执行SQL语句,返回被删除的记录<para></para>
|
||||||
|
/// 注意:此方法只有 Postgresql/SqlServer 有效果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<T1> ExecuteDeleted();
|
List<T1> ExecuteDeleted();
|
||||||
|
@ -106,12 +106,14 @@ namespace FreeSql
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
int ExecuteAffrows();
|
int ExecuteAffrows();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行SQL语句,返回自增值
|
/// 执行SQL语句,返回自增值<para></para>
|
||||||
|
/// 注意:请检查实体类是否标记了 [Column(IsIdentity = true)]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
long ExecuteIdentity();
|
long ExecuteIdentity();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行SQL语句,返回插入后的记录
|
/// 执行SQL语句,返回插入后的记录<para></para>
|
||||||
|
/// 注意:此方法只有 Postgresql/SqlServer 有效果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<T1> ExecuteInserted();
|
List<T1> ExecuteInserted();
|
||||||
|
@ -183,7 +183,8 @@ namespace FreeSql
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
int ExecuteAffrows();
|
int ExecuteAffrows();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行SQL语句,返回更新后的记录
|
/// 执行SQL语句,返回更新后的记录<para></para>
|
||||||
|
/// 注意:此方法只有 Postgresql/SqlServer 有效果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<T1> ExecuteUpdated();
|
List<T1> ExecuteUpdated();
|
||||||
|
@ -39,7 +39,7 @@ namespace FreeSql.Oracle.Curd
|
|||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (col.Attribute.IsIdentity) _identCol = col;
|
if (col.Attribute.IsIdentity) _identCol = col;
|
||||||
if (col.Attribute.IsIdentity && _insertIdentity == false) continue;
|
if (col.Attribute.IsIdentity && _insertIdentity == false && string.IsNullOrEmpty(col.DbInsertValue)) continue;
|
||||||
if (col.Attribute.IsIdentity == false && _ignore.ContainsKey(col.Attribute.Name)) continue;
|
if (col.Attribute.IsIdentity == false && _ignore.ContainsKey(col.Attribute.Name)) continue;
|
||||||
|
|
||||||
if (colidx > 0) sbtb.Append(", ");
|
if (colidx > 0) sbtb.Append(", ");
|
||||||
@ -60,7 +60,7 @@ namespace FreeSql.Oracle.Curd
|
|||||||
var colidx2 = 0;
|
var colidx2 = 0;
|
||||||
foreach (var col in _table.Columns.Values)
|
foreach (var col in _table.Columns.Values)
|
||||||
{
|
{
|
||||||
if (col.Attribute.IsIdentity && _insertIdentity == false) continue;
|
if (col.Attribute.IsIdentity && _insertIdentity == false && string.IsNullOrEmpty(col.DbInsertValue)) continue;
|
||||||
if (col.Attribute.IsIdentity == false && _ignore.ContainsKey(col.Attribute.Name)) continue;
|
if (col.Attribute.IsIdentity == false && _ignore.ContainsKey(col.Attribute.Name)) continue;
|
||||||
|
|
||||||
if (colidx2 > 0) sb.Append(", ");
|
if (colidx2 > 0) sb.Append(", ");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user