Browse Source

feat: dotnet new fsapp -n cis

master
fajiao 2 years ago
parent
commit
3b2e312b50
  1. 25
      Cis.Application/Cis.Application.csproj
  2. 19
      Cis.Application/Cis.Application.xml
  3. 15
      Cis.Application/GlobalUsings.cs
  4. 31
      Cis.Application/applicationsettings.json
  5. 20
      Cis.Core/Cis.Core.csproj
  6. 18
      Cis.Core/Cis.Core.xml
  7. 22
      Cis.Core/DbContext.cs
  8. 17
      Cis.Web.Core/Cis.Web.Core.csproj
  9. 8
      Cis.Web.Core/Cis.Web.Core.xml
  10. 16
      Cis.Web.Core/Handlers/JwtHandler.cs
  11. 51
      Cis.Web.Core/Startup.cs
  12. 13
      Cis.Web.Entry/Cis.Web.Entry.csproj
  13. 23
      Cis.Web.Entry/Controllers/HomeController.cs
  14. 1
      Cis.Web.Entry/Program.cs
  15. 28
      Cis.Web.Entry/Properties/launchSettings.json
  16. 12
      Cis.Web.Entry/Views/Home/Index.cshtml
  17. 11
      Cis.Web.Entry/Views/Shared/_Layout.cshtml
  18. 2
      Cis.Web.Entry/Views/_ViewImports.cshtml
  19. 3
      Cis.Web.Entry/Views/_ViewStart.cshtml
  20. 10
      Cis.Web.Entry/appsettings.Development.json
  21. 18
      Cis.Web.Entry/appsettings.json
  22. BIN
      Cis.Web.Entry/wwwroot/images/logo.png
  23. 43
      Cis.sln

25
Cis.Application/Cis.Application.csproj

@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<NoWarn>1701;1702;1591</NoWarn>
<DocumentationFile>Cis.Application.xml</DocumentationFile>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<None Remove="applicationsettings.json" />
<None Remove="Cis.Application.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="applicationsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cis.Core\Cis.Core.csproj" />
</ItemGroup>
</Project>

19
Cis.Application/Cis.Application.xml

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Cis.Application</name>
</assembly>
<members>
<member name="T:Cis.Application.SystemAppService">
<summary>
系统服务接口
</summary>
</member>
<member name="M:Cis.Application.SystemAppService.GetDescription">
<summary>
获取系统描述
</summary>
<returns></returns>
</member>
</members>
</doc>

15
Cis.Application/GlobalUsings.cs

@ -0,0 +1,15 @@
global using Furion;
global using Furion.DataEncryption;
global using Furion.DataValidation;
global using Furion.DependencyInjection;
global using Furion.DynamicApiController;
global using Furion.Extensions;
global using Furion.FriendlyException;
global using Furion.Logging;
global using Mapster;
global using Microsoft.AspNetCore.Authorization;
global using Microsoft.AspNetCore.Http;
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.CodeAnalysis;
global using System.ComponentModel.DataAnnotations;
global using SqlSugar;

31
Cis.Application/applicationsettings.json

@ -0,0 +1,31 @@
{
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
"SpecificationDocumentSettings": {
"DocumentTitle": "Furion | 规范化接口",
"GroupOpenApiInfos": [
{
"Group": "Default",
"Title": "规范化接口演示",
"Description": "让 .NET 开发更简单,更通用,更流行。",
"Version": "1.0.0",
"TermsOfService": "https://furion.icu",
"Contact": {
"Name": "百小僧",
"Url": "https://gitee.com/monksoul",
"Email": "monksoul@outlook.com"
},
"License": {
"Name": "Apache-2.0",
"Url": "https://gitee.com/dotnetchina/Furion/blob/rc1/LICENSE"
}
}
]
},
"CorsAccessorSettings": {
"WithExposedHeaders": [
"access-token",
"x-access-token",
"environment"
]
}
}

