Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/2881099/FreeSql
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Nov 16, 2024
2 parents 0b7b071 + 78415d8 commit e0369ac
Show file tree
Hide file tree
Showing 38 changed files with 267 additions and 162 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!--
经常出于版本交叉问题,暂时关闭,在每个项目上设置版本号
<PropertyGroup>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
</PropertyGroup>
-->

Expand Down
50 changes: 30 additions & 20 deletions Examples/base_entity/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,39 +574,39 @@ static void Main(string[] args)
//.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")
//.UseQuoteSqlName(false)

//.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=3;AllowLoadLocalInfile=true")

//.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3;TrustServerCertificate=true")
//.UseAdoConnectionPool(false)
//.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=127.0.0.1;Port=5432;Username=postgres;Password=123456;Database=tedb;Pooling=true;Maximum Pool Size=2")
////.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=127.0.0.1;Port=5432;Username=postgres;Password=123456;Database=toc;Pooling=true;Maximum Pool Size=2")
//.UseNameConvert(FreeSql.Internal.NameConvertType.ToLower)
//.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3;TrustServerCertificate=true")
//.UseAdoConnectionPool(false)
//.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=127.0.0.1;Port=5432;Username=postgres;Password=123456;Database=tedb;Pooling=true;Maximum Pool Size=2")
////.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=127.0.0.1;Port=5432;Username=postgres;Password=123456;Database=toc;Pooling=true;Maximum Pool Size=2")
//.UseNameConvert(FreeSql.Internal.NameConvertType.ToLower)

//.UseConnectionString(FreeSql.DataType.Oracle, "user id=user1;password=123456;data source=//127.0.0.1:1521/XE;Pooling=true;Max Pool Size=2")
//.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)
//.UseConnectionString(FreeSql.DataType.Oracle, "user id=user1;password=123456;data source=//127.0.0.1:1521/XE;Pooling=true;Max Pool Size=2")
//.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)

//.UseConnectionString(FreeSql.DataType.Dameng, "server=127.0.0.1;port=5236;user=2user;password=123456789;database=2user;poolsize=5;")
//.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)
//.UseConnectionString(FreeSql.DataType.Dameng, "server=127.0.0.1;port=5236;user=2user;password=123456789;database=2user;poolsize=5;")
//.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)

//.UseConnectionString(FreeSql.DataType.OdbcMySql, "Driver={MySQL ODBC 8.0 Unicode Driver};Server=127.0.0.1;Persist Security Info=False;Trusted_Connection=Yes;UID=root;PWD=root;DATABASE=cccddd_odbc;Charset=utf8;SslMode=none;Max pool size=2")
//.UseConnectionString(FreeSql.DataType.OdbcMySql, "Driver={MySQL ODBC 8.0 Unicode Driver};Server=127.0.0.1;Persist Security Info=False;Trusted_Connection=Yes;UID=root;PWD=root;DATABASE=cccddd_odbc;Charset=utf8;SslMode=none;Max pool size=2")

//.UseConnectionString(FreeSql.DataType.OdbcSqlServer, "Driver={SQL Server};Server=.;Persist Security Info=False;Trusted_Connection=Yes;Integrated Security=True;DATABASE=freesqlTest_odbc;Pooling=true;Max pool size=3")
//.UseConnectionString(FreeSql.DataType.OdbcSqlServer, "Driver={SQL Server};Server=.;Persist Security Info=False;Trusted_Connection=Yes;Integrated Security=True;DATABASE=freesqlTest_odbc;Pooling=true;Max pool size=3")

//.UseConnectionString(FreeSql.DataType.OdbcPostgreSQL, "Driver={PostgreSQL Unicode(x64)};Server=127.0.0.1;Port=5432;UID=postgres;PWD=123456;Database=tedb_odbc;Pooling=true;Maximum Pool Size=2")
//.UseNameConvert(FreeSql.Internal.NameConvertType.ToLower)
//.UseConnectionString(FreeSql.DataType.OdbcPostgreSQL, "Driver={PostgreSQL Unicode(x64)};Server=127.0.0.1;Port=5432;UID=postgres;PWD=123456;Database=tedb_odbc;Pooling=true;Maximum Pool Size=2")
//.UseNameConvert(FreeSql.Internal.NameConvertType.ToLower)

//.UseConnectionString(FreeSql.DataType.OdbcOracle, "Driver={Oracle in XE};Server=//127.0.0.1:1521/XE;Persist Security Info=False;Trusted_Connection=Yes;UID=odbc1;PWD=123456")
//.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)
//.UseConnectionString(FreeSql.DataType.OdbcOracle, "Driver={Oracle in XE};Server=//127.0.0.1:1521/XE;Persist Security Info=False;Trusted_Connection=Yes;UID=odbc1;PWD=123456")
//.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper)

//.UseConnectionString(FreeSql.DataType.OdbcDameng, "Driver={DM8 ODBC DRIVER};Server=127.0.0.1:5236;Persist Security Info=False;Trusted_Connection=Yes;UID=USER1;PWD=123456789")
//.UseConnectionString(DataType.QuestDb, "host=localhost;port=8812;username=admin;password=quest;database=qdb;ServerCompatibilityMode=NoTypeLoading;")
//.UseConnectionString(FreeSql.DataType.OdbcDameng, "Driver={DM8 ODBC DRIVER};Server=127.0.0.1:5236;Persist Security Info=False;Trusted_Connection=Yes;UID=USER1;PWD=123456789")
//.UseConnectionString(DataType.QuestDb, "host=localhost;port=8812;username=admin;password=quest;database=qdb;ServerCompatibilityMode=NoTypeLoading;")

