- 增加 pgsql numeric -> BigInteger 映射;#1100

This commit is contained in:
2881099
2022-05-13 12:32:26 +08:00
parent 7ed2d87b8d
commit fc32710421
27 changed files with 223 additions and 244 deletions

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net5.0;netcoreapp3.1;</TargetFrameworks>
<TargetFrameworks>net6.0;netcoreapp3.1;</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
@ -12,6 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Npgsql.NetTopologySuite" Version="6.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">

View File

@ -1,4 +1,4 @@
using FreeSql.DataAnnotations;
using FreeSql.DataAnnotations;
using NetTopologySuite.Geometries;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@ -11,7 +11,9 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using Xunit;
namespace FreeSql.Tests.PostgreSQL.NetTopologySuite
@ -19,11 +21,65 @@ namespace FreeSql.Tests.PostgreSQL.NetTopologySuite
public class PostgreSQLCodeFirstTest
{
[Fact]
public void UInt256Crud2()
{
var fsql = g.pgsql;
fsql.Aop.AuditDataReader += (_, e) =>
{
var dbtype = e.DataReader.GetDataTypeName(e.Index);
var m = Regex.Match(dbtype, @"numeric\((\d+)\)", RegexOptions.IgnoreCase);
if (m.Success && int.Parse(m.Groups[1].Value) > 19)
e.Value = e.DataReader.GetFieldValue<BigInteger>(e.Index); //否则会报溢出错误
};
var num = BigInteger.Parse("57896044618658097711785492504343953926634992332820282019728792003956564819968");
fsql.Delete<tuint256tb_01>().Where("1=1").ExecuteAffrows();
Assert.Equal(1, fsql.Insert(new tuint256tb_01()).ExecuteAffrows());
var find = fsql.Select<tuint256tb_01>().ToList();
Assert.Single(find);
Assert.Equal("0", find[0].Number.ToString());
var item = new tuint256tb_01 { Number = num };
Assert.Equal(1, fsql.Insert(item).ExecuteAffrows());
find = fsql.Select<tuint256tb_01>().Where(a => a.Id == item.Id).ToList();
Assert.Single(find);
Assert.Equal(item.Number, find[0].Number);
num = num - 1;
item.Number = num;
Assert.Equal(1, fsql.Update<tuint256tb_01>().SetSource(item).ExecuteAffrows());
find = fsql.Select<tuint256tb_01>().Where(a => a.Id == item.Id).ToList();
Assert.Single(find);
Assert.Equal("57896044618658097711785492504343953926634992332820282019728792003956564819967", find[0].Number.ToString());
num = BigInteger.Parse("57896044618658097711785492504343953926634992332820282019728792003956564819968");
fsql.Delete<tuint256tb_01>().Where("1=1").ExecuteAffrows();
Assert.Equal(1, fsql.Insert(new tuint256tb_01()).NoneParameter().ExecuteAffrows());
find = fsql.Select<tuint256tb_01>().ToList();
Assert.Single(find);
Assert.Equal("0", find[0].Number.ToString());
item = new tuint256tb_01 { Number = num };
Assert.Equal(1, fsql.Insert(item).NoneParameter().ExecuteAffrows());
find = fsql.Select<tuint256tb_01>().Where(a => a.Id == item.Id).ToList();
Assert.Single(find);
Assert.Equal(item.Number, find[0].Number);
num = num - 1;
item.Number = num;
Assert.Equal(1, fsql.Update<tuint256tb_01>().NoneParameter().SetSource(item).ExecuteAffrows());
find = fsql.Select<tuint256tb_01>().Where(a => a.Id == item.Id).ToList();
Assert.Single(find);
Assert.Equal("57896044618658097711785492504343953926634992332820282019728792003956564819967", find[0].Number.ToString());
}
class tuint256tb_01
{
public Guid Id { get; set; }
public BigInteger Number { get; set; }
}
[Fact]
public void GetComparisonDDLStatements()
{
var sql = g.pgsql.CodeFirst.GetComparisonDDLStatements<TableAllType>();
Assert.True(string.IsNullOrEmpty(sql)); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD>
Assert.True(string.IsNullOrEmpty(sql)); //测试运行两次后
g.pgsql.Select<TableAllType>();
}
@ -43,8 +99,8 @@ namespace FreeSql.Tests.PostgreSQL.NetTopologySuite
var item2 = new TableAllType
{
testFieldBitArray = new BitArray(Encoding.UTF8.GetBytes("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")),
testFieldBitArrayArray = new[] { new BitArray(Encoding.UTF8.GetBytes("<EFBFBD>й<EFBFBD>")), new BitArray(Encoding.UTF8.GetBytes("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")) },
testFieldBitArray = new BitArray(Encoding.UTF8.GetBytes("我是")),
testFieldBitArrayArray = new[] { new BitArray(Encoding.UTF8.GetBytes("中国")), new BitArray(Encoding.UTF8.GetBytes("公民")) },
testFieldBool = true,
testFieldBoolArray = new[] { true, true, false, false },
testFieldBoolArrayNullable = new bool?[] { true, true, null, false, false },
@ -53,8 +109,8 @@ namespace FreeSql.Tests.PostgreSQL.NetTopologySuite
testFieldByteArray = new byte[] { 0, 1, 2, 3, 4, 5, 6 },
testFieldByteArrayNullable = new byte?[] { 0, 1, 2, 3, null, 4, 5, 6 },
testFieldByteNullable = byte.MinValue,
testFieldBytes = Encoding.UTF8.GetBytes("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>"),
testFieldBytesArray = new[] { Encoding.UTF8.GetBytes("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>"), Encoding.UTF8.GetBytes("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>") },
testFieldBytes = Encoding.UTF8.GetBytes("我是中国人"),
testFieldBytesArray = new[] { Encoding.UTF8.GetBytes("我是中国人"), Encoding.UTF8.GetBytes("我是中国人") },
testFieldCidr = (IPAddress.Parse("10.0.0.0"), 8),
testFieldCidrArray = new[] { (IPAddress.Parse("10.0.0.0"), 8), (IPAddress.Parse("192.168.0.0"), 16) },
testFieldCidrArrayNullable = new (IPAddress, int)?[] { (IPAddress.Parse("10.0.0.0"), 8), null, (IPAddress.Parse("192.168.0.0"), 16) },
@ -229,9 +285,9 @@ namespace FreeSql.Tests.PostgreSQL.NetTopologySuite
testFieldShortArray = new short[] { 1, 2, 3, 4, 5 },
testFieldShortArrayNullable = new short?[] { 1, 2, 3, null, 4, 5 },
testFieldShortNullable = short.MinValue,
testFieldString = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>string'\\?!@#$%^&*()_+{}}{~?><<>",
testFieldString = "我是中国人string'\\?!@#$%^&*()_+{}}{~?><<>",
testFieldChar = 'X',
testFieldStringArray = new[] { "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>String1", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>String2", null, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>String3" },
testFieldStringArray = new[] { "我是中国人String1", "我是中国人String2", null, "我是中国人String3" },
testFieldTimeSpan = TimeSpan.FromDays(1),
testFieldTimeSpanArray = new[] { TimeSpan.FromDays(1), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(60) },
testFieldTimeSpanArrayNullable = new TimeSpan?[] { TimeSpan.FromDays(1), TimeSpan.FromSeconds(10), null, TimeSpan.FromSeconds(60) },

View File

@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@ -1,14 +1,7 @@
using FreeSql.DataAnnotations;
using FreeSql;
using FreeSql.Internal;
using System;
using System.Collections.Generic;
using Xunit;
using System.Linq;
using Newtonsoft.Json.Linq;
using NpgsqlTypes;
using Npgsql.LegacyPostgis;
using FreeSql.Internal;
using System.Linq.Expressions;
using Xunit;
namespace FreeSql.ExpressionTree
{

View File

@ -1,23 +1,10 @@
using FreeSql.DataAnnotations;
using FreeSql;
using System;
using System.Collections.Generic;
using Xunit;
using System.Linq;
using Newtonsoft.Json.Linq;
using NpgsqlTypes;
using Npgsql.LegacyPostgis;
using System.Linq.Expressions;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Data.SqlClient;
using kwlib;
using System.Diagnostics;
using System.IO;
using System.Text;
using FreeSql;
using FreeSql.Internal;
using FreeSql.Internal.CommonProvider;
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Xunit;
namespace FreeSql.InternalTests
{

View File

@ -1,21 +1,4 @@
using FreeSql.DataAnnotations;
using FreeSql;
using System;
using System.Collections.Generic;
using Xunit;
using System.Linq;
using Newtonsoft.Json.Linq;
using NpgsqlTypes;
using Npgsql.LegacyPostgis;
using System.Linq.Expressions;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Data.SqlClient;
using kwlib;
using System.Diagnostics;
using System.IO;
using System.Text;
using Xunit;
namespace FreeSql.Tests.Issues
{

View File

@ -1,22 +1,8 @@
using FreeSql.DataAnnotations;
using FreeSql;
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using Xunit;
using System.Linq;
using Newtonsoft.Json.Linq;
using NpgsqlTypes;
using Npgsql.LegacyPostgis;
using System.Linq.Expressions;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Data.SqlClient;
using kwlib;
using System.Diagnostics;
using System.IO;
using System.Text;
using Newtonsoft.Json;
namespace FreeSql.Tests.Issues
{

View File

@ -1,21 +1,7 @@
using FreeSql.DataAnnotations;
using FreeSql;
using System;
using System.Collections.Generic;
using Xunit;
using System.Linq;
using Newtonsoft.Json.Linq;
using NpgsqlTypes;
using Npgsql.LegacyPostgis;
using System.Linq.Expressions;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Data.SqlClient;
using kwlib;
using System.Diagnostics;
using System.IO;
using System.Text;
using Xunit;
namespace FreeSql.Tests.Issues
{

View File

@ -1,22 +1,5 @@
using FreeSql.DataAnnotations;
using FreeSql;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Xunit;
using System.Linq;
using Newtonsoft.Json.Linq;
using NpgsqlTypes;
using Npgsql.LegacyPostgis;
using System.Linq.Expressions;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Data.SqlClient;
using kwlib;
using System.Diagnostics;
using System.IO;
using System.Text;
using FreeSql.Extensions.Linq;
namespace FreeSql.Tests.Linq
{

View File

@ -1,21 +1,7 @@
using FreeSql.DataAnnotations;
using FreeSql;
using System;
using System.Collections.Generic;
using Xunit;
using System.Linq;
using Newtonsoft.Json.Linq;
using NpgsqlTypes;
using Npgsql.LegacyPostgis;
using System.Linq.Expressions;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Data.SqlClient;
using kwlib;
using System.Diagnostics;
using System.IO;
using System.Text;
using Xunit;
namespace FreeSql.Tests.Linq
{

View File

@ -1,21 +1,9 @@
using FreeSql.DataAnnotations;
using FreeSql;
using FreeSql;
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using Xunit;
using System.Linq;
using Newtonsoft.Json.Linq;
using NpgsqlTypes;
using Npgsql.LegacyPostgis;
using System.Linq.Expressions;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Data.SqlClient;
using kwlib;
using System.Diagnostics;
using System.IO;
using System.Text;
using Xunit;
namespace FreeSql.Tests.Linq
{

View File

@ -1,5 +1,4 @@
using FreeSql.DataAnnotations;
using Newtonsoft.Json;
using FreeSql.DataAnnotations;
using Newtonsoft.Json.Linq;
using Npgsql;
using Npgsql.LegacyPostgis;
@ -11,6 +10,7 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Numerics;
using System.Text;
using Xunit;
@ -18,12 +18,13 @@ namespace FreeSql.Tests.PostgreSQL
{
public class PostgreSQLCodeFirstTest
{
[Fact]
public void InsertUpdateParameter()
{
var fsql = g.pgsql;
fsql.CodeFirst.SyncStructure<ts_iupstr_bak>();
var item = new ts_iupstr { id = Guid.NewGuid(), title = string.Join(",", Enumerable.Range(0, 2000).Select(a => "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>")) };
var item = new ts_iupstr { id = Guid.NewGuid(), title = string.Join(",", Enumerable.Range(0, 2000).Select(a => "我是中国人")) };
Assert.Equal(1, fsql.Insert(item).ExecuteAffrows());
var find = fsql.Select<ts_iupstr>().Where(a => a.id == item.id).First();
Assert.NotNull(find);
@ -91,7 +92,7 @@ namespace FreeSql.Tests.PostgreSQL
[Fact]
public void Blob()
{
var str1 = string.Join(",", Enumerable.Range(0, 10000).Select(a => "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>"));
var str1 = string.Join(",", Enumerable.Range(0, 10000).Select(a => "我是中国人"));
var data1 = Encoding.UTF8.GetBytes(str1);
var item1 = new TS_BLB01 { Data = data1 };
@ -137,57 +138,57 @@ namespace FreeSql.Tests.PostgreSQL
}
[Fact]
public void <EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>_<EFBFBD>ֶ<EFBFBD>()
public void _字段()
{
var sql = g.pgsql.CodeFirst.GetComparisonDDLStatements<<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>>();
g.pgsql.CodeFirst.SyncStructure<<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>>();
var sql = g.pgsql.CodeFirst.GetComparisonDDLStatements<>();
g.pgsql.CodeFirst.SyncStructure<>();
var item = new <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>
var item = new
{
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = "<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>",
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> = DateTime.Now
= "测试标题",
= DateTime.Now
};
Assert.Equal(1, g.pgsql.Insert<<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>>().AppendData(item).ExecuteAffrows());
Assert.NotEqual(Guid.Empty, item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>);
var item2 = g.pgsql.Select<<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>>().Where(a => a.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> == item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>).First();
Assert.Equal(1, g.pgsql.Insert<>().AppendData(item).ExecuteAffrows());
Assert.NotEqual(Guid.Empty, item.);
var item2 = g.pgsql.Select<>().Where(a => a. == item.).First();
Assert.NotNull(item2);
Assert.Equal(item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, item2.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>);
Assert.Equal(item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, item2.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>);
Assert.Equal(item., item2.);
Assert.Equal(item., item2.);
item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = "<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Assert.Equal(1, g.pgsql.Update<<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>>().SetSource(item).ExecuteAffrows());
item2 = g.pgsql.Select<<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>>().Where(a => a.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> == item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>).First();
item. = "测试标题更新";
Assert.Equal(1, g.pgsql.Update<>().SetSource(item).ExecuteAffrows());
item2 = g.pgsql.Select<>().Where(a => a. == item.).First();
Assert.NotNull(item2);
Assert.Equal(item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, item2.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>);
Assert.Equal(item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, item2.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>);
Assert.Equal(item., item2.);
Assert.Equal(item., item2.);
item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = "<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_repo";
var repo = g.pgsql.GetRepository<<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>>();
item. = "测试标题更新_repo";
var repo = g.pgsql.GetRepository<>();
Assert.Equal(1, repo.Update(item));
item2 = g.pgsql.Select<<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>>().Where(a => a.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> == item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>).First();
item2 = g.pgsql.Select<>().Where(a => a. == item.).First();
Assert.NotNull(item2);
Assert.Equal(item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, item2.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>);
Assert.Equal(item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, item2.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>);
Assert.Equal(item., item2.);
Assert.Equal(item., item2.);
item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = "<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_repo22";
item. = "测试标题更新_repo22";
Assert.Equal(1, repo.Update(item));
item2 = g.pgsql.Select<<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>>().Where(a => a.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> == item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>).First();
item2 = g.pgsql.Select<>().Where(a => a. == item.).First();
Assert.NotNull(item2);
Assert.Equal(item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, item2.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>);
Assert.Equal(item.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>, item2.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>);
Assert.Equal(item., item2.);
Assert.Equal(item., item2.);
}
class <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>
class
{
[Column(IsPrimary = true)]
public Guid <EFBFBD><EFBFBD><EFBFBD><EFBFBD> { get; set; }
public Guid { get; set; }
public string <EFBFBD><EFBFBD><EFBFBD><EFBFBD> { get; set; }
public string { get; set; }
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
public DateTime <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> { get; set; }
public DateTime { get; set; }
[Column(ServerTime = DateTimeKind.Local)]
public DateTime <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> { get; set; }
public DateTime { get; set; }
}
[Fact]
@ -215,7 +216,7 @@ namespace FreeSql.Tests.PostgreSQL
public void AddField()
{
var sql = g.pgsql.CodeFirst.GetComparisonDDLStatements<TopicAddField>();
Assert.True(string.IsNullOrEmpty(sql)); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD>
Assert.True(string.IsNullOrEmpty(sql)); //测试运行两次后
g.pgsql.Select<TopicAddField>();
var id = g.pgsql.Insert<TopicAddField>().AppendData(new TopicAddField { }).ExecuteIdentity();
}
@ -259,8 +260,6 @@ namespace FreeSql.Tests.PostgreSQL
[Fact]
public void CurdAllField()
{
NpgsqlConnection.GlobalTypeMapper.UseLegacyPostgis();
var sql1 = select.Where(a => a.testFieldIntArray.Contains(1)).ToSql();
var sql2 = select.Where(a => a.testFieldIntArray.Contains(1)).ToSql();
@ -271,8 +270,8 @@ namespace FreeSql.Tests.PostgreSQL
var item2 = new TableAllType
{
testFieldBitArray = new BitArray(Encoding.UTF8.GetBytes("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")),
testFieldBitArrayArray = new[] { new BitArray(Encoding.UTF8.GetBytes("<EFBFBD>й<EFBFBD>")), new BitArray(Encoding.UTF8.GetBytes("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")) },
testFieldBitArray = new BitArray(Encoding.UTF8.GetBytes("我是")),
testFieldBitArrayArray = new[] { new BitArray(Encoding.UTF8.GetBytes("中国")), new BitArray(Encoding.UTF8.GetBytes("公民")) },
testFieldBool = true,
testFieldBoolArray = new[] { true, true, false, false },
testFieldBoolArrayNullable = new bool?[] { true, true, null, false, false },
@ -281,8 +280,8 @@ namespace FreeSql.Tests.PostgreSQL
testFieldByteArray = new byte[] { 0, 1, 2, 3, 4, 5, 6 },
testFieldByteArrayNullable = new byte?[] { 0, 1, 2, 3, null, 4, 5, 6 },
testFieldByteNullable = byte.MinValue,
testFieldBytes = Encoding.UTF8.GetBytes("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>"),
testFieldBytesArray = new[] { Encoding.UTF8.GetBytes("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>"), Encoding.UTF8.GetBytes("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>") },
testFieldBytes = Encoding.UTF8.GetBytes("我是中国人"),
testFieldBytesArray = new[] { Encoding.UTF8.GetBytes("我是中国人"), Encoding.UTF8.GetBytes("我是中国人") },
testFieldCidr = (IPAddress.Parse("10.0.0.0"), 8),
testFieldCidrArray = new[] { (IPAddress.Parse("10.0.0.0"), 8), (IPAddress.Parse("192.168.0.0"), 16) },
testFieldCidrArrayNullable = new (IPAddress, int)?[] { (IPAddress.Parse("10.0.0.0"), 8), null, (IPAddress.Parse("192.168.0.0"), 16) },
@ -457,9 +456,9 @@ namespace FreeSql.Tests.PostgreSQL
testFieldShortArray = new short[] { 1, 2, 3, 4, 5 },
testFieldShortArrayNullable = new short?[] { 1, 2, 3, null, 4, 5 },
testFieldShortNullable = short.MinValue,
testFieldString = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>string'\\?!@#$%^&*()_+{}}{~?><<>",
testFieldString = "我是中国人string'\\?!@#$%^&*()_+{}}{~?><<>",
testFieldChar = 'X',
testFieldStringArray = new[] { "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>String1", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>String2", null, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>String3" },
testFieldStringArray = new[] { "我是中国人String1", "我是中国人String2", null, "我是中国人String3" },
testFieldTimeSpan = TimeSpan.FromDays(1),
testFieldTimeSpanArray = new[] { TimeSpan.FromDays(1), TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(60) },
testFieldTimeSpanArrayNullable = new TimeSpan?[] { TimeSpan.FromDays(1), TimeSpan.FromSeconds(10), null, TimeSpan.FromSeconds(60) },

View File

@ -1,12 +1,10 @@
using FreeSql.DataAnnotations;
using FreeSql.DataAnnotations;
using Newtonsoft.Json.Linq;
using Npgsql;
using Npgsql.LegacyPostgis;
using NpgsqlTypes;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
@ -19,11 +17,6 @@ namespace FreeSql.Tests.PostgreSQLExpression
ISelect<TableAllType> select => g.pgsql.Select<TableAllType>();
public OtherTest()
{
NpgsqlConnection.GlobalTypeMapper.UseLegacyPostgis();
}
[Fact]
public void Div()
{

View File

@ -1,22 +1,16 @@
using FreeSql.DataAnnotations;
using FreeSql;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using Xunit;
using System.Linq;
using Newtonsoft.Json.Linq;
using NpgsqlTypes;
using Npgsql.LegacyPostgis;
using System.Linq.Expressions;
using System.Threading.Tasks;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Zeus;
using Zeus.Domain.Enum;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using System.Threading;
using Newtonsoft.Json;
namespace FreeSql.Tests
{

View File

@ -1,19 +1,13 @@
using FreeSql.DataAnnotations;
using FreeSql;
using FreeSql;
using FreeSql.DataAnnotations;
using kwlib;
using Microsoft.Data.SqlClient;
using System;
using System.Collections.Generic;
using Xunit;
using System.Linq;
using Newtonsoft.Json.Linq;
using NpgsqlTypes;
using Npgsql.LegacyPostgis;
using System.Linq.Expressions;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.Threading;
using Microsoft.Data.SqlClient;
using kwlib;
using System.Text;
using Xunit;
namespace FreeSql.Tests
{

View File

@ -1,25 +1,13 @@
using FreeSql.DataAnnotations;
using FreeSql;
using FreeSql;
using FreeSql.DataAnnotations;
using kwlib;
using System;
using System.Collections.Generic;
using Xunit;
using System.Linq;
using Newtonsoft.Json.Linq;
using NpgsqlTypes;
using Npgsql.LegacyPostgis;
using System.Linq.Expressions;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Data.SqlClient;
using kwlib;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using System.Net.NetworkInformation;
using System.Net;
using System.Collections;
using System.Threading;
using Xunit;
namespace FreeSql.Tests
{