mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	@@ -1,7 +1,7 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
			
		||||
 | 
			
		||||
	<PropertyGroup>
 | 
			
		||||
		<TargetFrameworks>netstandard2.0;net461;net452;net451;net45</TargetFrameworks>
 | 
			
		||||
		<TargetFrameworks>net8.0;net7.0;net6.0;netstandard2.0;net461;net452;net451;net45</TargetFrameworks>
 | 
			
		||||
		<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
 | 
			
		||||
		<Authors>FreeSql;ncc;YeXiangQin</Authors>
 | 
			
		||||
		<Description>FreeSql 数据库实现,基于 PostgreSQL 9.5</Description>
 | 
			
		||||
@@ -31,7 +31,7 @@
 | 
			
		||||
		<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
 | 
			
		||||
	</ItemGroup>
 | 
			
		||||
 | 
			
		||||
	<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
 | 
			
		||||
	<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net6.0'">
 | 
			
		||||
		<PackageReference Include="Npgsql.LegacyPostgis" Version="5.0.11" />
 | 
			
		||||
		<PackageReference Include="Npgsql.NetTopologySuite" Version="5.0.11" />
 | 
			
		||||
	</ItemGroup>
 | 
			
		||||
@@ -49,6 +49,9 @@
 | 
			
		||||
	<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net461'">
 | 
			
		||||
		<DefineConstants>nts</DefineConstants>
 | 
			
		||||
	</PropertyGroup>
 | 
			
		||||
	<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net6.0'">
 | 
			
		||||
		<DefineConstants>net60</DefineConstants>
 | 
			
		||||
	</PropertyGroup>
 | 
			
		||||
 | 
			
		||||
	<ItemGroup>
 | 
			
		||||
		<ProjectReference Include="..\..\FreeSql\FreeSql.csproj" />
 | 
			
		||||
 
 | 
			
		||||
@@ -67,6 +67,16 @@ namespace FreeSql.PostgreSQL
 | 
			
		||||
            else if (param is DateTime?)
 | 
			
		||||
                return AddslashesTypeHandler(typeof(DateTime?), param) ?? string.Concat("'", ((DateTime)param).ToString("yyyy-MM-dd HH:mm:ss.ffffff"), "'");
 | 
			
		||||
 | 
			
		||||
#if net60
 | 
			
		||||
            else if (param is DateOnly || param is DateOnly?)
 | 
			
		||||
                return AddslashesTypeHandler(typeof(DateOnly), param) ?? string.Concat("'", ((DateOnly)param).ToString("yyyy-MM-dd"), "'");
 | 
			
		||||
            else if (param is TimeOnly || param is TimeOnly?)
 | 
			
		||||
            {
 | 
			
		||||
                var ts = (TimeOnly)param;
 | 
			
		||||
                return $"'{ts.Hour}:{ts.Minute}:{ts.Second}.{ts.Millisecond}'";
 | 
			
		||||
            }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
            else if (param is TimeSpan || param is TimeSpan?)
 | 
			
		||||
            {
 | 
			
		||||
                var ts = (TimeSpan)param;
 | 
			
		||||
 
 | 
			
		||||
@@ -46,6 +46,11 @@ namespace FreeSql.PostgreSQL
 | 
			
		||||
                { typeof(TimeSpan).FullName, CsToDb.New(NpgsqlDbType.Time, "time","time NOT NULL", false, false, 0) },{ typeof(TimeSpan?).FullName, CsToDb.New(NpgsqlDbType.Time, "time", "time",false, true, null) },
 | 
			
		||||
                { typeof(DateTime).FullName, CsToDb.New(NpgsqlDbType.Timestamp, "timestamp", "timestamp NOT NULL", false, false, new DateTime(1970,1,1)) },{ typeof(DateTime?).FullName, CsToDb.New(NpgsqlDbType.Timestamp, "timestamp", "timestamp", false, true, null) },
 | 
			
		||||
 | 
			
		||||
#if net60
 | 
			
		||||
                { typeof(TimeOnly).FullName, CsToDb.New(NpgsqlDbType.Time, "time", "time NOT NULL", false, false, 0) },{ typeof(TimeOnly?).FullName, CsToDb.New(NpgsqlDbType.Time, "time", "time", false, true, null) },
 | 
			
		||||
                { typeof(DateOnly).FullName, CsToDb.New(NpgsqlDbType.Date, "date", "date NOT NULL", false, false, new DateTime(1970,1,1)) },{ typeof(DateOnly?).FullName, CsToDb.New(NpgsqlDbType.Date, "date", "date", false, true, null) },
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
                { typeof(bool).FullName, CsToDb.New(NpgsqlDbType.Boolean, "bool","bool NOT NULL", null, false, false) },{ typeof(bool?).FullName, CsToDb.New(NpgsqlDbType.Boolean, "bool","bool", null, true, null) },
 | 
			
		||||
                { typeof(Byte[]).FullName, CsToDb.New(NpgsqlDbType.Bytea, "bytea", "bytea", false, null, new byte[0]) },
 | 
			
		||||
                { typeof(BitArray).FullName, CsToDb.New(NpgsqlDbType.Varbit, "varbit", "varbit(64)", false, null, new BitArray(new byte[64])) },
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user