//.UseConnectionString(DataType.ClickHouse, "DataCompress=False;BufferSize=32768;SocketTimeout=10000;CheckCompressedHash=False;Encrypt=False;Compressor=lz4;Host=192.168.0.121;Port=8125;Database=PersonnelLocation;Username=root;Password=123")
//.UseConnectionString(DataType.ClickHouse, "DataCompress=False;BufferSize=32768;SocketTimeout=10000;CheckCompressedHash=False;Encrypt=False;Compressor=lz4;Host=192.168.0.121;Port=8125;Database=PersonnelLocation;Username=root;Password=123")
//.UseConnectionFactory(DataType.ClickHouse, () => null)
.UseMonitorCommand(cmd =>
.UseMonitorCommand(cmd =>
{
Console.WriteLine(cmd.CommandText + "\r\n");
//cmd.CommandText = null; //不执行
Expand All @@ -619,6 +619,16 @@ static void Main(string[] args)
BaseEntity.Initialization(fsql, () => _asyncUow.Value);
#endregion

fsql.Delete<User1>().Where("1=1").ExecuteAffrows();
fsql.Insert(new List<User1>
{
new User1 { Nickname = "nickname11", Username = "username11", Description = "desc11" },
new User1 { Nickname = "n2", Username = "u2", Description = "d2" },
new User1 { Nickname = "n3", Username = "u3", Description = "d3" },
}).ExecuteAffrows();

var firebirdList01 = fsql.Select<User1>().ToList();

fsql.UseJsonMap();

fsql.Select<Table11>().Where(a => a.Options.Value1 == 100 && a.Options.Value2 == "xx").ToList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<LangVersion>latest</LangVersion>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<Title>$(AssemblyName)</Title>
<IsPackable>true</IsPackable>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Extensions/FreeSql.Generator/FreeSql.Generator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageProjectUrl>https://github.com/2881099/FreeSql</PackageProjectUrl>
<RepositoryUrl>https://github.com/2881099/FreeSql</RepositoryUrl>
<PackageTags>FreeSql DbFirst 实体生成器</PackageTags>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion FreeSql.All/FreeSql.All.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion FreeSql.DbContext/FreeSql.DbContext.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion FreeSql.Repository/FreeSql.Repository.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
69 changes: 69 additions & 0 deletions FreeSql.Tests/FreeSql.Tests/Dameng/DamengCodeFirstTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,5 +454,74 @@ class TableAllType

public enum TableAllTypeEnumType1 { e1, e2, e3, e5 }
[Flags] public enum TableAllTypeEnumType2 { f1, f2, f3 }



[Fact]
public void UpgradeTableStructure()
{
g.dameng.CodeFirst.SyncStructure<TableUpgradeTest>();

g.dameng.Delete<TableUpgradeTest>()
.Where(item => 1 == 1)
.ExecuteAffrows();

var text = new StringBuilder();
var temp = "1234567890哈";
for (int i = 0; i < 3000 - temp.Length; i+= temp.Length)
{
text.Append(temp);
}

var mode = new TableUpgradeTest
{
Name = "1234560123456012哈哈哈哈哈呵呵_123123",
Text = text.ToString(),
Text2 = "呵呵呵Test123123123"
};

mode.Id = g.dameng.Insert(mode)
.ExecuteIdentity();

// 第二次进行数据库结果同步
var sql = g.dameng.CodeFirst.GetComparisonDDLStatements<TableUpgradeTest>();
g.dameng.Ado.ExecuteNonQuery(sql);
//g.dameng.CodeFirst.SyncStructure<TableSubString>();

var resultMode = g.dameng.Select<TableUpgradeTest>()
.Where(item => item.Id == mode.Id)
.First();

Assert.Equal(mode.Name, resultMode?.Name);
Assert.Equal(mode.Text, resultMode?.Text);
Assert.Equal(mode.Text2, resultMode?.Text2);
Assert.Equal(mode.Text3, resultMode?.Text3);

}

[Table(Name = "tb_upgrade_test")]
public class TableUpgradeTest
{
[Column(Name = "id", IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }


[Column(Name = "name", StringLength = 31, IsNullable = false)]
public string Name { get; set; }

[Column(Name = "text", StringLength = 32767, IsNullable = false)]
public string Text { get; set; }

[Column(Name = "number_test", IsNullable = false)]
public int TestNumber { get; set; }

[Column(Name = "text2", StringLength = 63)]
public string Text2 { get; set; }


[Column(Name = "text3")]
public string Text3 { get; set; }
}

}
}
2 changes: 1 addition & 1 deletion FreeSql/FreeSql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<Version>3.5.100-preview20241112</Version>
<Version>3.5.100-preview20241113</Version>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

Expand Down
Loading

0 comments on commit e0369ac

Please sign in to comment.