Forráskód Böngészése

升级到.NET Standard 2.1

懒得勤快 6 éve
szülő
commit
6877729fe7

+ 5 - 1
Masuit.LuceneEFCore.SearchEngine.Test/Masuit.LuceneEFCore.SearchEngine.Test.csproj

@@ -1,11 +1,15 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp2.2</TargetFramework>
+    <TargetFramework>netcoreapp3.0</TargetFramework>
 
     <IsPackable>false</IsPackable>
 
     <Configurations>Debug;Release;String版本;Guid版本;Long版本</Configurations>
+
+    <RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
+
+    <RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
   </PropertyGroup>
 
   <ItemGroup>

+ 4 - 2
Masuit.LuceneEFCore.SearchEngine/Masuit.LuceneEFCore.SearchEngine.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netstandard2.0</TargetFramework>
+    <TargetFramework>netstandard2.1</TargetFramework>
     <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
     <Authors>懒得勤快</Authors>
     <Company>懒得勤快懒得勤快</Company>
@@ -10,8 +10,10 @@
     <Copyright>懒得勤快</Copyright>
     <PackageProjectUrl>https://github.com/ldqk/Masuit.LuceneEFCore.SearchEngine</PackageProjectUrl>
     <PackageId>Masuit.LuceneEFCore.SearchEngine_int</PackageId>
-    <Version>1.0.1.2</Version>
+    <Version>1.0.2</Version>
     <Configurations>Debug;Release;String版本;Guid版本;Long版本</Configurations>
+    <RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
+    <RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

+ 4 - 12
WebSearchDemo/Program.cs

@@ -1,12 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Logging;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Hosting;
 
 namespace WebSearchDemo
 {
@@ -17,8 +10,7 @@ namespace WebSearchDemo
             CreateWebHostBuilder(args).Build().Run();
         }
 
-        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
-            WebHost.CreateDefaultBuilder(args)
-                .UseStartup<Startup>();
+        public static IHostBuilder CreateWebHostBuilder(string[] args) =>
+            Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults(builder => builder.UseStartup<Startup>());
     }
 }

+ 14 - 7
WebSearchDemo/Startup.cs

@@ -7,8 +7,8 @@ using Microsoft.AspNetCore.Mvc;
 using Microsoft.EntityFrameworkCore;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
+using Microsoft.OpenApi.Models;
 using Newtonsoft.Json;
-using Swashbuckle.AspNetCore.Swagger;
 using System;
 using System.Collections.Generic;
 using System.IO;
@@ -39,15 +39,18 @@ namespace WebSearchDemo
             });
             services.AddSwaggerGen(c =>
             {
-                c.SwaggerDoc("v1", new Info
+                c.SwaggerDoc("v1", new OpenApiInfo
                 {
-                    Title = "API文档",
-                    Version = "v1"
+                    Version = "v1",
+                    Title = $"接口文档",
+                    Description = $"HTTP API ",
+                    Contact = new OpenApiContact { Name = "懒得勤快", Email = "[email protected]", Url = new Uri("https://masuit.coom") },
+                    License = new OpenApiLicense { Name = "懒得勤快", Url = new Uri("https://masuit.com") }
                 });
-                c.DescribeAllEnumsAsStrings();
                 c.IncludeXmlComments(AppContext.BaseDirectory + "WebSearchDemo.xml");
             }); //配置swagger
-            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
+            services.AddControllers();
+            services.AddControllersWithViews().SetCompatibilityVersion(CompatibilityVersion.Latest);
         }
 
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -66,7 +69,11 @@ namespace WebSearchDemo
             {
                 c.SwaggerEndpoint($"/swagger/v1/swagger.json", "懒得勤快的博客,搜索引擎测试");
             }); //配置swagger
-            app.UseMvcWithDefaultRoute();
+            app.UseRouting().UseEndpoints(endpoints =>
+            {
+                endpoints.MapControllers(); // 属性路由
+                endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); // 默认路由
+            });
         }
     }
 }

+ 5 - 4
WebSearchDemo/WebSearchDemo.csproj

@@ -1,9 +1,11 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp2.2</TargetFramework>
+    <TargetFramework>netcoreapp3.0</TargetFramework>
     <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
     <Configurations>Debug;Release;String版本;Guid版本;Long版本</Configurations>
+    <RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
+    <RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -11,10 +13,9 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Microsoft.AspNetCore.App" />
-    <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
+    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
     <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.2.6" />
-    <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
+    <PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc4" />
   </ItemGroup>
 
   <ItemGroup>

+ 30 - 0
WebSearchDemo/WebSearchDemo.xml

@@ -4,6 +4,36 @@
         <name>WebSearchDemo</name>
     </assembly>
     <members>
+        <member name="M:WebSearchDemo.Controllers.HomeController.Index(System.String,System.Int32,System.Int32)">
+            <summary>
+            搜索
+            </summary>
+            <param name="s">关键词</param>
+            <param name="page">第几页</param>
+            <param name="size">页大小</param>
+            <returns></returns>
+        </member>
+        <member name="M:WebSearchDemo.Controllers.HomeController.CreateIndex">
+            <summary>
+            创建索引
+            </summary>
+        </member>
+        <member name="M:WebSearchDemo.Controllers.HomeController.AddIndex(WebSearchDemo.Database.Post)">
+            <summary>
+            添加索引
+            </summary>
+        </member>
+        <member name="M:WebSearchDemo.Controllers.HomeController.DeleteIndex(WebSearchDemo.Database.Post)">
+            <summary>
+            删除索引
+            </summary>
+        </member>
+        <member name="M:WebSearchDemo.Controllers.HomeController.UpdateIndex(WebSearchDemo.Database.Post)">
+            <summary>
+            更新索引库
+            </summary>
+            <param name="post"></param>
+        </member>
         <member name="T:WebSearchDemo.Database.Post">
             <summary>
             文章