Coder Social home page Coder Social logo

dystudio / blog.core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anjoy8/blog.core

0.0 2.0 0.0 15.6 MB

ASP.NET Core 2.2 教程,前后端分离的后端接口,vue教程的姊妹篇

Home Page: http://123.206.33.109:8081

License: MIT License

C# 96.89% HTML 3.11%

blog.core's Introduction

ENGLISH | 中文版

Logo

从零开始搭建自己的前后端分离【 .NET Core2.1 Api + Vue 2.0 】框架,目前是2.2版本,各个版本见分支(注意其他分支不全,请使用主分支)。

如果你感觉看着这整个项目比较费劲,我单抽出来了几个子Demo,方便学习,项目地址 :https://github.com/anjoy8/BlogArti

这只是 .netCore 后端部分,前端部分请看我的另三个Vue工程项目

       

个人博客Vue版本 tBug项目Nuxt版本 VueAdmin管理后台(更新中)
https://github.com/anjoy8/Blog.Vue https://github.com/anjoy8/Nuxt.tBug https://github.com/anjoy8/Blog.Admin
http://123.206.33.109:8077 http://123.206.33.109:7090 http://123.206.33.109:2364

   

Nuget Packages

Package NuGet Stable Downloads
Blog.Core.Webapi.Template Blog.Core.Webapi.Template Blog.Core.Webapi.Template

关于如何使用,点击这里:https://www.cnblogs.com/laozhang-is-phi/p/10205495.html

   

其他后端框架

目前一共开源四个框架项目,感兴趣的可以看看

单层项目 简单仓储框架 仓储+服务+接口 DDD框架
CURD+Seed CURD+Seed+DI CURD+Seed+DI+AOP等 DDD+EFCore+DI+EventBus等
NetCore-Sugar-Demo Blog.SplRepository.Demo Blog.Core ChristDDD

   

给个星星! ⭐️

如果你喜欢这个项目或者它帮助你, 请给 Star~(辛苦星咯)


Tips:


1【重要】、Blog.Core.FrameWork 项目是用T4模板生成文件的简单实现。如果有错误,可以联系我,
QQ群:867095512
如果你不想处理这个错误,你可以先把项目卸载,不影响整体运行。


2【重要】、项目中,有三个AOP的操作类,分别是Redis缓存切面,memory缓存切面、Log日志切面
你可以在自定义开关,对其进行是否启用,在 appsettings.json 中的:

    "RedisCaching": {
      "Enabled": false,
      "ConnectionString": "127.0.0.1:6319"
    },
    "MemoryCachingAOP": {
      "Enabled": true
    },
    "LogoAOP": {
      "Enabled": false
    },


3【重要】、如何你使用Redis,需要安装Redis服务端,安装和使用说明地址:
https://www.cnblogs.com/laozhang-is-phi/p/9554210.html#autoid-3-4-0
端口是 6319 ,注意!


4【重要+】、系统新增自动化生成数据库,和生成种子数据的功能,
在Blog.Core层中的 appsettings.json 中开启 SeedDBEnabled:true 即可。
具体文章请看:《[支持多种数据库 & 快速数据库生成](https://www.cnblogs.com/laozhang-is-phi/p/10718755.html)》。


5、如果你不想用CodeFirst 和种子数据,可以用数据库表结构Sql文件在数据库里执行,
在Blog.Core 项目下的 wwwroot 文件夹中Blog.Core.Table.sql(表结构)、Blog.Core.Table&Data.sql(结构和数据)。
或者来群里,群文件的是最新的。


6、如果想单独查看关于【JWT授权】的相关内容,可以在wwwroot 文件夹中找到【Autho.jwt.rar】,我单拎出来的一个demo。


7、项目后期发布的时候可以有两个办法,一种是dotnet的kestrel部署,另一种是 IIS 发布部署,但是在发布的时候,
因为解耦了,所以会导致无法把 service.dll & repository.dll 拷贝到生成目录下,大家可以采用:
Blog.Core -> 属性 -> Build Events -> Post-build event command ->>>>

Copy "$(ProjectDir)bin\Debug\netcoreapp2.2\" "$(SolutionDir)Blog.Core\bin\Debug\"


修改数据库连接字符串

注意:修改完数据库连接字符串以后,一定要F6重新编译项目或者重启项目。

1、在Blog.Core层 appsettings.json 中,配置自己的字符串

    "SqlServer": {
      "SqlServerConnection": "Server=.;Database=WMBlogDB;User ID=sa;Password=123;",
      "ProviderName": "System.Data.SqlClient"
    },

2、文章中有三个地方用到了数据库连接字符串

A、系统中使用 Blog.Core.Repository -> BaseDBConfig.cs
B、Seed数据库 Blog.Core.Model -> MyContext.cs
C、T4 模板 Blog.Core.FrameWork -> DbHelper.ttinclude

其实针对AB两个情况,只需要配置 appsettings.json 即可

3、如果想使用T4模板,在Blog.Core.FrameWork层的DbHelper.ttinclude 中,配置自己的字符串

public static readonly string ConnectionString = File.Exists(@"D:\my-file\dbCountPsw2.txt") ? 
File.ReadAllText(@"D:\my-file\dbCountPsw2.txt").Trim(): "server=.;uid=sa;pwd=sa;database=BlogDB";

三大平台同步直播

简 书:https://www.jianshu.com/notebooks/28621653

博客园:https://www.cnblogs.com/laozhang-is-phi/

CSDN:https://blog.csdn.net/baidu_35726140

码云:https://gitee.com/laozhangIsPhi/Blog.Core

.NetCore与Vue 框架学习目录如下

**************************************************************

系统环境

windows 10、SQL server 2012、Visual Studio 2017、Windows Server 2008 R2

后端技术:

  * .Net Core 2.0 API(因为想单纯搭建前后端分离,因此就选用的API,如果想了解.Net Core MVC,也可以交流)
  
  * Swagger 前后端文档说明,基于RESTful风格编写接口

  * Repository + Service 仓储模式编程

  * Async和Await 异步编程

  * Cors 简单的跨域解决方案

  * AOP基于切面编程技术

  * Autofac 轻量级IoC和DI依赖注入

  * Vue 本地代理跨域方案,Nginx跨域代理

  * JWT权限验证



数据库技术

  * SqlSugar 轻量级ORM框架,CodeFirst

  * T4 模板生成

  * AutoMapper 自动对象映射



分布式缓存技术

  * Redis 轻量级分布式缓存



前端技术

  * Vue 2.0 框架全家桶 Vue2 + VueRouter2 + Webpack + Axios + vue-cli + vuex

  * ElementUI 基于Vue 2.0的组件库

  * Nuxt.js服务端渲染SSR

blog.core's People

Contributors

anjoy8 avatar liuzhenyulive avatar wmchuang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.