![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
.netcore
viplove
你若盛开,蝴蝶自来
展开
-
菜单表设计
/// <summary> /// 系统菜单 /// </summary> public class ManageMenu { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } /// <summary> /// 名字 ...原创 2021-01-27 17:19:23 · 783 阅读 · 0 评论 -
.netcore webapi 发布后静态图片地址访问不了
需要在Startup的Configure注册静态资源//发布时服务器注册静态资源 app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider("C:/webroot/dengfenglaicrmapitest/UploadFile"), RequestPath = "/UploadFi原创 2021-01-27 16:08:02 · 2403 阅读 · 0 评论 -
SaaS系统 .netcore webapi
1.什么是SaaSSaaS系统,软件即服务,租户系统,相对于传统软件,SaaS不需要租户购买服务器,不需要安装,也不需要花费大量的时间和成本去维护,只需要购买使用权,租用即可2.首先要有租户表 /// <summary> /// 租户 /// </summary> public class SysTenant { [Key] [DatabaseGenerated(DatabaseGeneratedOp原创 2021-01-27 15:36:36 · 699 阅读 · 1 评论 -
NPOI导出Excel .netcore webapi
1.建立好Excel导出数据要用到的模板 T.xlsx2.引入程序包3.将读取出来的数据List放到Excel中 public async Task<IActionResult> GetExcel(){ var dt = DateTime.Now; var rootPath = _webHostEnvironment.ContentRootPath + "原创 2021-01-26 16:33:36 · 216 阅读 · 0 评论 -
.netcore webapi 连接mysql数据库
1.在appsettings.json写好数据库连接语句 "DbContext": { "ConnectionString": "server=服务器; Database=数据库名; User Id=用户名; Password=密码;" }2.Startuppublic Startup(IConfiguration configuration) { Configuration = configuration; }原创 2021-01-26 16:03:16 · 777 阅读 · 0 评论 -
Swagger在 .netcore webapi中使用
1.首先引用需要的类库2.在Startup的ConfigureServices注入#region Swagger services.AddSwaggerGen(c => { c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); c.SwaggerDoc("v1", new Mi原创 2021-01-26 15:48:36 · 145 阅读 · 0 评论 -
.netcore webapi 跨域问题
需要在Startup的ConfigureServices添加跨域支持#region 跨域 services.AddCors(options => { options.AddPolicy(AllowSpecificOrigin, builder => { builder.AllowAny原创 2021-01-26 15:29:09 · 187 阅读 · 0 评论 -
AutoMapper .netcore webapi中使用
1.NuGet管理程序包添加automapper引用:2.Startup的ConfigureServices中注册服务//添加对AutoMapper的支持services.AddAutoMapper(cfg =>{ cfg.AddProfile<MapperConfig>(); });3.添加MapperConfig文件,写映射关系public class MapperConfig:Profile{ public MapperConfig() {原创 2021-01-26 15:00:24 · 196 阅读 · 0 评论