20
Cis.Core/Cis.Core.csproj

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<NoWarn>1701;1702;1591</NoWarn>
<DocumentationFile>Cis.Core.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Remove="Cis.Core.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.4.9" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.4.9" />
<PackageReference Include="Furion.Pure" Version="4.4.9" />
<PackageReference Include="SqlSugarCore" Version="5.1.3.1" />
</ItemGroup>
</Project>

18
Cis.Core/Cis.Core.xml

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Cis.Core</name>
</assembly>
<members>
<member name="T:Cis.Core.DbContext">
<summary>
数据库上下文对象
</summary>
</member>
<member name="F:Cis.Core.DbContext.Instance">
<summary>
SqlSugar 数据库实例
</summary>
</member>
</members>
</doc>

22
Cis.Core/DbContext.cs

@ -0,0 +1,22 @@
using Furion;
using SqlSugar;
using System.Collections.Generic;
namespace Cis.Core;
/// <summary>
/// 数据库上下文对象
/// </summary>
public static class DbContext
{
/// <summary>
/// SqlSugar 数据库实例
/// </summary>
public static readonly SqlSugarScope Instance = new(
// 读取 appsettings.json 中的 ConnectionConfigs 配置节点
App.GetConfig<List<ConnectionConfig>>("ConnectionConfigs")
, db =>
{
// 这里配置全局事件,比如拦截执行 SQL
});
}

17
Cis.Web.Core/Cis.Web.Core.csproj

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<NoWarn>1701;1702;1591</NoWarn>
<DocumentationFile>Cis.Web.Core.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Remove="Cis.Web.Core.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cis.Application\Cis.Application.csproj" />
</ItemGroup>
</Project>

8
Cis.Web.Core/Cis.Web.Core.xml

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Cis.Web.Core</name>
</assembly>
<members>
</members>
</doc>

16
Cis.Web.Core/Handlers/JwtHandler.cs

@ -0,0 +1,16 @@
using Furion.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
namespace Cis.Web.Core;
public class JwtHandler : AppAuthorizeHandler
{
public override Task<bool> PipelineAsync(AuthorizationHandlerContext context, DefaultHttpContext httpContext)
{
// 这里写您的授权判断逻辑,授权通过返回 true,否则返回 false
return Task.FromResult(true);
}
}

51
Cis.Web.Core/Startup.cs

@ -0,0 +1,51 @@
using Furion;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Cis.Web.Core;
public class Startup : AppStartup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddJwt<JwtHandler>();
services.AddCorsAccessor();
services.AddControllersWithViews()
.AddInjectWithUnifyResult();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseCorsAccessor();
app.UseAuthentication();
app.UseAuthorization();
app.UseInject();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
}

13
Cis.Web.Entry/Cis.Web.Entry.csproj

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Cis.Web.Core\Cis.Web.Core.csproj" />
</ItemGroup>
</Project>

23
Cis.Web.Entry/Controllers/HomeController.cs

@ -0,0 +1,23 @@
using Cis.Application;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Cis.Web.Entry.Controllers;
[AllowAnonymous]
public class HomeController : Controller
{
private readonly ISystemService _systemService;
public HomeController(ISystemService systemService)
{
_systemService = systemService;
}
public IActionResult Index()
{
ViewBag.Description = _systemService.GetDescription();
return View();
}
}

1
Cis.Web.Entry/Program.cs

@ -0,0 +1 @@
Serve.Run(RunOptions.Default.WithArgs(args));

28
Cis.Web.Entry/Properties/launchSettings.json

@ -0,0 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:58595",
"sslPort": 44326
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Cis.Web.Entry": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

12
Cis.Web.Entry/Views/Home/Index.cshtml

