Commit 91d39a03 authored by 刘志强's avatar 刘志强

项目初始化

parents
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
**/wwwroot/lib/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
pub/
#Ignore marker-file used to know which docker files we have.
.eshopdocker_*
\.vscode/
\ No newline at end of file
variables:
GIT_SUBMODULE_STRATEGY: normal
DOT_NET_BIN_PATH: "C:/Program Files/dotnet/dotnet.exe"
TARGET_REPO: "F:/CIV_CI/CivWebPublish_PandaEnergy/CivWebPublish2021/"
TEMP_DIR: "F:/CIV_CI/tempV1/PandaEnergy/"
before_script:
- chcp 65001
stages:
- buildWaterSaving
- buildHNSolution
- push
buildI:
stage: buildWaterSaving
script:
- echo "dotnet publish WaterSaving to target dir"
- '&${DOT_NET_BIN_PATH} publish .\src\WaterSaving\WaterSaving.Web\WaterSaving.Web.csproj -c Release -p:PublishProfile=FolderProfile -o ${TEMP_DIR}\WaterSaving\ '
cache:
untracked: true
only:
- dev-wisdom
buildII:
stage: buildHNSolution
script:
- echo "dotnet publish HNSolution to target dir"
- '&${DOT_NET_BIN_PATH} publish .\src\华中农业大学\HNSolution.Web\HNSolution.Web.csproj -c Release -p:PublishProfile=FolderProfile -o ${TEMP_DIR}\HNSolution\ '
cache:
untracked: true
only:
- dev-wisdom
push:
variables:
GIT_STRATEGY: none
stage: push
script:
- echo "packaging now"
- 'cd ${TARGET_REPO}'
- 'git reset --hard head'
- 'git clean -fd'
- 'git remote set-url origin "https://${GIT_ACCESS_USER}:${GIT_ACCESS_PASSWORD}@g.civnet.cn:8443/CivPublish/CivWebPublish2021.git"'
- 'git pull origin map'
- 'robocopy /E ../../tempV1/PandaEnergy/ "${TARGET_REPO}/PandaEnergy" ;
IF (${LASTEXITCODE} -le 8) {cmd /c "exit /b 0"}'
- 'git add . ; git commit -m "auto package PandaEnergy."'
- 'git push origin map'
allow_failure: false
only:
- dev-wisdom
when: manual
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32319.34
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "基础框架", "基础框架", "{48D9DA38-1AAE-4236-B230-5646DC2E25CF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "单元测试", "单元测试", "{059A7D94-3675-49F8-B955-8A2793D76093}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "通用产品", "通用产品", "{3AF616D9-8082-4D10-863A-9C92C5E48FAB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WaterSaving", "WaterSaving", "{4295529C-F10D-4AD8-8104-C0A02CFA4AC8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Panda.Template.ApplicationCore", "src\WaterSaving\Panda.Template.ApplicationCore\Panda.Template.ApplicationCore.csproj", "{56AD1726-4899-4AF3-B66D-154571D2C21F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Panda.Template.Infrastructure", "src\WaterSaving\Panda.Template.Infrastructure\Panda.Template.Infrastructure.csproj", "{121A55E0-DE8F-4D25-9A85-EDBDC8CC8D31}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Panda.Template.Web", "src\WaterSaving\Panda.Template.Web\Panda.Template.Web.csproj", "{437DE6F8-D480-42F5-ADAC-645A8E420DE8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{56AD1726-4899-4AF3-B66D-154571D2C21F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{56AD1726-4899-4AF3-B66D-154571D2C21F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{56AD1726-4899-4AF3-B66D-154571D2C21F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{56AD1726-4899-4AF3-B66D-154571D2C21F}.Release|Any CPU.Build.0 = Release|Any CPU
{121A55E0-DE8F-4D25-9A85-EDBDC8CC8D31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{121A55E0-DE8F-4D25-9A85-EDBDC8CC8D31}.Debug|Any CPU.Build.0 = Debug|Any CPU
{121A55E0-DE8F-4D25-9A85-EDBDC8CC8D31}.Release|Any CPU.ActiveCfg = Release|Any CPU
{121A55E0-DE8F-4D25-9A85-EDBDC8CC8D31}.Release|Any CPU.Build.0 = Release|Any CPU
{437DE6F8-D480-42F5-ADAC-645A8E420DE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{437DE6F8-D480-42F5-ADAC-645A8E420DE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{437DE6F8-D480-42F5-ADAC-645A8E420DE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{437DE6F8-D480-42F5-ADAC-645A8E420DE8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{4295529C-F10D-4AD8-8104-C0A02CFA4AC8} = {3AF616D9-8082-4D10-863A-9C92C5E48FAB}
{56AD1726-4899-4AF3-B66D-154571D2C21F} = {4295529C-F10D-4AD8-8104-C0A02CFA4AC8}
{121A55E0-DE8F-4D25-9A85-EDBDC8CC8D31} = {4295529C-F10D-4AD8-8104-C0A02CFA4AC8}
{437DE6F8-D480-42F5-ADAC-645A8E420DE8} = {4295529C-F10D-4AD8-8104-C0A02CFA4AC8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8AA59498-6809-46F5-A7F8-3B274A208C51}
EndGlobalSection
EndGlobal
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Folder Include="Entites\" />
<Folder Include="Interfaces\" />
<Folder Include="IRepository\" />
<Folder Include="Model\" />
<Folder Include="QueryParam\" />
<Folder Include="Services\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Panda.Business" Version="1.0.2" />
<PackageReference Include="Panda.Files" Version="1.0.1" />
<PackageReference Include="Panda.Log" Version="1.0.2" />
</ItemGroup>
</Project>
using Microsoft.EntityFrameworkCore;
using Panda.EF;
namespace Panda.Template.Infrastructure
{
public class BaseDBContext : DBContext
{
public BaseDBContext(DbContextOptions<BaseDBContext> options) : base(options)
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Folder Include="Repository\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Panda.Template.ApplicationCore\Panda.Template.ApplicationCore.csproj" />
</ItemGroup>
</Project>
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Panda.Web;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Panda.Template.Web
{
[SwaggerTag("测试接口")]
[APIGroup("Test")]
public class TestController : BaseApiController
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<TestController> _logger;
public TestController(ILogger<TestController> logger)
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>.\Web.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath></OutputPath>
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<DocumentationFile>.\Web.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Content Remove="C:\Users\Administrator\.nuget\packages\panda.web\1.0.2\contentFiles\any\netcoreapp3.1\Configs\Nlog.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Panda.Web" Version="1.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Panda.Template.Infrastructure\Panda.Template.Infrastructure.csproj" />
</ItemGroup>
</Project>
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace Panda.Template.Web
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:47948",
"sslPort": 44372
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"Panda.Template.Web": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger/index.html",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:8069"
}
}
}
\ No newline at end of file
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models;
using NLog;
using Panda.AutoDI;
using Panda.Common;
using Panda.ConfCenter;
using Panda.Template.Infrastructure;
using Panda.Web;
using Swashbuckle.AspNetCore.Annotations;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.Json;
namespace Panda.Template.Web //命名空间需修改
{
public class Startup
{
private readonly string Cosr = "AllowSpecificOrigins";
public IConfiguration Configuration { get; }
IWebHostEnvironment _environment;
public Startup(IConfiguration configuration, IWebHostEnvironment environment)
{
Configuration = configuration;
_environment = environment;
//初始化配置
MiddlewareCollection.Init(_environment.IsDevelopment(), "Panda.Template.Web");
}
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddCommonDI();
services.AutoDI();
services.AddDbContext<BaseDBContext>(opt => opt.UseSqlServer(ConfigHelper.WorkflowConnectionString));
services.AddControllers()
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new DatetimeJsonConverter());
//Json数据以驼峰命名显示
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
});
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("test", new OpenApiInfo { Title = "Panda.Template.Web API ", Version = "v1" });
c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "Web.xml"));
c.DocumentFilter<AnnotationsDocumentFilter>();
c.DocInclusionPredicate((docName, apiDesc) =>
{
return string.Equals(docName, apiDesc.GroupName, StringComparison.OrdinalIgnoreCase);
});
});
//允许跨域
//services.AddCores(Cosr);
//禁止限制文件大小
// services.AddFileLimit();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseSwagger();
app.UseSwaggerUI(c =>
{
if (env.IsDevelopment() || ConfigPath.IsLinux)
{
c.SwaggerEndpoint("/swagger/test/swagger.json", "Test");
}
else
{
//发布路径
c.SwaggerEndpoint("/PandaDemo/Demo/swagger/test/swagger.json", "Test");
}
});
app.UseRouting();
//与上面services.AddCores(Cosr);配合使用
// app.UseCors(Cosr);
//添加NLog
app.UseResponseCaching();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
app.UseStaticFiles(new StaticFileOptions
{
//设置不限制content-type
ServeUnknownFileTypes = true
});
app.UseCookiePolicy(new CookiePolicyOptions { MinimumSameSitePolicy = SameSiteMode.Lax });
}
}
}
\ No newline at end of file
using System;
namespace Panda.Template.Web
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string Summary { get; set; }
}
}
<?xml version="1.0"?>
<doc>
<assembly>
<name>Panda.Template.Web</name>
</assembly>
<members>
</members>
</doc>
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment