initial commit

This commit is contained in:
tk
2024-11-13 18:18:28 +08:00
commit 013f35e296
1500 changed files with 443723 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
using Npgsql;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading;
public class g
{
static Lazy<IFreeSql> pgsqlLazy = new Lazy<IFreeSql>(() =>
{
NpgsqlConnection.GlobalTypeMapper.UseNetTopologySuite();
return new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=127.0.0.1;Port=5432;Username=postgres;Password=123456;Database=tedb;ArrayNullabilityMode=Always;Pooling=true;Maximum Pool Size=2")
//.UseConnectionFactory(FreeSql.DataType.PostgreSQL, () => new Npgsql.NpgsqlConnection("Host=127.0.0.1;Port=5432;Username=postgres;Password=123456;Database=tedb;Pooling=true;"))
.UseAutoSyncStructure(true)
//.UseGenerateCommandParameterWithLambda(true)
.UseNameConvert(FreeSql.Internal.NameConvertType.ToLower)
.UseLazyLoading(true)
.UseMonitorCommand(
cmd => Trace.WriteLine("\r\n线程" + Thread.CurrentThread.ManagedThreadId + ": " + cmd.CommandText) //监听SQL命令对象在执行前
//, (cmd, traceLog) => Console.WriteLine(traceLog)
)
.Build();
});
public static IFreeSql pgsql => pgsqlLazy.Value;
}