@ -0,0 +1,12 @@
@{
ViewData["Title"] = ViewBag.Description;
}
<div style="text-align:center;margin-top:50px;">
<img src="~/images/logo.png" style="height:100px;" />
<div align="center">
<p><a href="https://gitee.com/dotnetchina/Furion/stargazers"><img src="https://gitee.com/dotnetchina/Furion/badge/star.svg?theme=gvp" alt="star"></a> <a href="https://gitee.com/dotnetchina/Furion/members"><img src="https://gitee.com/dotnetchina/Furion/badge/fork.svg?theme=gvp" alt="fork"></a> <a href="https://github.com/MonkSoul/Furion/stargazers"><img src="https://img.shields.io/github/stars/MonkSoul/Furion?logo=github" alt="GitHub stars"></a> <a href="https://github.com/MonkSoul/Furion/network"><img src="https://img.shields.io/github/forks/MonkSoul/Furion?logo=github" alt="GitHub forks"></a> <a href="https://github.com/MonkSoul/Furion/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-orange" alt="GitHub license"></a> <a href="https://www.nuget.org/packages/Furion"><img src="https://img.shields.io/nuget/v/Furion.svg?cacheSeconds=10800" alt="nuget"></a></p>
</div>
<p>@ViewBag.Description</p>
<p><a href="/api">API 接口</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://gitee.com/dotnetchina/Furion" target="_blank">源码地址</a></p>
</div>

11
Cis.Web.Entry/Views/Shared/_Layout.cshtml

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewData["Title"] - Furion</title>
</head>
<body>
@RenderBody()
</body>
</html>

2
Cis.Web.Entry/Views/_ViewImports.cshtml

@ -0,0 +1,2 @@
@using Cis.Web.Entry
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

3
Cis.Web.Entry/Views/_ViewStart.cshtml

@ -0,0 +1,3 @@
@{
Layout = "_Layout";
}

10
Cis.Web.Entry/appsettings.Development.json

@ -0,0 +1,10 @@
{
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Information"
}
}
}

18
Cis.Web.Entry/appsettings.json

@ -0,0 +1,18 @@
{
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Information"
}
},
"AllowedHosts": "*",
"ConnectionConfigs": [
{
"ConnectionString": "Data Source=./Furion.db",
"DbType": "Sqlite",
"IsAutoCloseConnection": true
}
]
}

BIN
Cis.Web.Entry/wwwroot/images/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

43
Cis.sln

@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32519.111
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cis.Application", "Cis.Application\Cis.Application.csproj", "{AB699EE9-43A8-46F2-A855-04A26DE63372}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cis.Web.Core", "Cis.Web.Core\Cis.Web.Core.csproj", "{9D14BB78-DA2A-4040-B9DB-5A515B599181}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cis.Core", "Cis.Core\Cis.Core.csproj", "{4FB30091-15C7-4FD9-AB7D-266814F360F5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cis.Web.Entry", "Cis.Web.Entry\Cis.Web.Entry.csproj", "{9826E365-EEE9-4721-A738-B02AB64D47E5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AB699EE9-43A8-46F2-A855-04A26DE63372}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB699EE9-43A8-46F2-A855-04A26DE63372}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB699EE9-43A8-46F2-A855-04A26DE63372}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB699EE9-43A8-46F2-A855-04A26DE63372}.Release|Any CPU.Build.0 = Release|Any CPU
{9D14BB78-DA2A-4040-B9DB-5A515B599181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D14BB78-DA2A-4040-B9DB-5A515B599181}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D14BB78-DA2A-4040-B9DB-5A515B599181}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D14BB78-DA2A-4040-B9DB-5A515B599181}.Release|Any CPU.Build.0 = Release|Any CPU
{4FB30091-15C7-4FD9-AB7D-266814F360F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4FB30091-15C7-4FD9-AB7D-266814F360F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4FB30091-15C7-4FD9-AB7D-266814F360F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4FB30091-15C7-4FD9-AB7D-266814F360F5}.Release|Any CPU.Build.0 = Release|Any CPU
{9826E365-EEE9-4721-A738-B02AB64D47E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9826E365-EEE9-4721-A738-B02AB64D47E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9826E365-EEE9-4721-A738-B02AB64D47E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9826E365-EEE9-4721-A738-B02AB64D47E5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B2073C2C-0FD3-452B-8047-8134D68E12CE}
EndGlobalSection
EndGlobal
Loading…
Cancel
Save