- 修复 Firebird CodeFirst.SyncStructure 自增错误;d154a463a5d239c0a4ce848f2ac9c75dca84ec55

This commit is contained in:
2881099 2022-12-02 22:13:35 +08:00
parent ad0df485a3
commit e3d526ec6d
4 changed files with 33 additions and 4 deletions

View File

@ -1,4 +1,5 @@
using FreeSql; using FreeSql;
using FreeSql.DataAnnotations;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@ -57,3 +58,11 @@ public class User1 : BaseEntity<User1, Guid>
[MaxLength(4000)] [MaxLength(4000)]
public string Description { get; set; } public string Description { get; set; }
} }
public class IdentityTable
{
[Column(IsIdentity = true, IsPrimary = true)]
public int id { get; set; }
public string name { get; set; }
}

View File

@ -451,10 +451,10 @@ namespace base_entity
//.UseSlaveWeight(10, 1, 1, 5) //.UseSlaveWeight(10, 1, 1, 5)
//.UseConnectionString(FreeSql.DataType.Firebird, @"database=localhost:D:\fbdata\EXAMPLES.fdb;user=sysdba;password=123456;max pool size=5") .UseConnectionString(FreeSql.DataType.Firebird, @"database=localhost:D:\fbdata\EXAMPLES.fdb;user=sysdba;password=123456;max pool size=5")
.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;min pool size=1;Max pool size=2") //.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;min pool size=1;Max pool size=2")
//.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3;TrustServerCertificate=true") //.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3;TrustServerCertificate=true")
@ -487,6 +487,8 @@ namespace base_entity
BaseEntity.Initialization(fsql, () => _asyncUow.Value); BaseEntity.Initialization(fsql, () => _asyncUow.Value);
#endregion #endregion
fsql.Select<IdentityTable>().Count();
var dkdksql = fsql.Select<User1>().WithLock().From<UserGroup>() var dkdksql = fsql.Select<User1>().WithLock().From<UserGroup>()
.InnerJoin<UserGroup>((user, usergroup) => user.GroupId == usergroup.Id && usergroup.GroupName == "xxx") .InnerJoin<UserGroup>((user, usergroup) => user.GroupId == usergroup.Id && usergroup.GroupName == "xxx")
.ToSql(); .ToSql();

View File

@ -22,6 +22,7 @@ namespace FreeSql.Generator
string ArgsConnectionString { get; } string ArgsConnectionString { get; }
string ArgsFilter { get; } string ArgsFilter { get; }
string ArgsMatch { get; } string ArgsMatch { get; }
string ArgsJson { get; }
string ArgsFileName { get; } string ArgsFileName { get; }
bool ArgsReadKey { get; } bool ArgsReadKey { get; }
internal string ArgsOutput { get; private set; } internal string ArgsOutput { get; private set; }
@ -62,6 +63,7 @@ new Colorful.Formatter("v" + string.Join(".", typeof(ConsoleApp).Assembly.GetNam
ArgsNameSpace = "MyProject"; ArgsNameSpace = "MyProject";
ArgsFilter = ""; ArgsFilter = "";
ArgsMatch = ""; ArgsMatch = "";
ArgsJson = "Newtonsoft.Json";
ArgsFileName = "{name}.cs"; ArgsFileName = "{name}.cs";
ArgsReadKey = true; ArgsReadKey = true;
Action<string> setArgsOutput = value => Action<string> setArgsOutput = value =>
@ -94,7 +96,7 @@ new Colorful.Formatter("v" + string.Join(".", typeof(ConsoleApp).Assembly.GetNam
-NameOptions * 4 -NameOptions * 4
,
线 线
@ -116,6 +118,8 @@ new Colorful.Formatter("v" + string.Join(".", typeof(ConsoleApp).Assembly.GetNam
-Filter View+StoreProcedure -Filter View+StoreProcedure
-Match dbo\.TB_.+ -Match dbo\.TB_.+
-Json NTJSTJNONE
Newtonsoft.JsonSystem.Text.Json
-FileName {name}.cs -FileName {name}.cs
-Output shell -Output shell
@ -196,6 +200,18 @@ new Colorful.Formatter("推荐在实体类目录创建 gen.bat双击它重新
if (Regex.IsMatch("", ArgsMatch)) { } //throw if (Regex.IsMatch("", ArgsMatch)) { } //throw
a++; a++;
break; break;
case "-json":
switch(args[a + 1].Trim().ToLower())
{
case "none":
ArgsJson = "";
break;
case "stj":
ArgsJson = "System.Text.Json";
break;
}
a++;
break;
case "-filename": case "-filename":
ArgsFileName = args[a + 1]; ArgsFileName = args[a + 1];
a++; a++;

View File

@ -516,7 +516,9 @@ namespace FreeSql.Internal
foreach (var col in trytb.Primarys) foreach (var col in trytb.Primarys)
{ {
col.Attribute.IsNullable = false; col.Attribute.IsNullable = false;
col.Attribute.DbType = col.Attribute.DbType.Replace("NOT NULL", "").Replace(" NULL", "").Trim() + " NOT NULL"; //sqlite 主键也可以插入 null col.Attribute.DbType = col.Attribute.DbType.Replace("NOT NULL", "").Replace(" NULL", "").Trim();
if (common._orm.Ado.DataType == DataType.Sqlite)
col.Attribute.DbType += " NOT NULL"; //sqlite 主键也可以插入 null
} }
foreach (var col in trytb.Columns.Values) foreach (var col in trytb.Columns.Values)
{ {