mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	将示例项目类型升级为 .net core 3.1
This commit is contained in:
		@@ -4,6 +4,7 @@ using FreeSql.Extensions;
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
using Newtonsoft.Json.Linq;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Data.SqlClient;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Linq.Expressions;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
@@ -35,6 +36,7 @@ namespace base_entity
 | 
			
		||||
 | 
			
		||||
        static void Main(string[] args)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            #region 初始化 IFreeSql
 | 
			
		||||
            var fsql = new FreeSql.FreeSqlBuilder()
 | 
			
		||||
                .UseAutoSyncStructure(true)
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
 | 
			
		||||
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,6 @@ namespace FreeSql.Bechmarker
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [CoreJob]
 | 
			
		||||
    [RPlotExporter, RankColumn]
 | 
			
		||||
    public class OrmVsInsert
 | 
			
		||||
    {
 | 
			
		||||
@@ -111,7 +110,6 @@ namespace FreeSql.Bechmarker
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [CoreJob]
 | 
			
		||||
    [RPlotExporter, RankColumn]
 | 
			
		||||
    public class OrmVsUpdate
 | 
			
		||||
    {
 | 
			
		||||
@@ -144,7 +142,6 @@ namespace FreeSql.Bechmarker
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [CoreJob]
 | 
			
		||||
    [RPlotExporter, RankColumn]
 | 
			
		||||
    public class OrmVsSelect
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,13 +2,13 @@
 | 
			
		||||
 | 
			
		||||
	<PropertyGroup>
 | 
			
		||||
		<OutputType>Exe</OutputType>
 | 
			
		||||
		<TargetFramework>netcoreapp2.1</TargetFramework>
 | 
			
		||||
		<TargetFramework>netcoreapp3.1</TargetFramework>
 | 
			
		||||
	</PropertyGroup>
 | 
			
		||||
 | 
			
		||||
	<ItemGroup>
 | 
			
		||||
		<PackageReference Include="BenchmarkDotNet" Version="0.11.5" />
 | 
			
		||||
		<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.4" />
 | 
			
		||||
		<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
 | 
			
		||||
		<PackageReference Include="BenchmarkDotNet" Version="0.12.0" />
 | 
			
		||||
		<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0" />
 | 
			
		||||
		<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.0-rc1.final" />
 | 
			
		||||
	</ItemGroup>
 | 
			
		||||
 | 
			
		||||
	<ItemGroup>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,8 @@
 | 
			
		||||
using FreeSql;
 | 
			
		||||
using FreeSql.DataAnnotations;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Hosting;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using Microsoft.Extensions.Logging;
 | 
			
		||||
using Swashbuckle.AspNetCore.Swagger;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
@@ -73,18 +70,7 @@ namespace dbcontext_01
 | 
			
		||||
 | 
			
		||||
        public void ConfigureServices(IServiceCollection services)
 | 
			
		||||
        {
 | 
			
		||||
            services.AddMvc();
 | 
			
		||||
            services.AddSwaggerGen(options =>
 | 
			
		||||
            {
 | 
			
		||||
                options.SwaggerDoc("v1", new Info
 | 
			
		||||
                {
 | 
			
		||||
                    Version = "v1",
 | 
			
		||||
                    Title = "FreeSql.DbContext API"
 | 
			
		||||
                });
 | 
			
		||||
                //options.IncludeXmlComments(xmlPath);
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            services.AddControllersWithViews();
 | 
			
		||||
 | 
			
		||||
            services.AddSingleton<IFreeSql>(Fsql);
 | 
			
		||||
            services.AddSingleton<IFreeSql<long>>(Fsql2);
 | 
			
		||||
@@ -96,24 +82,16 @@ namespace dbcontext_01
 | 
			
		||||
            var sql3 = Fsql.Update<Song>(1).Set(a => a.Create_time.Value.AddHours(1)).ToSql();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
 | 
			
		||||
        public void Configure(IApplicationBuilder app)
 | 
			
		||||
        {
 | 
			
		||||
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
			
		||||
            Console.OutputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
            Console.InputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
 | 
			
		||||
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
 | 
			
		||||
            loggerFactory.AddDebug();
 | 
			
		||||
 | 
			
		||||
            app.UseHttpMethodOverride(new HttpMethodOverrideOptions { FormFieldName = "X-Http-Method-Override" });
 | 
			
		||||
            app.UseDeveloperExceptionPage();
 | 
			
		||||
            app.UseMvc();
 | 
			
		||||
 | 
			
		||||
            app.UseSwagger();
 | 
			
		||||
            app.UseSwaggerUI(c =>
 | 
			
		||||
            {
 | 
			
		||||
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "FreeSql.RESTful API V1");
 | 
			
		||||
            });
 | 
			
		||||
            app.UseRouting();
 | 
			
		||||
            app.UseEndpoints(a => a.MapControllers());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +1,12 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk.Web">
 | 
			
		||||
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <TargetFramework>netcoreapp2.1</TargetFramework>
 | 
			
		||||
    <TargetFramework>netcoreapp3.1</TargetFramework>
 | 
			
		||||
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
	  <PackageReference Include="Microsoft.AspNetCore.App" />
 | 
			
		||||
	  <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
 | 
			
		||||
	  <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="4.0.1" />
 | 
			
		||||
	  <PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
 | 
			
		||||
	  <PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
 
 | 
			
		||||
@@ -47,7 +47,7 @@ public static class CodeFirstExtensions
 | 
			
		||||
                    );
 | 
			
		||||
 | 
			
		||||
                    //可空
 | 
			
		||||
                    freeProp.IsNullable(prop.AfterSaveBehavior != PropertySaveBehavior.Throw);
 | 
			
		||||
                    freeProp.IsNullable(prop.GetAfterSaveBehavior() != PropertySaveBehavior.Throw);
 | 
			
		||||
 | 
			
		||||
                    //类型
 | 
			
		||||
                    var relationalColumnType = prop.FindAnnotation("Relational:ColumnType");
 | 
			
		||||
 
 | 
			
		||||
@@ -68,13 +68,10 @@ namespace efcore_to_freesql
 | 
			
		||||
            services.AddMvc();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
 | 
			
		||||
        public void Configure(IApplicationBuilder app)
 | 
			
		||||
        {
 | 
			
		||||
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
 | 
			
		||||
            loggerFactory.AddDebug();
 | 
			
		||||
 | 
			
		||||
            app.UseDeveloperExceptionPage();
 | 
			
		||||
            app.UseMvc();
 | 
			
		||||
            app.UseEndpoints(a => a.MapControllers());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,12 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk.Web">
 | 
			
		||||
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <TargetFramework>netcoreapp2.1</TargetFramework>
 | 
			
		||||
    <TargetFramework>netcoreapp3.1</TargetFramework>
 | 
			
		||||
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <PackageReference Include="Microsoft.AspNetCore.App" />
 | 
			
		||||
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
 | 
			
		||||
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.0" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <OutputType>Exe</OutputType>
 | 
			
		||||
    <TargetFramework>netcoreapp2.1</TargetFramework>
 | 
			
		||||
    <TargetFramework>netcoreapp3.1</TargetFramework>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
 
 | 
			
		||||
@@ -60,7 +60,7 @@
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <PackageReference Include="Newtonsoft.Json">
 | 
			
		||||
      <Version>12.0.2</Version>
 | 
			
		||||
      <Version>12.0.3</Version>
 | 
			
		||||
    </PackageReference>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +1,11 @@
 | 
			
		||||
using FreeSql;
 | 
			
		||||
using FreeSql.DataAnnotations;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Hosting;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using Microsoft.Extensions.Logging;
 | 
			
		||||
using restful.Entitys;
 | 
			
		||||
using Swashbuckle.AspNetCore.Swagger;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace repository_01
 | 
			
		||||
@@ -61,17 +56,7 @@ namespace repository_01
 | 
			
		||||
 | 
			
		||||
            //services.AddTransient(s => s.)
 | 
			
		||||
 | 
			
		||||
            services.AddMvc();
 | 
			
		||||
            services.AddSwaggerGen(options =>
 | 
			
		||||
            {
 | 
			
		||||
                options.SwaggerDoc("v1", new Info
 | 
			
		||||
                {
 | 
			
		||||
                    Version = "v1",
 | 
			
		||||
                    Title = "FreeSql.RESTful API"
 | 
			
		||||
                });
 | 
			
		||||
                //options.IncludeXmlComments(xmlPath);
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            services.AddControllersWithViews();
 | 
			
		||||
            services.AddSingleton<IFreeSql>(Fsql);
 | 
			
		||||
 | 
			
		||||
            services.AddFreeRepository(filter =>
 | 
			
		||||
@@ -82,24 +67,16 @@ namespace repository_01
 | 
			
		||||
            }, this.GetType().Assembly);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
 | 
			
		||||
        public void Configure(IApplicationBuilder app)
 | 
			
		||||
        {
 | 
			
		||||
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
			
		||||
            Console.OutputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
            Console.InputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
 | 
			
		||||
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
 | 
			
		||||
            loggerFactory.AddDebug();
 | 
			
		||||
 | 
			
		||||
            app.UseHttpMethodOverride(new HttpMethodOverrideOptions { FormFieldName = "X-Http-Method-Override" });
 | 
			
		||||
            app.UseDeveloperExceptionPage();
 | 
			
		||||
            app.UseMvc();
 | 
			
		||||
 | 
			
		||||
            app.UseSwagger();
 | 
			
		||||
            app.UseSwaggerUI(c =>
 | 
			
		||||
            {
 | 
			
		||||
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "FreeSql.RESTful API V1");
 | 
			
		||||
            });
 | 
			
		||||
            app.UseRouting();
 | 
			
		||||
            app.UseEndpoints(a => a.MapControllers());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,20 +1,18 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk.Web">
 | 
			
		||||
 | 
			
		||||
	<PropertyGroup>
 | 
			
		||||
		<TargetFramework>netcoreapp2.1</TargetFramework>
 | 
			
		||||
		<TargetFramework>netcoreapp3.1</TargetFramework>
 | 
			
		||||
		<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
 | 
			
		||||
	</PropertyGroup>
 | 
			
		||||
 | 
			
		||||
	<ItemGroup>
 | 
			
		||||
		<PackageReference Include="FreeSql.Provider.Sqlite" Version="0.10.2" />
 | 
			
		||||
		<PackageReference Include="Microsoft.AspNetCore.App" />
 | 
			
		||||
		<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
 | 
			
		||||
		<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="4.0.1" />
 | 
			
		||||
		<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
 | 
			
		||||
		<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
 | 
			
		||||
	</ItemGroup>
 | 
			
		||||
 | 
			
		||||
	<ItemGroup>
 | 
			
		||||
	  <ProjectReference Include="..\..\Extensions\FreeSql.Extensions.LazyLoading\FreeSql.Extensions.LazyLoading.csproj" />
 | 
			
		||||
	  <ProjectReference Include="..\..\FreeSql.DbContext\FreeSql.DbContext.csproj" />
 | 
			
		||||
	  <ProjectReference Include="..\..\Providers\FreeSql.Provider.Sqlite\FreeSql.Provider.Sqlite.csproj" />
 | 
			
		||||
	</ItemGroup>
 | 
			
		||||
 | 
			
		||||
</Project>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,7 @@
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Hosting;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
using Microsoft.Extensions.Logging;
 | 
			
		||||
using Swashbuckle.AspNetCore.Swagger;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
@@ -41,37 +39,19 @@ namespace restful
 | 
			
		||||
        public void ConfigureServices(IServiceCollection services)
 | 
			
		||||
        {
 | 
			
		||||
            services.AddSingleton<IFreeSql>(Fsql);
 | 
			
		||||
 | 
			
		||||
            services.AddMvc();
 | 
			
		||||
            services.AddSwaggerGen(options =>
 | 
			
		||||
            {
 | 
			
		||||
                options.SwaggerDoc("v1", new Info
 | 
			
		||||
                {
 | 
			
		||||
                    Version = "v1",
 | 
			
		||||
                    Title = "FreeSql.RESTful API"
 | 
			
		||||
                });
 | 
			
		||||
                //options.IncludeXmlComments(xmlPath);
 | 
			
		||||
            });
 | 
			
		||||
            services.AddControllersWithViews();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
 | 
			
		||||
        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
 | 
			
		||||
        {
 | 
			
		||||
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 | 
			
		||||
            Console.OutputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
            Console.InputEncoding = Encoding.GetEncoding("GB2312");
 | 
			
		||||
 | 
			
		||||
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
 | 
			
		||||
            loggerFactory.AddDebug();
 | 
			
		||||
 | 
			
		||||
            app.UseHttpMethodOverride(new HttpMethodOverrideOptions { FormFieldName = "X-Http-Method-Override" });
 | 
			
		||||
            app.UseDeveloperExceptionPage();
 | 
			
		||||
            app.UseMvc();
 | 
			
		||||
 | 
			
		||||
            app.UseSwagger();
 | 
			
		||||
            app.UseSwaggerUI(c =>
 | 
			
		||||
            {
 | 
			
		||||
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "FreeSql.RESTful API V1");
 | 
			
		||||
            });
 | 
			
		||||
            app.UseRouting();
 | 
			
		||||
            app.UseEndpoints(a => a.MapControllers());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,17 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk.Web">
 | 
			
		||||
 | 
			
		||||
	<PropertyGroup>
 | 
			
		||||
		<TargetFramework>netcoreapp2.1</TargetFramework>
 | 
			
		||||
		<TargetFramework>netcoreapp3.1</TargetFramework>
 | 
			
		||||
		<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
 | 
			
		||||
	</PropertyGroup>
 | 
			
		||||
 | 
			
		||||
	<ItemGroup>
 | 
			
		||||
		<PackageReference Include="Microsoft.AspNetCore.App" />
 | 
			
		||||
		<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
 | 
			
		||||
		<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="4.0.1" />
 | 
			
		||||
		<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
 | 
			
		||||
		<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.0" />
 | 
			
		||||
	</ItemGroup>
 | 
			
		||||
 | 
			
		||||
	<ItemGroup>
 | 
			
		||||
	  <ProjectReference Include="..\..\FreeSql\FreeSql.csproj" />
 | 
			
		||||
	  <ProjectReference Include="..\..\Providers\FreeSql.Provider.Sqlite\FreeSql.Provider.Sqlite.csproj" />
 | 
			
		||||
	</ItemGroup>
 | 
			
		||||
 | 
			
		||||
</Project>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
			
		||||
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <TargetFramework>netcoreapp2.1</TargetFramework>
 | 
			
		||||
    <TargetFramework>netcoreapp3.1</TargetFramework>
 | 
			
		||||
 | 
			
		||||
    <IsPackable>false</IsPackable>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
			
		||||
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <TargetFramework>netcoreapp2.1</TargetFramework>
 | 
			
		||||
    <TargetFramework>netcoreapp3.1</TargetFramework>
 | 
			
		||||
 | 
			
		||||
    <IsPackable>false</IsPackable>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
			
		||||
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <TargetFramework>netcoreapp2.1</TargetFramework>
 | 
			
		||||
    <TargetFramework>netcoreapp3.1</TargetFramework>
 | 
			
		||||
 | 
			
		||||
    <IsPackable>false</IsPackable>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
			
		||||
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <TargetFramework>netcoreapp2.1</TargetFramework>
 | 
			
		||||
    <TargetFramework>netcoreapp3.1</TargetFramework>
 | 
			
		||||
 | 
			
		||||
    <IsPackable>false</IsPackable>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
			
		||||
 | 
			
		||||
	<PropertyGroup>
 | 
			
		||||
		<TargetFramework>netcoreapp2.1</TargetFramework>
 | 
			
		||||
		<TargetFramework>netcoreapp3.1</TargetFramework>
 | 
			
		||||
 | 
			
		||||
		<IsPackable>false</IsPackable>
 | 
			
		||||
	</PropertyGroup>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										64
									
								
								FreeSql.Tests/FreeSql.Tests/UnitTest3.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								FreeSql.Tests/FreeSql.Tests/UnitTest3.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Tests
 | 
			
		||||
{
 | 
			
		||||
    public class UnitTest3
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        [Fact]
 | 
			
		||||
        public void Test03()
 | 
			
		||||
        {
 | 
			
		||||
            //using (var conn = new SqlConnection("Data Source=.;Integrated Security=True;Initial Catalog=webchat-abc;Pooling=true;Max Pool Size=13"))
 | 
			
		||||
            //{
 | 
			
		||||
            //    conn.Open();
 | 
			
		||||
            //    conn.Close();
 | 
			
		||||
            //}
 | 
			
		||||
 | 
			
		||||
            //using (var fsql = new FreeSql.FreeSqlBuilder()
 | 
			
		||||
            //    .UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=webchat-abc;Pooling=true;Max Pool Size=13")
 | 
			
		||||
            //    .UseAutoSyncStructure(true)
 | 
			
		||||
            //    //.UseGenerateCommandParameterWithLambda(true)
 | 
			
		||||
            //    .UseMonitorCommand(
 | 
			
		||||
            //        cmd => Trace.WriteLine("\r\n线程" + Thread.CurrentThread.ManagedThreadId + ": " + cmd.CommandText) //监听SQL命令对象,在执行前
 | 
			
		||||
            //        //, (cmd, traceLog) => Console.WriteLine(traceLog)
 | 
			
		||||
            //        )
 | 
			
		||||
            //    .UseLazyLoading(true)
 | 
			
		||||
            //    .Build())
 | 
			
		||||
            //{
 | 
			
		||||
            //    fsql.Select<ut3_t1>().ToList();
 | 
			
		||||
            //}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        class ut3_t1
 | 
			
		||||
        {
 | 
			
		||||
            [Column(IsIdentity = true)]
 | 
			
		||||
            public int id { get; set; }
 | 
			
		||||
            public string name { get; set; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        class ut3_t2
 | 
			
		||||
        {
 | 
			
		||||
            [Column(IsIdentity = true)]
 | 
			
		||||
            public int id { get; set; }
 | 
			
		||||
            public string name { get; set; }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user