diff --git a/README.en.md b/README.en.md index 3c9e22b9373..bb8467ea0b2 100644 --- a/README.en.md +++ b/README.en.md @@ -87,7 +87,7 @@ - `Docker Hub` 线上镜像 ```shell -docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.34 +docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.50 ``` - `手动` 打包镜像 @@ -95,15 +95,22 @@ docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.34 打开 `CMD/Shell/PowerShell` 进入 `Fur` 项目根目录打包 `Fur` 镜像: ```shell -docker build -t fur:v1.0.0-rc.final.34 . +docker build -t fur:v1.0.0-rc.final.50 . ``` 打包成功后,直接 `docker run`: ```shell -docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.34 +docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.50 ``` +## 🥜 Fur 官方包 + +| 包类型 | 名称 | 版本 | 描述 | +| --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------ | -------------- | +| [![nuget](https://img.shields.io/badge/Nuget-1.0.0--rc.final-blue)](https://www.nuget.org/packages/Fur) | Fur | v1.0.0-rc.final.50 | Fur 总包 | +| [![nuget](https://img.shields.io/badge/Nuget-1.0.0--rc.final-blue)](https://www.nuget.org/packages/Fur.Extras.Authentication.JwtBearer) | Fur.Extras.Authentication.JwtBearer | v1.0.0-rc.final.50 | Fur Jwt 拓展包 | + ## 🍎 框架特点 - 全新面貌:基于 `.NET 5` 平台,没有历史包袱 diff --git a/README.md b/README.md index 3c9e22b9373..bb8467ea0b2 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ - `Docker Hub` 线上镜像 ```shell -docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.34 +docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.50 ``` - `手动` 打包镜像 @@ -95,15 +95,22 @@ docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.34 打开 `CMD/Shell/PowerShell` 进入 `Fur` 项目根目录打包 `Fur` 镜像: ```shell -docker build -t fur:v1.0.0-rc.final.34 . +docker build -t fur:v1.0.0-rc.final.50 . ``` 打包成功后,直接 `docker run`: ```shell -docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.34 +docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.50 ``` +## 🥜 Fur 官方包 + +| 包类型 | 名称 | 版本 | 描述 | +| --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------ | -------------- | +| [![nuget](https://img.shields.io/badge/Nuget-1.0.0--rc.final-blue)](https://www.nuget.org/packages/Fur) | Fur | v1.0.0-rc.final.50 | Fur 总包 | +| [![nuget](https://img.shields.io/badge/Nuget-1.0.0--rc.final-blue)](https://www.nuget.org/packages/Fur.Extras.Authentication.JwtBearer) | Fur.Extras.Authentication.JwtBearer | v1.0.0-rc.final.50 | Fur Jwt 拓展包 | + ## 🍎 框架特点 - 全新面貌:基于 `.NET 5` 平台,没有历史包袱 diff --git a/docs/3ab56fdf.3f7c37e8.js b/docs/3ab56fdf.3f7c37e8.js deleted file mode 100644 index 70e24986296..00000000000 --- a/docs/3ab56fdf.3f7c37e8.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[23],{142:function(e,t,a){"use strict";a.d(t,"a",(function(){return O})),a.d(t,"b",(function(){return j}));var r=a(0),n=a.n(r);function b(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function c(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function l(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},O=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},m=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),O=o(a),m=r,j=O["".concat(c,".").concat(m)]||O[m]||u[m]||b;return a?n.a.createElement(j,l(l({ref:t},p),{},{components:a})):n.a.createElement(j,l({ref:t},p))}));function j(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;pfunction(e,t,a,{forcePrependBaseUrl:r=!1,absolute:b=!1}={}){if(!a)return a;if(a.startsWith("#"))return a;if(Object(n.b)(a))return a;if(r)return t+a;const c=a.startsWith(t)?a:t+a.replace(/^\//,"");return b?e+c:c}(t,e,a,r)}}function c(e,t={}){const{withBaseUrl:a}=b();return a(e,t)}},145:function(e,t,a){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function n(e){return void 0!==e&&!r(e)}a.d(t,"b",(function(){return r})),a.d(t,"a",(function(){return n}))},78:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return l})),a.d(t,"metadata",(function(){return i})),a.d(t,"rightToc",(function(){return p})),a.d(t,"default",(function(){return O}));var r=a(2),n=a(6),b=(a(0),a(142)),c=a(144),l={slug:"welcome",title:"Fur \u4ecb\u7ecd",author:"dotnet\u4e2d\u56fd",author_title:"\u4e3a\u4e2d\u56fd .NET \u5f00\u53d1\u8005\u63d0\u4f9b\u4f18\u8d28\u7684\u8d44\u8baf\u548c\u6280\u672f\u5206\u4eab\u3002",author_url:"https://chinadot.net",author_image_url:"https://i.loli.net/2020/10/01/94AxjHp21aPKQWd.png",tags:["fur","furos",".net",".netcore",".net5"]},i={permalink:"/blog/welcome",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/blog/2020-08-19-welcome.mdx",source:"@site/blog\\2020-08-19-welcome.mdx",description:"=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},O=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},j=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),O=o(a),j=r,m=O["".concat(c,".").concat(j)]||O[j]||u[j]||b;return a?n.a.createElement(m,l(l({ref:t},p),{},{components:a})):n.a.createElement(m,l({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=j;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;pfunction(e,t,a,{forcePrependBaseUrl:r=!1,absolute:b=!1}={}){if(!a)return a;if(a.startsWith("#"))return a;if(Object(n.b)(a))return a;if(r)return t+a;const c=a.startsWith(t)?a:t+a.replace(/^\//,"");return b?e+c:c}(t,e,a,r)}}function c(e,t={}){const{withBaseUrl:a}=b();return a(e,t)}},145:function(e,t,a){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function n(e){return void 0!==e&&!r(e)}a.d(t,"b",(function(){return r})),a.d(t,"a",(function(){return n}))},78:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return l})),a.d(t,"metadata",(function(){return i})),a.d(t,"rightToc",(function(){return p})),a.d(t,"default",(function(){return O}));var r=a(2),n=a(6),b=(a(0),a(142)),c=a(144),l={slug:"welcome",title:"Fur \u4ecb\u7ecd",author:"dotnet\u4e2d\u56fd",author_title:"\u4e3a\u4e2d\u56fd .NET \u5f00\u53d1\u8005\u63d0\u4f9b\u4f18\u8d28\u7684\u8d44\u8baf\u548c\u6280\u672f\u5206\u4eab\u3002",author_url:"https://chinadot.net",author_image_url:"https://i.loli.net/2020/10/01/94AxjHp21aPKQWd.png",tags:["fur","furos",".net",".netcore",".net5"]},i={permalink:"/blog/welcome",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/blog/2020-08-19-welcome.mdx",source:"@site/blog\\2020-08-19-welcome.mdx",description:" Page Not Found | Fur - +

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/docs/4c30b939.61ef6eb4.js b/docs/4c30b939.61ef6eb4.js deleted file mode 100644 index 7d5f45026f5..00000000000 --- a/docs/4c30b939.61ef6eb4.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[28],{142:function(e,t,a){"use strict";a.d(t,"a",(function(){return O})),a.d(t,"b",(function(){return j}));var r=a(0),n=a.n(r);function b(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function c(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function l(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},O=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},m=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),O=o(a),m=r,j=O["".concat(c,".").concat(m)]||O[m]||u[m]||b;return a?n.a.createElement(j,l(l({ref:t},p),{},{components:a})):n.a.createElement(j,l({ref:t},p))}));function j(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;pfunction(e,t,a,{forcePrependBaseUrl:r=!1,absolute:b=!1}={}){if(!a)return a;if(a.startsWith("#"))return a;if(Object(n.b)(a))return a;if(r)return t+a;const c=a.startsWith(t)?a:t+a.replace(/^\//,"");return b?e+c:c}(t,e,a,r)}}function c(e,t={}){const{withBaseUrl:a}=b();return a(e,t)}},145:function(e,t,a){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function n(e){return void 0!==e&&!r(e)}a.d(t,"b",(function(){return r})),a.d(t,"a",(function(){return n}))},83:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return l})),a.d(t,"metadata",(function(){return i})),a.d(t,"rightToc",(function(){return p})),a.d(t,"default",(function(){return O}));var r=a(2),n=a(6),b=(a(0),a(142)),c=a(144),l={id:"introduce",title:"1.1 \u4ecb\u7ecd",sidebar_label:"1.1 \u4ecb\u7ecd",slug:"/"},i={unversionedId:"introduce",id:"introduce",isDocsHomePage:!1,title:"1.1 \u4ecb\u7ecd",description:"=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},O=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},j=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),O=o(a),j=r,m=O["".concat(c,".").concat(j)]||O[j]||u[j]||b;return a?n.a.createElement(m,l(l({ref:t},p),{},{components:a})):n.a.createElement(m,l({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=j;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;pfunction(e,t,a,{forcePrependBaseUrl:r=!1,absolute:b=!1}={}){if(!a)return a;if(a.startsWith("#"))return a;if(Object(n.b)(a))return a;if(r)return t+a;const c=a.startsWith(t)?a:t+a.replace(/^\//,"");return b?e+c:c}(t,e,a,r)}}function c(e,t={}){const{withBaseUrl:a}=b();return a(e,t)}},145:function(e,t,a){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function n(e){return void 0!==e&&!r(e)}a.d(t,"b",(function(){return r})),a.d(t,"a",(function(){return n}))},83:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return l})),a.d(t,"metadata",(function(){return i})),a.d(t,"rightToc",(function(){return p})),a.d(t,"default",(function(){return O}));var r=a(2),n=a(6),b=(a(0),a(142)),c=a(144),l={id:"introduce",title:"1.1 \u4ecb\u7ecd",sidebar_label:"1.1 \u4ecb\u7ecd",slug:"/"},i={unversionedId:"introduce",id:"introduce",isDocsHomePage:!1,title:"1.1 \u4ecb\u7ecd",description:" Blog | Fur - + @@ -18,14 +18,14 @@ - +

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/docs/blog/tags/fur/index.html b/docs/blog/tags/fur/index.html index 8c8087c00b1..97035a6b5d0 100644 --- a/docs/blog/tags/fur/index.html +++ b/docs/blog/tags/fur/index.html @@ -6,7 +6,7 @@ Posts tagged "fur" | Fur - + @@ -18,14 +18,14 @@ - +

1 post tagged with "fur"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/docs/blog/tags/furos/index.html b/docs/blog/tags/furos/index.html index 45408a1ff7f..0cec371be40 100644 --- a/docs/blog/tags/furos/index.html +++ b/docs/blog/tags/furos/index.html @@ -6,7 +6,7 @@ Posts tagged "furos" | Fur - + @@ -18,14 +18,14 @@ - +

1 post tagged with "furos"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/docs/blog/tags/index.html b/docs/blog/tags/index.html index 2fafe8164e1..3a312fa7d84 100644 --- a/docs/blog/tags/index.html +++ b/docs/blog/tags/index.html @@ -6,7 +6,7 @@ Tags | Fur - + @@ -23,7 +23,7 @@ - + diff --git a/docs/blog/tags/net-5/index.html b/docs/blog/tags/net-5/index.html index 2eb47b675c6..0a21eaa1e94 100644 --- a/docs/blog/tags/net-5/index.html +++ b/docs/blog/tags/net-5/index.html @@ -6,7 +6,7 @@ Posts tagged ".net5" | Fur - + @@ -18,14 +18,14 @@ - +

1 post tagged with ".net5"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/docs/blog/tags/net/index.html b/docs/blog/tags/net/index.html index fc07d32e470..15c4723261e 100644 --- a/docs/blog/tags/net/index.html +++ b/docs/blog/tags/net/index.html @@ -6,7 +6,7 @@ Posts tagged ".net" | Fur - + @@ -18,14 +18,14 @@ - +

1 post tagged with ".net"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/docs/blog/tags/netcore/index.html b/docs/blog/tags/netcore/index.html index 9aa1f01ac20..1168acbab82 100644 --- a/docs/blog/tags/netcore/index.html +++ b/docs/blog/tags/netcore/index.html @@ -6,7 +6,7 @@ Posts tagged ".netcore" | Fur - + @@ -18,14 +18,14 @@ - +

1 post tagged with ".netcore"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/docs/blog/welcome/index.html b/docs/blog/welcome/index.html index b1f0b15784b..74f7fe704e4 100644 --- a/docs/blog/welcome/index.html +++ b/docs/blog/welcome/index.html @@ -6,7 +6,7 @@ Fur 介绍 | Fur - + @@ -18,13 +18,13 @@ - +
-

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.34
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-rc.final.34 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.34

🍎 框架特点

  • 全新面貌:基于 .NET 5 平台,没有历史包袱
  • 极易入门:只需要一个 Inject() 即可完成配置
  • 极速开发:内置丰富的企业应用开发功能
  • 极少依赖:框架只依赖三个第三方包
  • 极其灵活:轻松面对多变复杂的需求
  • 极易维护:采用独特的架构思想,只为长久维护设计
  • 完整文档:提供完善的开发文档

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司
  • 上海奥达科股份有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...
😤 好人!10Nice 的小僧,我们的 dotnetchina 马上火起来了
😮 木木 Woody10感谢您的开源项目!
😚 Joker HouQQ 超级会员一个月
🤠 ccdfzQQ 专属红包 199
🌝 天夫李总支付宝 6666Fur 非常有意思,持续关注
😝 六尘子微信红包 199公司已经使用,小小敬意

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor 👉 IoTSharp

+

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.50
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-rc.final.50 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.50

🥜 Fur 官方包

包类型名称版本描述
nugetFurv1.0.0-rc.final.50Fur 总包
nugetFur.Extras.Authentication.JwtBearerv1.0.0-rc.final.50Fur Jwt 拓展包

🍎 框架特点

  • 全新面貌:基于 .NET 5 平台,没有历史包袱
  • 极易入门:只需要一个 Inject() 即可完成配置
  • 极速开发:内置丰富的企业应用开发功能
  • 极少依赖:框架只依赖三个第三方包
  • 极其灵活:轻松面对多变复杂的需求
  • 极易维护:采用独特的架构思想,只为长久维护设计
  • 完整文档:提供完善的开发文档

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司
  • 上海奥达科股份有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...
😤 好人!10Nice 的小僧,我们的 dotnetchina 马上火起来了
😮 木木 Woody10感谢您的开源项目!
😚 Joker HouQQ 超级会员一个月
🤠 ccdfzQQ 专属红包 199
🌝 天夫李总支付宝 6666Fur 非常有意思,持续关注
😝 六尘子微信红包 199公司已经使用,小小敬意

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor 👉 IoTSharp

- + @@ -36,6 +36,6 @@ - + \ No newline at end of file diff --git a/docs/d3c206bc.13e091fa.js b/docs/d3c206bc.13e091fa.js deleted file mode 100644 index b54ad98a5e9..00000000000 --- a/docs/d3c206bc.13e091fa.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[63],{117:function(e,t,r){"use strict";r.r(t),r.d(t,"frontMatter",(function(){return b})),r.d(t,"metadata",(function(){return i})),r.d(t,"rightToc",(function(){return l})),r.d(t,"default",(function(){return p}));var n=r(2),a=r(6),o=(r(0),r(142)),c=r(144),b={slug:"welcome",title:"Fur \u4ecb\u7ecd",author:"dotnet\u4e2d\u56fd",author_title:"\u4e3a\u4e2d\u56fd .NET \u5f00\u53d1\u8005\u63d0\u4f9b\u4f18\u8d28\u7684\u8d44\u8baf\u548c\u6280\u672f\u5206\u4eab\u3002",author_url:"https://chinadot.net",author_image_url:"https://i.loli.net/2020/10/01/94AxjHp21aPKQWd.png",tags:["fur","furos",".net",".netcore",".net5"]},i={permalink:"/blog/welcome",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/blog/2020-08-19-welcome.mdx",source:"@site/blog\\2020-08-19-welcome.mdx",description:"=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=a.a.createContext({}),u=function(e){var t=a.a.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):b(b({},t),e)),r},p=function(e){var t=u(e.components);return a.a.createElement(l.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},m=a.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),p=u(r),m=n,O=p["".concat(c,".").concat(m)]||p[m]||s[m]||o;return r?a.a.createElement(O,b(b({ref:t},l),{},{components:r})):a.a.createElement(O,b({ref:t},l))}));function O(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,c=new Array(o);c[0]=m;var b={};for(var i in t)hasOwnProperty.call(t,i)&&(b[i]=t[i]);b.originalType=e,b.mdxType="string"==typeof e?e:n,c[1]=b;for(var l=2;lfunction(e,t,r,{forcePrependBaseUrl:n=!1,absolute:o=!1}={}){if(!r)return r;if(r.startsWith("#"))return r;if(Object(a.b)(r))return r;if(n)return t+r;const c=r.startsWith(t)?r:t+r.replace(/^\//,"");return o?e+c:c}(t,e,r,n)}}function c(e,t={}){const{withBaseUrl:r}=o();return r(e,t)}},145:function(e,t,r){"use strict";function n(e){return!0===/^(\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!n(e)}r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return a}))}}]); \ No newline at end of file diff --git a/docs/d3c206bc.5509bc90.js b/docs/d3c206bc.5509bc90.js new file mode 100644 index 00000000000..ecf1c8fe7f0 --- /dev/null +++ b/docs/d3c206bc.5509bc90.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[63],{117:function(e,t,r){"use strict";r.r(t),r.d(t,"frontMatter",(function(){return b})),r.d(t,"metadata",(function(){return i})),r.d(t,"rightToc",(function(){return l})),r.d(t,"default",(function(){return p}));var n=r(2),a=r(6),o=(r(0),r(142)),c=r(144),b={slug:"welcome",title:"Fur \u4ecb\u7ecd",author:"dotnet\u4e2d\u56fd",author_title:"\u4e3a\u4e2d\u56fd .NET \u5f00\u53d1\u8005\u63d0\u4f9b\u4f18\u8d28\u7684\u8d44\u8baf\u548c\u6280\u672f\u5206\u4eab\u3002",author_url:"https://chinadot.net",author_image_url:"https://i.loli.net/2020/10/01/94AxjHp21aPKQWd.png",tags:["fur","furos",".net",".netcore",".net5"]},i={permalink:"/blog/welcome",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/blog/2020-08-19-welcome.mdx",source:"@site/blog\\2020-08-19-welcome.mdx",description:"=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var l=a.a.createContext({}),u=function(e){var t=a.a.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):b(b({},t),e)),r},p=function(e){var t=u(e.components);return a.a.createElement(l.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},m=a.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),p=u(r),m=n,O=p["".concat(c,".").concat(m)]||p[m]||s[m]||o;return r?a.a.createElement(O,b(b({ref:t},l),{},{components:r})):a.a.createElement(O,b({ref:t},l))}));function O(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,c=new Array(o);c[0]=m;var b={};for(var i in t)hasOwnProperty.call(t,i)&&(b[i]=t[i]);b.originalType=e,b.mdxType="string"==typeof e?e:n,c[1]=b;for(var l=2;lfunction(e,t,r,{forcePrependBaseUrl:n=!1,absolute:o=!1}={}){if(!r)return r;if(r.startsWith("#"))return r;if(Object(a.b)(r))return r;if(n)return t+r;const c=r.startsWith(t)?r:t+r.replace(/^\//,"");return o?e+c:c}(t,e,r,n)}}function c(e,t={}){const{withBaseUrl:r}=o();return r(e,t)}},145:function(e,t,r){"use strict";function n(e){return!0===/^(\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!n(e)}r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return a}))}}]); \ No newline at end of file diff --git a/docs/docs/answer/index.html b/docs/docs/answer/index.html index c4cc4dea7a1..3f11dd295cc 100644 --- a/docs/docs/answer/index.html +++ b/docs/docs/answer/index.html @@ -6,7 +6,7 @@ 29.1 常见问题 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/appstartup/index.html b/docs/docs/appstartup/index.html index b14ebf92fa0..75e81d843a5 100644 --- a/docs/docs/appstartup/index.html +++ b/docs/docs/appstartup/index.html @@ -6,7 +6,7 @@ 3. 应用启动 | Fur - + @@ -53,7 +53,7 @@
namespace Fur.Web.Entry
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
}
}
}
Startup.cs 代码迁移

只需要将 ConfigureServicesConfigure 方法代码迁移到 FurWebCoreStartup.cs 中即可,而 Startup.cs 中两个方法留空即可。

非常简单吧。我们后续创建任何 MVCRazorPagesBlazor 项目只需要添加 Fur.Web.Core 引用和调用 Inject() 即可。

3.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/auth-control/index.html b/docs/docs/auth-control/index.html index ef36d1db3f0..e90b4df1974 100644 --- a/docs/docs/auth-control/index.html +++ b/docs/docs/auth-control/index.html @@ -6,7 +6,7 @@ 14. 安全鉴权 | Fur - + @@ -27,7 +27,7 @@

14. 安全鉴权

14.1 什么是鉴权

鉴权实际上就是一种身份认证

由用户提供凭据,然后将其与存储在操作系统、数据库、应用或资源中的凭据进行比较。 在授权过程中,如果凭据匹配,则用户身份验证成功,可执行已向其授权的操作。 授权指判断允许用户执行的操作的过程。 也可以将身份验证理解为进入空间(例如服务器、数据库、应用或资源)的一种方式,而授权是用户可以对该空间(服务器、数据库或应用)内的哪些对象执行哪些操作。

14.1.1 常见的鉴权方式

  • HTTP Basic Authentication

这是 HTTP 协议实现的基本认证方式,我们在浏览网页时,从浏览器正上方弹出的对话框要求我们输入账号密码,正是使用了这种认证方式

  • Session + Cookie

利用服务器端的 session(会话)和浏览器端的 cookie 来实现前后端的认证,由于 http 请求时是无状态的,服务器正常情况下是不知道当前请求之前有没有来过,这个时候我们如果要记录状态,就需要在服务器端创建一个会话(seesion),将同一个客户端的请求都维护在各自得会会话中,每当请求到达服务器端的时候,先去查一下该客户端有没有在服务器端创建 seesion,如果有则已经认证成功了,否则就没有认证。

  • Token

客户端在首次登陆以后,服务端再次接收 HTTP 请求的时候,就只认 Token 了,请求只要每次把 Token 带上就行了,服务器端会拦截所有的请求,然后校验 Token 的合法性,合法就放行,不合法就返回 401(鉴权失败)

Token验证比较灵活,适用于大部分场景。常用的 Token 鉴权方式的解决方案是 JWTJWT 是通过对带有相关用户信息的进行加密,加密的方式比较灵活,可以根据需求具体设计。

  • OAuth

OAuth(开放授权)是一个开放标准,允许用户授权第三方网站访问他们存储在另外的服务提供者上的信息,而不需要将用户名和密码提供给第三方网站或分享他们数据的所有内容,为了保护用户数据的安全和隐私,第三方网站访问用户数据前都需要显式的向用户征求授权。我们常见的提供 OAuth 认证服务的厂商有支付宝,QQ,微信。

OAuth 协议又有 1.0 和 2.0 两个版本。相比较 1.0 版,2.0 版整个授权验证流程更简单更安全,也是目前最主要的用户身份验证和授权方式。

14.2 如何使用

- + diff --git a/docs/docs/author/index.html b/docs/docs/author/index.html index 7dfb0d24ffb..c112b743476 100644 --- a/docs/docs/author/index.html +++ b/docs/docs/author/index.html @@ -6,7 +6,7 @@ 1.2 关于作者 | Fur - + @@ -26,7 +26,7 @@

1.2 关于作者

互联网账号

  • 百小僧
  • Monk/MonkSoul

技术能力

自 2008 年 接触 IT 这个行业也有十余年了,在 后端(.NET/.NET Core/Java/PHP)、移动端(Xamarin/小程序/Java/Objective-C)、桌面端(WinForm/WPF/Electron)、前端(React/Vue/Angular/Node)等主流领域略知一二。

同时在技术培训领域也多有涉足。

职业情况

目前经营一家自己创办的软件科技公司,主要销售自主研发的 ERP 产品。

吃不起饭的时候也会接外包项目。

兴趣爱好

是个吃货,喜欢看抖音,看动漫,看美剧,看博客园、看开源中国。

对新技术颇感兴趣,喜欢开源事业,喜欢分享技术。

个人主页

https://gitee.com/monksoul

https://github.com/monksoul

- + diff --git a/docs/docs/cache/index.html b/docs/docs/cache/index.html index ab045d68755..44750f2acf0 100644 --- a/docs/docs/cache/index.html +++ b/docs/docs/cache/index.html @@ -6,7 +6,7 @@ 13. 分布式缓存 | Fur - + @@ -46,7 +46,7 @@
await _cache.SetAsync("cachedTimeUTC", encodedCurrentTimeUTC, options);
return RedirectToPage();
}
}

13.6 分布式缓存建议

确定 IDistributedCache 最适合你的应用的实现时,请考虑以下事项:

  • 现有基础结构
  • 性能要求
  • 成本
  • 团队经验

缓存解决方案通常依赖于内存中的存储以快速检索缓存的数据,但是,内存是有限的资源,并且很昂贵。 仅将常用数据存储在缓存中。

通常,Redis 缓存提供比 SQL Server 缓存更高的吞吐量和更低的延迟。 但是,通常需要进行基准测试来确定缓存策略的性能特征。

SQL Server 用作分布式缓存后备存储时,对缓存使用同一数据库,并且应用的普通数据存储和检索会对这两种情况的性能产生负面影响。 建议使用分布式缓存后备存储的专用 SQL Server 实例。

13.7 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 分布式缓存 知识可查阅 ASP.NET Core - 分布式缓存 章节。

- + diff --git a/docs/docs/configuration/index.html b/docs/docs/configuration/index.html index 129c6bb36f0..338548beeaa 100644 --- a/docs/docs/configuration/index.html +++ b/docs/docs/configuration/index.html @@ -6,7 +6,7 @@ 4.1 配置 | Fur - + @@ -27,7 +27,7 @@

4.1 配置

温馨提示

推荐使用 《4.2 选项》代替本章节功能。(为什么)?

4.1.1 什么是配置

简单来说,配置将系统应用可动态调配的选项放在统一地方管理,通过不同的配置让系统做出动态调整。

ASP.NET Core 应用程序启动时默认加载 启动项目 下的 appsettings.json 作为应用配置。同时还支持不同的运行环境加载对应的配置文件,如:

  • Development:加载 appsettings.Development.json
  • Staging:加载 appsettings.Staging.json
  • {Environment}appsettings.{Environment}.json

4.1.2 配置的使用

假设我们需要在系统运行时获取系统名称、版本号及版权信息,这些信息可能随时变化而且需要在多个地方使用。这时就需要将这些信息配置起来。具体步骤如下:

4.1.2.1 配置 appsettings.json 信息

{
"AppInfo": {
"Name": "Fur",
"Version": "1.0.0",
"Company": "Baiqian"
}
}
特别注意

appsettings.json 复制输出目录为如果较新则复制,生成操作为:内容

4.1.2.2 读取 appsettings.json 信息

Fur 框架中,提供了两种读取方式:

  • 依赖注入 IConfiguration 对象读取
  • 通过 App.Configuration[jsonKey] 读取
using Microsoft.AspNetCore.Mvc;
namespace Fur.Web.Entry.Controllers
{
[Route("api/[controller]")]
public class DefaultController : ControllerBase
{
[HttpGet]
public string Get()
{
return $@"名称:{App.Configuration["AppInfo:Name"]},
版本:{App.Configuration["AppInfo:Version"]},
公司:{App.Configuration["AppInfo:Company"]}";
}
}
}
依赖注入的方式

通过依赖注入注入实例有几种方式:

  • 构造函数注入方式
private readonly IConfiguration _configuration;
public DefaultController(IConfiguration configuration)
{
_configuration = configuration;
}
  • 参数注入方式 [FromServices]
public string Get([FromServices] IConfiguration configuration)
{
}
  • 属性注入方式
public IConfiguration Configuration { get; set; }

想了解更多关于《ASP.NET Core - 依赖注入》 知识

4.1.2.3 如何选择读取方式

  • 在可依赖注入类中,依赖注入 IConfiguration 读取
  • 在静态类/非依赖注入类中,选择 App.Configuration[jsonKey] 读取

4.1.3 路径符 查找节点

ASP.NET Core 中,配置采用 : 分隔符来读取分层配置数据。如上述例子中的 AppInfo:Name。如有更多层级数据则只需要通过 : 进入下一层节点即可。

假设我们有以下配置信息:

{
"AppInfo": {
"Name": "Fur",
"Version": "1.0.0",
"Company": {
"Name": "Baiqian",
"Address": {
"City": "中国",
"Province": "广东省",
"Detail": "中山市东区紫马公园西门"
}
}
}
}
var companyName = App.Configuration["AppInfo:Name"]; // => Fur

4.1.4 自定义配置文件

大多情况下,我们的配置只需要在 appsettings.json 中配置即可,但一些特殊情况下,我们希望某些组件或功能拥有独立的配置,这个时候就需要用到自定义配置,Fur 目前支持 .json.xml 两种方式配置,如:

Fur.Web.Entry/emailsetting.json
{
"outlook": {
"smtp": {
"server": "smtp.office365.com",
"port": "587",
"ssl": "STARTTLS"
},
"pop": {
"server": "outlook.office365.com",
"port": "995",
"ssl": "TLS"
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<MyKey>MyXMLFile Value</MyKey>
<Position>
<Title>Title from MyXMLFile</Title>
<Name>Name from MyXMLFile</Name>
</Position>
<Logging>
<LogLevel>
<Default>Information</Default>
<Microsoft>Warning</Microsoft>
</LogLevel>
</Logging>
</configuration>
xml 配置事项

如果采用 xml 配置,那么文件名必须以 .config.xml 结尾(不区分大小写)。

同时 Fur 提供了非常灵活的方式支持自定义配置文件读取,如:

4.1.4.1 读取 emailsetting.json 配置

读取自定义配置文件和读取 appsettings.json 一致,系统会自动从多个配置文件中读取输入,如:

var smtpServer = App.Configuration["outlook:smtp:server"]; // => smtp.office365.com
特别说明

Fur 框架会在启动时自动扫描每一个项目层根目录下的 *.json*.xml 文件加入配置中,所以无需手工配置。新增*.json*.xml 文件的属性复制到输出目录设置为始终复制,否则会扫描不到。

另外在 类库 项目中,不能起名和 启动项目 一样的配置文件名,不然会相互覆盖。

4.1.5 不同环境读取

在实际应用开发中,我们可能会根据不同的环境加载不同的配置文件,如 数据库连接字符串

这时我们只需要遵循特定命名规范 {name}.{Environment}.json 即可。如:

  • appsettings.Development.json
  • appsettings.Staging.json
  • appsettings.Production.json
  • emailsetting.Development.json
  • emailsetting.Staging.json
  • emailsetting.Production.json

这时,ASP.NET Core 会在应用启动时自动加载不同环境的配置文件。

4.1.6 配置更改通知(热更新

.NET Core 应用程序中,配置支持更改通知,也就是热更新操作。一旦监听到 appsetting.json 或自定义配置文件发生变动,就会触发 OnChange 方法。代码如下:

var appInfoConfiguration = App.Configuration["AppInfo"];
ChangeToken.OnChange(() => appInfoConfiguration.GetReloadToken(), () =>
{
var name = appInfoConfiguration["Name"]; // 实时的最新值
var version = appInfoConfiguration["Version"]; // 实时的最新值
});

4.1.7 配置的优缺点

  • 优点

    • 能够在系统运行时快速读取
    • 无需额外配置
  • 缺点

    • 存在重复读取
    • 通过硬编码字符串读取,容易出错
    • 不能设置默认值
    • 不能在运行环境中动态配置
    • 不能验证配置有效性
    • 不支持更改通知

4.1.8 配置使用场景

如果只需要一次性读取配置信息,则使用配置,否则应该使用 《4.2 选项》代替。

4.1.9 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 配置 知识可查阅 ASP.NET Core - 配置 章节。

- + diff --git a/docs/docs/contribute/index.html b/docs/docs/contribute/index.html index a4445660fe1..ce4fc76375b 100644 --- a/docs/docs/contribute/index.html +++ b/docs/docs/contribute/index.html @@ -6,7 +6,7 @@ 28. 贡献指南 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/cors/index.html b/docs/docs/cors/index.html index 13f1f527a63..e2567c3efef 100644 --- a/docs/docs/cors/index.html +++ b/docs/docs/cors/index.html @@ -6,7 +6,7 @@ 15. CORS 跨域 | Fur - + @@ -31,7 +31,7 @@
app.UseCorsAccessor();
// ...
}
}
}
特别注意

services.AddCorsAccessor(); 需在 services.AddControllers() 之前注册。

app.UseCorsAccessor(); 需在 app.UseRouting();app.UseAuthentication(); 之间注册。

15.4.2 配置允许跨域域名

注册 CorsAccessor 服务之后需要配置运行跨域的域名或请求方式,如:

{
"CorsAccessorSettings": {
"PolicyName": "自定义跨域策略名",
"WithOrigins": ["http://localhost:4200", "https://chinadot.net"]
}
}

15.5 CorsAccessorSettings 配置

  • CorsAccessorSettings
    • PolicyName:跨域策略名,字符串类型,必填,默认 FurCorsAccessor
    • WithOrigins:允许跨域的域名列表,字符串数组类型,默认 [ "http://localhost:4200" ]
    • WithHeaders:请求表头,没有配置则允许所有表头,字符串数组类型
    • WithExposedHeaders:响应标头,字符串数组类型
    • WithMethods:设置跨域允许请求谓词,没有配置则允许所有,字符串数组类型
    • AllowCredentials:跨域请求中的凭据,bool 类型
    • SetPreflightMaxAge:设置预检过期时间,int 类型

15.6 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 跨域请求 知识可查阅 ASP.NET Core - 启用跨域请求 章节。

- + diff --git a/docs/docs/data-validation/index.html b/docs/docs/data-validation/index.html index 1021184383c..5bb6b78f1da 100644 --- a/docs/docs/data-validation/index.html +++ b/docs/docs/data-validation/index.html @@ -6,7 +6,7 @@ 8. 数据校验 | Fur - + @@ -74,7 +74,7 @@
namespace Fur.Application
{
public class FurAppService : IDynamicApiController
{
[TypeFilter(typeof(DataValidationFilter))]
public TestDto Post(TestDto testDto)
{
return testDto;
}
}
}

8.9.4 [ApiController] 控制器范围验证

[ApiController]Mvc 提供的控制器范围(含所有动作方法)的验证。

using Microsoft.AspNetCore.Mvc;
namespace Fur.Web.Entry.Controllers
{
[ApiController]
public class MvcController : Controller
{
public IActionResult Index()
{
return View();
}
}
}

8.10 MiniProfiler 查看

如下图所示:

8.10 多语言支持

文档整理中...

8.11 验证模型提供器

文档整理中...

8.12 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-Interceptor/index.html b/docs/docs/dbcontext-Interceptor/index.html index b2cb82cb268..dfa5f38544b 100644 --- a/docs/docs/dbcontext-Interceptor/index.html +++ b/docs/docs/dbcontext-Interceptor/index.html @@ -6,7 +6,7 @@ 9.24 数据库操作拦截器 | Fur - + @@ -59,7 +59,7 @@
// 提交数据库失败
public override void SaveChangesFailed(DbContextErrorEventData eventData)
{
base.SaveChangesFailed(eventData);
}
// 提交数据库失败(异步)
public override Task SaveChangesFailedAsync(DbContextErrorEventData eventData, CancellationToken cancellationToken = default)
{
return base.SaveChangesFailedAsync(eventData, cancellationToken);
}
}
}

9.24.2.4 SavedChangesEvent 拦截

Fur 框架中为所有 AppDbContext 子类都提供了三个可重写的方法,这三个方法分别由三个事件触发:

  • 提交更改之前 SavingChanges 事件:触发 void SavingChangesEvent(object sender, SavingChangesEventArgs e) 方法
  • 提交更改之后 SavedChanges 事件:触发 void SavedChangesEvent(object sender, SavedChangesEventArgs e) 方法
  • 提交更改失败 SaveChangesFailed 事件:触发 void SaveChangesFailedEvent(object sender, SaveChangesFailedEventArgs e) 方法

通过这三个事件我们可以在数据库做增、删、改时候做拦截,比如设置创建时间、更新时间或其他默认操作

如自动添加租户Id:

protected override void SavingChangesEvent(object sender, SavingChangesEventArgs e)
{
// 获取当前事件对应上下文
var dbContext = sender as FurDbContext;
// 获取所有新增和更新的实体
var entities = dbContext.ChangeTracker.Entries()
.Where(u => u.State == EntityState.Added || u.State == EntityState.Modified);
foreach (var entity in entities)
{
switch (entity.State)
{
// 自动设置租户Id
case EntityState.Added:
entity.Property(nameof(Entity.TenantId)).CurrentValue = GetTenantId();
break;
// 排除租户Id
case EntityState.Modified:
entity.Property(nameof(Entity.TenantId)).IsModified = false;
break;
}
}
}

9.24.3 注册自定义过滤器

定义好过滤器之后,我们需要在数据库上下文中注册:

services.AddSqlitePool<FurDbContext>(interceptors: new IInterceptor[] {
new SqlConnectionProfilerInterceptor(),
new DbContextSaveChangesInterceptor(),
new SqlCommandProfilerInterceptor()
});

9.24.4 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-add-or-update/index.html b/docs/docs/dbcontext-add-or-update/index.html index dbbe87e4639..157640d67c0 100644 --- a/docs/docs/dbcontext-add-or-update/index.html +++ b/docs/docs/dbcontext-add-or-update/index.html @@ -6,7 +6,7 @@ 9.7 新增或更新操作 | Fur - + @@ -104,7 +104,7 @@
// 示例七
await user.InsertOrUpdateExcludeNowAsync(new[] { u=>u.Name, u=>u.Age});
// 示例八
await user.InsertOrUpdateExcludeNowAsync(new[] {"Age", "Name"});

9.5.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-add/index.html b/docs/docs/dbcontext-add/index.html index edecd483c94..4900a15276b 100644 --- a/docs/docs/dbcontext-add/index.html +++ b/docs/docs/dbcontext-add/index.html @@ -6,7 +6,7 @@ 9.5 新增操作 | Fur - + @@ -55,7 +55,7 @@
// 示例二
await repository.InsertNowAsync(new List<User> { user, user2 });
// 示例三
await repository.InsertNowAsync(new[] {user, user2 });
小知识

所有带 Now 结尾的表示立即提交到数据库,也就是立即调用 SaveChangesSaveChangesAsync

9.5.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-audit/index.html b/docs/docs/dbcontext-audit/index.html index 809298bc741..cde0faa7beb 100644 --- a/docs/docs/dbcontext-audit/index.html +++ b/docs/docs/dbcontext-audit/index.html @@ -6,7 +6,7 @@ 9.22 审计日志 | Fur - + @@ -39,7 +39,7 @@
object oldValue = null;
// 如果是新增数据,则 databaseValues 为空,所以需要判断一下
if (databaseValues != null)
{
oldValue = databaseValues[propName];
}
// 插入审计日志表
dbContext.Audits.Add(new Audit
{
Table = entityType.Name, // 表名
Column = propName, // 更新的列
NewValue = newValue, // 新值
OldValue = oldValue, // 旧值
CreatedTime = DateTime.Now, // 操作时间
UserId = userId, // 操作人
Operate = entity.State.ToString(); // 操作方式:新增、更新、删除
});
}
}
}
}
}
小知识

如果对性能有所要求,那么建议审计日志通过 日志组件 写入数据库,如,通过 Nlog、Log4Net 这些等:

// 插入审计日志表
dbContext.Audits.Add(new Audit
{
Table = entityType.Name, // 表名
Column = propName, // 更新的列
newValue = newValue, // 新值
OldValue = oldValue, // 旧值
CreatedTime = DateTime.Now, // 操作时间
UserId = userId, // 操作人
Operate = entity.State.ToString(); // 操作方式:新增、更新、删除
});

替换为:

logger.Information(JsonConvert.SerializeObject(new Audit
{
Table = entityType.Name, // 表名
Column = propName, // 更新的列
newValue = newValue, // 新值
OldValue = oldValue, // 旧值
CreatedTime = DateTime.Now, // 操作时间
UserId = userId, // 操作人
Operate = entity.State.ToString(); // 操作方式:新增、更新、删除
}));

通过上面的例子,我们就可以对数据库所有的新增、更新、删除进行监控了。

9.22.4 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-batch/index.html b/docs/docs/dbcontext-batch/index.html index 1a41a05ca8e..e89150f8d0f 100644 --- a/docs/docs/dbcontext-batch/index.html +++ b/docs/docs/dbcontext-batch/index.html @@ -6,7 +6,7 @@ 9.9 批量操作 | Fur - + @@ -34,7 +34,7 @@
// 根据条件批量更新
repository.Where(a => a.ItemId <= 500).BatchUpdate(a => new Item { Quantity = a.Quantity + 100 });
repository.Where(a => a.ItemId <= 500).BatchUpdate(new Item { Description = "Updated" });
await repository.Where(a => a.ItemId <= 500).BatchUpdateAsync(new Item { Description = "Updated" });
// 批量更新指定列
var updateColumns = new List<string> { nameof(Item.Quantity) };
var q = repository.Where(a => a.ItemId <= 500);
int affected = q.BatchUpdate(new Item { Description = "Updated" }, updateColumns);

9.9.3 批量操作性能

Operations\Rows100,000 EF100,000 EFBulk1,000,000 EFBulk
Insert38.98 s2.10 s17.99 s
Update109.25 s3.96 s31.45 s
Delete7.26 s2.04 s12.18 s
---------------------------------------------------------------
Together70.70 s5.88 s56.84 s

9.9.4 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 EFCore.BulkExtensions 知识可查阅 EFCore.BulkExtensions 开源仓库

- + diff --git a/docs/docs/dbcontext-code-first/index.html b/docs/docs/dbcontext-code-first/index.html index 585c2da80c5..d9ce95c548e 100644 --- a/docs/docs/dbcontext-code-first/index.html +++ b/docs/docs/dbcontext-code-first/index.html @@ -6,7 +6,7 @@ 9.20 模型生成数据库 | Fur - + @@ -30,7 +30,7 @@
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// 住址
/// </summary>
public string Address { get; set; }
}
}
实体约定

所有数据库实体必须直接或间接继承 IEntity 接口。

9.20.2.2 打开 程序包管理控制台

9.20.2.3 切换默认项目

程序包管理控制台 默认项目设置为 Fur.Database.Migrations

9.20.2.4 创建模型版本

Add-Migration v1.0.0
特别说明

v1.0.0 是此处数据库更改的版本号,可以写任何字符串,但推荐写版本号,每次 +1

最终命令如下:

PM> Add-Migration v1.0.0
Build started...
Build succeeded.
Microsoft.EntityFrameworkCore.Model.Validation[10400]
Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data, this mode should only be enabled during development.
Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 5.0.0-rc.1.20451.13 initialized 'FurDbContext' using provider 'Microsoft.EntityFrameworkCore.Sqlite' with options: SensitiveDataLoggingEnabled DetailedErrorsEnabled MaxPoolSize=100 MigrationsAssembly=Fur.Database.Migrations
To undo this action, use Remove-Migration.
PM>

生成成功后,Fur.Database.Migrations 项目下会新增 Migrations 文件夹(如果没有),同时本次的架构生成文件,如:

9.20.2.5 更新到数据库

Update-Database

执行该命令后,数据库就会自动根据模型生成对于的表。

小知识

如果 Update-Database 后面带字符串参数,则会自动还原数据库到指定版本,如:

Update-Database v0.0.3

将数据库还原到 v0.0.3 版本

9.20.3 更新模型

如果模型改变了,重复上面操作即可,如:

Add-Migration v1.0.1
Update-Database

9.20.4 导出 Sql

有些时候,我们没有直接更新数据库的权限,或者怕出问题,我们都会先生成 Sql 看看,这时候只需要通过 Script-Migration 导出即可,如:

Script-Migration

9.20.5 VS Code 方式

9.20.5.1 安装 dotnet ef

dotnet tool install --global dotnet-ef --version 5.0.0-rc.2.20475.6

9.20.5.2 cd 目录

通过 VS Code 打开 .sln 所在的目录,如:framework

之后进入 Fur.Database.Migrations 目录

cd Fur.Database.Migrations

9.20.5.3 执行命令

dotnet ef migrations add v1.0.0 -s "../Fur.Web.Entry"
dotnet ef database update -s "../Fur.Web.Entry"

9.20.6 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 正向工厂 知识可查阅 EF Core - 管理数据库架构 章节。

- + diff --git a/docs/docs/dbcontext-db-first/index.html b/docs/docs/dbcontext-db-first/index.html index 97ea572195b..125e165232f 100644 --- a/docs/docs/dbcontext-db-first/index.html +++ b/docs/docs/dbcontext-db-first/index.html @@ -6,7 +6,7 @@ 9.19 数据库生成模型 | Fur - + @@ -63,7 +63,7 @@
}
}
Fur Tools v1.0.0 全部实体生成成功!
PM>

9.13.4 命令参数配置

Fur Tools Cli 支持多个参数配置,使用方法只需要在命令后面添加即可,如:

&"../tools/cli.ps1" -Context 数据库上下文名 -ConnectionName 连接字符串Key

支持参数如下:

  • -Tables:配置要生成的数据库表,数组类型,如果为空,则生成数据库所有表和视图。如:-Tables Person,PersonDetails
  • -Context:配置数据库上下文,默认 FurDbContext,如果有多个数据库上下文,则此参数必须配置
  • -ConnectionName:配置数据库连接字符串,对于 appsetting.json 中的 Key
  • -OutputDir:生成实体代码输出目录,默认为:./Fur.Core/Entities/
  • -DbProvider:数据库提供器,默认是 Microsoft.EntityFrameworkCore.SqlServer,其他数据库请指定对应程序集
    • SqlServerMicrosoft.EntityFrameworkCore.SqlServer
    • SqliteMicrosoft.EntityFrameworkCore.Sqlite
    • CosmosMicrosoft.EntityFrameworkCore.Cosmos
    • InMemoryDatabaseMicrosoft.EntityFrameworkCore.InMemory
    • MySqlPomelo.EntityFrameworkCore.MySql
    • PostgreSQLNpgsql.EntityFrameworkCore.PostgreSQL
    • OracleCitms.EntityFrameworkCore.Oracle
    • DmMicrosoft.EntityFrameworkCore.Dm
  • -EntryProject:Web 启用项目层名,默认 Fur.Web.Entry
  • -CoreProject:实体项目层名,默认 Fur.Core
  • -DbContextLocators:多数据库上下文定位器,默认 MasterDbContextLocator,支持多个,如:MasterDbContextLocator,MySqlDbContextLocator
  • -Product:解决方案默认前缀,如 Fur
  • -UseDatabaseNames:是否保持生成和数据库、表一致的名称

9.13.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-delete/index.html b/docs/docs/dbcontext-delete/index.html index 08029d0f8b8..ae1ee1fd1f5 100644 --- a/docs/docs/dbcontext-delete/index.html +++ b/docs/docs/dbcontext-delete/index.html @@ -6,7 +6,7 @@ 9.8 删除操作 | Fur - + @@ -71,7 +71,7 @@
// 示例五
await entity.FakeDeleteAsync();
// 示例六
await repository.UpdateIncludeAsync(user, u => u.IsDeleted);

9.8.9 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-filter/index.html b/docs/docs/dbcontext-filter/index.html index b27931fdf1f..3bd43be829c 100644 --- a/docs/docs/dbcontext-filter/index.html +++ b/docs/docs/dbcontext-filter/index.html @@ -6,7 +6,7 @@ 9.23 实体/全局查询筛选器 | Fur - + @@ -38,7 +38,7 @@
// 创建表达式元素
var parameter = Expression.Parameter(metadata.ClrType, "u");
var properyName = Expression.Constant(nameof(Entity.IsDeleted));
var propertyValue = Expression.Constant(false);
// 构建表达式 u => EF.Property<bool>(u, "IsDeleted") == false
var expressionBody = Expression.Equal(Expression.Call(typeof(EF), nameof(EF.Property), new[] { typeof(bool) }, parameter, properyName), propertyValue);
var expression = Expression.Lambda(expressionBody, parameter);
return expression;
}
}
}
小建议

如果对动态构建 LambdaExpression 不熟悉的朋友,可以使用 System.Linq.Dynamic.Corehttps://github.com/zzzprojects/System.Linq.Dynamic.Core

9.23.3 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-function/index.html b/docs/docs/dbcontext-function/index.html index 1e4fb768d44..a01d2549be7 100644 --- a/docs/docs/dbcontext-function/index.html +++ b/docs/docs/dbcontext-function/index.html @@ -6,7 +6,7 @@ 9.14 函数操作 | Fur - + @@ -50,7 +50,7 @@
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity(typeof(F_Person)).HasNoKey();
modelBuilder.HasDbFunction(() => GetPersons(default));
}
}
}

9.14.5.4 在 Linq 中使用

IQueryable<F_Person> query = _repository.DynamicDbContext.GetPersons(1);
var result = query.Where(u => u.Name.Equals("Fur")).ToList();

最终生成 Sql

SELECT [g].Id, [g].Name, [g].Age, [g].Address
FROM dbo.GetPersons(1) AS [g]
WHERE [g].Name == N'Fur';

9.14.6 在 EF Core 内置函数

EF Core 为我们提供了很多常用的内置函数,可以在 Lambda 条件中使用,主要是通过 EF.Functions 调用,如:

_repository.Where(u => EF.Functions.DateDiffHour(u.CreatedDt, DateTime.Now) > 8).FirstOrDefault();

这个语句使用了 EF.Functions.DateDiffHour 最终生成的 Sql 如下:

SELECT TOP(1) [a].*
FROM [dbo].[TEST] AS [a]
WHERE DATEDIFF(HOUR, [a].[CREATED_DT], GETDATE()) > 8

EF Core 内置函数就不一一列出了,可以通过 EF.Functions 查看更多,如果不能满足自己的需求,那么可以自定义 Linq 标量函数

9.14.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-hight-query/index.html b/docs/docs/dbcontext-hight-query/index.html index b7ffdcdcc49..21d63a5e5de 100644 --- a/docs/docs/dbcontext-hight-query/index.html +++ b/docs/docs/dbcontext-hight-query/index.html @@ -6,7 +6,7 @@ 9.11 高级查询操作 | Fur - + @@ -57,7 +57,7 @@
namespace Fur.Core
{
public class Person : Entity, IEntityTypeBuilder<Person>
{
public string Name { get; set; }
/// <summary>
/// 配置实体关系
/// </summary>
/// <param name="entityBuilder"></param>
/// <param name="dbContext"></param>
/// <param name="dbContextLocator"></param>
public void Configure(EntityTypeBuilder<City> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.ToSqlQuery(
@"select * from dbo.person.2020-09-19
union all
select * from dbo.person.2020-09-20");
}
}
}
var posts = repository.Where(u => u.Id > 10).ToList();

9.11.12 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-locator/index.html b/docs/docs/dbcontext-locator/index.html index 43bcb9bf0f1..c6d6b7e81aa 100644 --- a/docs/docs/dbcontext-locator/index.html +++ b/docs/docs/dbcontext-locator/index.html @@ -6,7 +6,7 @@ 9.2 数据库上下文定位器 | Fur - + @@ -28,7 +28,7 @@
namespace Fur.Core
{
public sealed class FurDbContextLocator : IDbContextLocator
{
}
}

9.2.4 默认数据库上下文定位器

Fur 框架中已经提供了 MasterDbContextLocator 默认数据库上下文定位器,所以默认数据库上下文只需继承 AppDbContext<TDbContext> 即可。

AppDbContext<TDbContext> 定义代码如下:

using Fur.DependencyInjection;
using Microsoft.EntityFrameworkCore;
namespace Fur.DatabaseAccessor
{
/// <summary>
/// 默认应用数据库上下文
/// </summary>
/// <typeparam name="TDbContext">数据库上下文</typeparam>
[NonBeScan]
public abstract class AppDbContext<TDbContext> : AppDbContext<TDbContext, MasterDbContextLocator>
where TDbContext : DbContext
{
/// <summary>
/// 构造函数
/// </summary>
/// <param name="options"></param>
public AppDbContext(DbContextOptions<TDbContext> options) : base(options)
{
}
}
}

9.2.5 数据库上下文定位器支持对象

目前数据库上下文支持以下多个对象:

  • AppDbContext<TEntity, TDbContextLocator>:数据上下文
  • IRepository<TEntity, TDbContextLocator:实体仓储
  • ISqlRepository<TDbContextLocator>: Sql 操作仓储
  • Func<Type, DbContext>:依赖注入获取数据库上下文
  • Entity<Tkey, TDbContextLocator> :实体配置
  • EntityBase<Tkey, TDbContextLocator1, ... TDbContextLocator8>:实体配置
  • EntityNotKey<TDbContextLocator1, ... TDbContextLocator8>:无键实体配置
  • IEntitySeedData<TEntity, TDbContextLocator1, ... TDbContextLocator8>:种子数据配置
  • IEntityTypeBuilder<TEntity, TDbContextLocator1, ... TDbContextLocator8>:实体类型构建器
  • IModelBuilderFilter<TDbContextLocator1, ... TDbContextLocator8>:模型构建筛选器
  • [QueryableFunction(DbContextLocators=Type[])]:查询函数

9.2.6 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-multi-database/index.html b/docs/docs/dbcontext-multi-database/index.html index 14c3e0db8cd..c5707c11f51 100644 --- a/docs/docs/dbcontext-multi-database/index.html +++ b/docs/docs/dbcontext-multi-database/index.html @@ -6,7 +6,7 @@ 9.18 多数据库操作 | Fur - + @@ -43,7 +43,7 @@
// 支持一个数据库
public class Person: IEntity<MySqlDbContextLocator>
{
// ....
}
// 支持多个数据库
public class Person: IEntity<MySqlDbContextLocator, SqliteDbContextLocator>
{
// ....
}
小知识

所有的 实体依赖接口或抽象类 都支持泛型方式 指定 数据库上下文定位器,最多支持 8 个。

9.18.3.5 Linq 函数方式

public static class QueryFunctions
{
[QueryableFunction("FN_GetId", "dbo", typeof(MySqlDbContextLocator), typeof(SqliteDbContextLocator))]
public static int GetId(int id) => throw new NotSupportedException();
}

9.18.4 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-proc/index.html b/docs/docs/dbcontext-proc/index.html index ff8e294a75b..6eb98e5438e 100644 --- a/docs/docs/dbcontext-proc/index.html +++ b/docs/docs/dbcontext-proc/index.html @@ -6,7 +6,7 @@ 9.13 存储过程操作 | Fur - + @@ -119,7 +119,7 @@
// 获取 RETURN 返回值
var reval = result.ReturnValue;
// 获取返回结果集
var (list1,list2) = result.Result;
关于异步

Fur 框架每一个数据库操作都支持异步方式,由于篇幅有限,就不列举异步方式了。

9.13.3 关于 [DbParameter]

[DbParameter] 特性是用来标注 Sql函数存储过程 参数的,可配置属性:

  • Direction:设置参数方向,ParameterDirection 枚举类型,默认 ParameterDirection.Input
  • DbType:设置参数类型,DbType 枚举类型,无默认
  • Size:设置参数长度的,int 类型

其中 Direction 属性是默认构造函数参数。

9.13.4 关于 ProcedureOutputResult

ProcedureOutputResultProcedureOutputResult<TResult> 是复杂存储过程执行返回模型类,有以下属性:

  • OutputValues:多个输出值,ProcedureOutputValue 类型
  • ReturnValue:返回值,object 类型
  • Result:结果集,非泛型版本是 DataSet类型,否则是 泛型类型

9.13.5 存储过程参数

所有 sql 参数都支持四种方式:

  • DbParameter[]:数组类型
  • new {}:匿名类型
  • new Class{}:强类型类型(支持复杂存储过程参数)
  • Dictionary<string,object> 类型

9.13.6 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-query/index.html b/docs/docs/dbcontext-query/index.html index 8c457653c3f..4abc96f41bb 100644 --- a/docs/docs/dbcontext-query/index.html +++ b/docs/docs/dbcontext-query/index.html @@ -6,7 +6,7 @@ 9.10 查询操作 | Fur - + @@ -138,7 +138,7 @@
// 示例二
_testRepository.Where(u => u.Name.EndWith("Fur"));
// 示例三
_testRepository.Where(u => u.Name.Contains("Fur"));

9.10.6.9 Case When

数据库中的 Case When 实际上对应的是我们程序中的 三元表达式 ,也就是使用 三元表达式 即可自动生成 Case When 语句。

9.10.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-read-write/index.html b/docs/docs/dbcontext-read-write/index.html index ed0bdf2fc45..6e32668868f 100644 --- a/docs/docs/dbcontext-read-write/index.html +++ b/docs/docs/dbcontext-read-write/index.html @@ -6,7 +6,7 @@ 9.26 读写分离/主从复制 | Fur - + @@ -38,7 +38,7 @@
/// <summary>
/// 查询走从库
/// </summary>
/// <returns></returns>
public List<Person> Get()
{
return _msRepository.Slave1<Person>().AsEnumerable();
}
}
}

9.26.3 主从复制

主从复制:是一种数据备份的方案。

简单来说,是使用两个或两个以上相同的数据库,将一个数据库当做主数据库,而另一个数据库当做从数据库。在主数据库中进行相应操作时,从数据库记录下所有主数据库的操作,使其二者一模一样。

9.26.4 主从复制几种方式

9.26.4.1 同步复制

所谓的同步复制,意思是 Master 的变化,必须等待 Slave-1,Slave-2,...,Slave-n 完成后才能返回。 这样,显然不可取,比如,在 Web 前端页面上,用户增加了条记录,需要等待很长时间。

9.26.4.2 异步复制

如同 AJAX 请求一样。Master 只需要完成自己的数据库操作即可。至于 Slaves 是否收到二进制日志,是否完成操作,不用关心。(推荐方式)

9.26.4.3 半同步复制

Master 只保证 Slaves 中的一个操作成功,就返回,其他 Slave 不管。

下面将使用 SqlServer 简单配置主从复制功能。

9.26.5 SqlServer 主库配置

9.26.5.1 添加 本地发布

9.26.5.2 选择 分发服务器

9.26.5.3 启用 代理

9.26.5.4 发布数据库

9.26.5.5 快照发布

具体选择何种发布类型,视具体业务场景而定。

9.26.5.6 选择发布项目

9.26.5.7 配置分发计划

9.26.5.8 配置安全设置

9.26.5.9 完成配置

9.26.6 SqlServer 从库配置

9.26.6.1 添加 本地订阅

9.26.6.2 选择 分发服务器

9.26.6.3 选择 分发代理位置

9.26.6.4 选择 订阅数据库

9.26.6.5 选择 分发安全设置

9.26.6.6 选择 同步计划

9.26.6.7 完成订阅

9.26.7 分发定义监视

9.26.8 查看主从复制结果

特别特性

主从复制有一定迟延性,所以系统设计要有一定“容忍性"。

9.26.9 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-repository/index.html b/docs/docs/dbcontext-repository/index.html index 617beccb4de..ab6b7871b16 100644 --- a/docs/docs/dbcontext-repository/index.html +++ b/docs/docs/dbcontext-repository/index.html @@ -6,7 +6,7 @@ 9.4 仓储模式 | Fur - + @@ -33,7 +33,7 @@
// 其他更多数据库一样的操作

另外任何仓储或实体配置都支持多个数据库同时操作

仓储方式

IRepository<Person, MsSqlDbContextLocator> mssqlRepository
ISqlRepository<MsSqlDbContextLocator> mssqlRepository;

动态 sql 方式

"select * from person".Change<MsSqlDbContextLocator>().SqlQuery();

实体配置方式

public class User:Entity<MsSqlDbContextLocator, MySqlDbContextLocator>
{
}

Sql 代理方式

[SqlFunction("funcName", DbContextLocator = typeof(MySqlDbContextLocator))]
int GetAge(int id);

Linq 中方式

[QueryableFunction("funcName","dbo", DbContextLocator = typeof(MySqlDbContextLocator))]
string GetName()=> throw Oops.Oh("不支持该数据库操作");

9.4.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-seed-data/index.html b/docs/docs/dbcontext-seed-data/index.html index 7dd98ba22b0..68240b24e47 100644 --- a/docs/docs/dbcontext-seed-data/index.html +++ b/docs/docs/dbcontext-seed-data/index.html @@ -6,7 +6,7 @@ 9.21 实体种子数据 | Fur - + @@ -32,7 +32,7 @@
namespace Fur.Application
{
public class PersonSeedData : IEntitySeedData<Person>
{
// 配置种子数据
public IEnumerable<Person> HasData(DbContext dbContext, Type dbContextLocator)
{
return new List<Person>
{
new Person { Id = 1, Name = "百小僧", Address = "广东省中山市" },
new Person { Id = 2, Name = "新生帝", Address = "广东省珠海市" }
};
}
}
}

9.21.3 导航属性

通常我们的实体有 一对多多对多等外键关系,那么我们需要单独为每一个实体添加数据种子,而不是直接写在主表中。

9.21.4 多个数据库种子数据

Fur 提供泛型的方式支持多个数据库种子数据设定,如:

using Fur.DatabaseAccessor;
using System.Collections.Generic;
namespace Fur.Application
{
public class PersonSeedData : IEntitySeedData<Person, MySqlDbContextLocator, SqliteDbContextLocator>
{
// 配置种子数据
public IEnumerable<Person> HasData(DbContext dbContext, Type dbContextLocator)
{
return new List<Person>
{
new Person { Id = 1, Name = "百小僧", Address = "广东省中山市" },
new Person { Id = 2, Name = "新生帝", Address = "广东省珠海市" }
};
}
}
}

上面的例子表示同时为 MySqlDbContextSqliteDbContext 创建种子数据。

9.21.5 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 数据种子 知识可查阅 EF Core - 数据种子设定 章节。

- + diff --git a/docs/docs/dbcontext-sql-proxy/index.html b/docs/docs/dbcontext-sql-proxy/index.html index 9abc2836e95..0f322df77b0 100644 --- a/docs/docs/dbcontext-sql-proxy/index.html +++ b/docs/docs/dbcontext-sql-proxy/index.html @@ -6,7 +6,7 @@ 9.17 Sql 高级代理 | Fur - + @@ -76,7 +76,7 @@
namespace Fur.Application
{
public interface ISql : ISqlDispatchProxy
{
[SqlFunction("FN_Name")] // 标量函数
string GetValue(MyParam dto);
[SqlProcedure("FN_Name")] // 表值函数
List<Person> GetPersons(int id);
}
}
补充说明

Sql 代理会自动判断返回值然后自动执行特定函数类型。

9.17.6 为什么用它?

通过上面的例子大家就可以了解,这种方式操作 sql 非常简单,而且极易维护。大家不用去关系返回值,关心用哪个方法,所有东西会自动给你处理好。

所以,如果需要用 Sql 操作,推荐使用 Sql 高级代理。

9.17.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-sql-template/index.html b/docs/docs/dbcontext-sql-template/index.html index c0e1c73e4a2..2bf406cba06 100644 --- a/docs/docs/dbcontext-sql-template/index.html +++ b/docs/docs/dbcontext-sql-template/index.html @@ -6,7 +6,7 @@ 9.16 Sql 模板 | Fur - + @@ -28,7 +28,7 @@
// 懒人方式
var users = "#(Select.User)".SqlQuery<User>(new { id = 1});
// Sql 代理方式
[SqlExecute("#(Select.User)")]
List<User> GetUser(int id);

9.16.3.2 高级嵌套

var users = repository.SqlQuery<User>(
@"select * from user u
left join #(User.Detail) d on u.Id = d.UserId
where id > @id");

9.16.4 Sql 模板配置

9.16.4.1 普通模式

{
"Select.User": "select * from User"
}

9.16.4.2 更多配置

{
"Select.User": {
"Sql": "select * from User where id > @id and Name = @name",
"Params": [
{
"Name": " Id",
"Value": "1",
"DbType": "Int16",
"Size": 10
},
{
"Name": " Name",
"Value": "百小僧",
"DbType": "String",
"Size": 10
}
]
}
}

9.16.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-sql/index.html b/docs/docs/dbcontext-sql/index.html index 2b2adbe6c2d..ac2db99a8a8 100644 --- a/docs/docs/dbcontext-sql/index.html +++ b/docs/docs/dbcontext-sql/index.html @@ -6,7 +6,7 @@ 9.15 Sql 操作 | Fur - + @@ -173,7 +173,7 @@
// 不再举例子。。。
补充说明

不管是那种方式操作 Sql ,方法名参数都是一致的,如:

  • SqlQuery
  • SqlQueryAsync
  • SqlQueries
  • SqlQueriesAsync
  • SqlNonQuery
  • SqlNonQueryAsync
  • SqlScalar
  • SqlScalarAsync
  • SqlProcedureQuery
  • SqlProcedureQueryAsync
  • SqlProcedureQueries
  • SqlProcedureQueriesAsync
  • SqlProcedureScalar
  • SqlProcedureScalarAsync
  • SqlProcedureNonQuery
  • SqlProcedureNonQueryAsync
  • SqlProcedureOutput
  • SqlProcedureOutputAsync
  • SqlFunctionScalar
  • SqlFunctionScalarAsync
  • SqlFunctionQuery
  • SqlFunctionQuery

9.15.6 IRepository 操作

IRepository 也能操作 sql,调用方法也是和上面一致的,如:

var dataTable = repository.Sql().SqlQuery("select * from person");
特别说明

由于篇幅有限,不再列举所有例子。

9.15.7 IRepository<TEntity> 操作

IRepository<TEntity> 也能操作 sql,调用方法也是和上面一致的,如:

var dataTable = personRepository.SqlQuery("select * from person");
特别说明

由于篇幅有限,不再列举所有例子。

9.15.8 关于 Sql 参数

所有 sql存储过程函数 参数都支持四种方式:

  • DbParameter[]:数组类型
  • new {}:匿名类型
  • new Class{}:强类型类型(支持复杂存储过程参数)
  • Dictionary<string,object> 类型
小知识

建议除了复杂的存储过程(带 OUTPUT/RETURN)的以外,所有参数建议使用 new {} 匿名类型,如果需要动态参数,则可以使用 Dictionary<string,object> 类型。

9.15.9 多数据库 Sql 操作 💯 💛

Fur 框架拥有非常灵活的多数据库操作方式,只需通过多数据库上下文定位器即可动态切换数据库。

9.15.9.1 懒人无敌 🐮 方式

var dataTable = "select * from person".Change<MySqlDbContextLocator>().SqlQuery();
var persons = "select * from person whre id > @id".Change<SqliteDbContextLocator>().SqlQuery<Person>();
补充说明

懒人方式 只需要通过 Change<TDbContextLocator> 方式即可动态切换数据库。

9.15.9.2 ISqlRepository 方式

只需要通过 ISqlRepository<TDbContextLocator> 注入或通过 sqlRepository.Change<TDbContextLocator>() 切换。

9.15.9.3 IRepository 方式

只需要通过 repository.Change<TDbContextLocator>() 获取即可。

9.15.9.4 IRepository<TEntity> 方式

只需要通过 IRepository<TEntity, TDbContextLocator> 注入或通过 personRepository.Change<TEntity, TDbContextLocator>() 切换。

9.15.10 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-update/index.html b/docs/docs/dbcontext-update/index.html index a14d174927b..5c7a864ad88 100644 --- a/docs/docs/dbcontext-update/index.html +++ b/docs/docs/dbcontext-update/index.html @@ -6,7 +6,7 @@ 9.6 更新操作 | Fur - + @@ -198,7 +198,7 @@
// 示例二
await repository.UpdateNowAsync(new List<User> { user, user2 });
// 示例三
await repository.UpdateNowAsync(new[] {user, user2 });
小知识

所有带 Now 结尾的表示立即提交到数据库,也就是立即调用 SaveChangesSaveChangesAsync

9.6.15 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext-view/index.html b/docs/docs/dbcontext-view/index.html index e1276f08153..1ed32f536e3 100644 --- a/docs/docs/dbcontext-view/index.html +++ b/docs/docs/dbcontext-view/index.html @@ -6,7 +6,7 @@ 9.12 视图操作 | Fur - + @@ -34,7 +34,7 @@
public FurService(IRepository<V_Person> repository)
{
// 初始化只读仓储
_readableRepository = repository.Constraint<IReadableRepository<V_Person>>();
}
/// <summary>
/// 读取视图
/// </summary>
/// <returns></returns>
public async Task<List<V_Person>> GetVPerson()
{
var list = await _readableRepository.AsAsyncEnumerable();
return list;
}
}
}
小知识

通过 .Constraint<TEntity,TDbContextLocator> 方法可以将仓储约束为特定仓储,如只读仓储,可读可写仓储,只新增仓储等。

9.12.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/dbcontext/index.html b/docs/docs/dbcontext/index.html index 013c36f5a61..53fffaa07d3 100644 --- a/docs/docs/dbcontext/index.html +++ b/docs/docs/dbcontext/index.html @@ -6,7 +6,7 @@ 9.1 数据库上下文 | Fur - + @@ -37,7 +37,7 @@
options.AddDbPool<SecondDbContext, SecondDbContextDbContextLocator>(DbProvider.SqlServer); // 第二个数据库
options.AddDbPool<ThirdDbContext, ThirdDbContextDbContextLocator>(DbProvider.SqlServer); // 第三个数据库

9.1.8 动态数据库上下文对象

Fur 框架中,数据库上下文是定义在 Fur.EntityFramework.Core 项目层,并且该层不被 Fur.ApplicationFur.Core 等层引用。

所以就不能直接在 Fur.Application 项目层直接使用 Fur.EntityFramework.Core 定义的数据库上下文。

Fur 为了解决这个问题,提供了两种方式处理:

  • respository.DbContext :当前数据库上下文对象,返回是 DbContext 抽象类型
  • respository.DynamicDbContext:当前数据库上下文对象,返回的是 dynamic 类型

如果你只是想使用 DbContext 的功能,直接使用 respository.DbContext 即可,如:

respository.DbContext.SaveChanges();

如果你想能够获取具体的数据库上下文类型,如 MyDbContext,那么使用 respository.DynamicDbContext 就可以获取到具体的 MyDbContext 类型。如:

var persons = respository.DynamicDbContext.Persons.Find(1);
var users = respository.DynamicDbContext.Users;

这样就可以直接操作 MyDbContext 定义的属性和方法了。

9.1.9 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 数据库上下文 知识可查阅 EF Core - 配置 DbContext 章节。

- + diff --git a/docs/docs/dependency-injection/index.html b/docs/docs/dependency-injection/index.html index c2b4ec61436..352781f4d89 100644 --- a/docs/docs/dependency-injection/index.html +++ b/docs/docs/dependency-injection/index.html @@ -6,7 +6,7 @@ 11. 依赖注入/控制反转 | Fur - + @@ -59,7 +59,7 @@
Console.WriteLine("SayHello 方法返回值:" + result);
return result;
}
}
}

之后我们只需要为 TestService 增加 [Injection] 特性即可,如:

[Injection(Proxy = typeof(LogDispatchProxy))]
public class TestService: ITestService, ITransient
{
public string SayHello(string word)
{
return $"Hello {word}";
}
}

之后 SayHello 方法被调用的时候就可以实现动态拦截了,比如这里写日志。

11.12.1 AOP 的作用

这种面向切面的能力(动态拦截/代理)可以实现很多很多功能,如:

  • 动态日志记录
  • 动态修改参数
  • 动态修改返回值
  • 动态方法重定向
  • 动态修改代码逻辑
  • 动态实现异常监听

还可以做更多更多的事情。

11.13 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/deploy/index.html b/docs/docs/deploy/index.html index 651e4e257f9..89910df5478 100644 --- a/docs/docs/deploy/index.html +++ b/docs/docs/deploy/index.html @@ -6,7 +6,7 @@ 25. 托管部署 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/devops/index.html b/docs/docs/devops/index.html index 07f01bcc8aa..ca4fb863e17 100644 --- a/docs/docs/devops/index.html +++ b/docs/docs/devops/index.html @@ -6,7 +6,7 @@ 26. 持续部署集成 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/dynamic-api-controller/index.html b/docs/docs/dynamic-api-controller/index.html index 03842a1afb0..bfa51301045 100644 --- a/docs/docs/dynamic-api-controller/index.html +++ b/docs/docs/dynamic-api-controller/index.html @@ -6,7 +6,7 @@ 5. 动态 WebAPI | Fur - + @@ -72,7 +72,7 @@
namespace Fur.Web.Entry.Controllers
{
public class MvcController : ControllerBase
{
public string Get()
{
return nameof(Fur);
}
}
}
注意事项

启用该配置后,如果 Mvc 控制器 没有任何 [Route] 特性,但是贴了 [ApiController] 特性将会报错。原因是 [ApiController] 特性内部做了路由特性检测。所以建议使用 [ApiDataValidation] 代替。

查看 ASP.NET Core - ApiBehaviorApplicationModelProvider 源码

5.11 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/entity/index.html b/docs/docs/entity/index.html index 1cbab541f55..2e2e9df5b09 100644 --- a/docs/docs/entity/index.html +++ b/docs/docs/entity/index.html @@ -6,7 +6,7 @@ 9.3 数据库实体 | Fur - + @@ -39,7 +39,7 @@
// 配置数据库实体
public void Configure(EntityTypeBuilder<User> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasKey(u => u.Id);
entityBuilder.HasIndex(u => u.Name);
}
}
}

9.3.3.2 在任何实例类中配置

using Fur.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
namespace Fur.Core
{
public class SomeClass : IEntityTypeBuilder<User>
{
public void Configure(EntityTypeBuilder<User> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasKey(u => u.Id);
entityBuilder.HasIndex(u => u.Name);
}
}
}

如,上面例子,通过 SomeClass 配置 User 数据库实体。

9.3.4 数据库实体配置说明

Fur 框架会自动扫描所有继承 IEntity 接口的类进行 DbSet<TEntity> 注册,也就是实现自动配置 DbContextOnModelCreating

如果需要跳过自动注册,只需要贴 [NonAutomatic][SkipScan] 特性即可。一旦贴了此特性,那么就需要手动配置 DbContextOnModelCreating

9.3.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/errors/index.html b/docs/docs/errors/index.html index d7159f6ca46..3a3e12e7e11 100644 --- a/docs/docs/errors/index.html +++ b/docs/docs/errors/index.html @@ -6,7 +6,7 @@ 29.2 常见错误 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/event-bus/index.html b/docs/docs/event-bus/index.html index 35be71d49fd..16aa6d8fc17 100644 --- a/docs/docs/event-bus/index.html +++ b/docs/docs/event-bus/index.html @@ -6,7 +6,7 @@ 18. 事件总线 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/friendly-exception/index.html b/docs/docs/friendly-exception/index.html index e8063d10f99..06237ba9041 100644 --- a/docs/docs/friendly-exception/index.html +++ b/docs/docs/friendly-exception/index.html @@ -6,7 +6,7 @@ 7. 友好异常处理 | Fur - + @@ -61,7 +61,7 @@
namespace Fur.Application
{
public class LogExceptionHandler : IGlobalExceptionHandler, ISingleton
{
public Task OnExceptionAsync(ExceptionContext context)
{
// 写日志
return Task.CompletedTask;
}
}
}

7.15 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/get-start/index.html b/docs/docs/get-start/index.html index 6fa3eda5a82..2790e2b2ea5 100644 --- a/docs/docs/get-start/index.html +++ b/docs/docs/get-start/index.html @@ -6,7 +6,7 @@ 2. 一分钟入门 | Fur - + @@ -37,7 +37,7 @@
app.UseInject(string.Empty); // 添加这一行,如果是 MVC和API共存项目,无需添加 string.Empty
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}

2.4 启动浏览器

启动浏览器查看效果。

说好一分钟入门,你们用了多长时间。😁

- + diff --git a/docs/docs/gooduse/index.html b/docs/docs/gooduse/index.html index d0c1eb5e60e..788ec247ee5 100644 --- a/docs/docs/gooduse/index.html +++ b/docs/docs/gooduse/index.html @@ -6,7 +6,7 @@ 29.3 最佳实践 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/grpc/index.html b/docs/docs/grpc/index.html index 24cafd19ab1..accb53cc80a 100644 --- a/docs/docs/grpc/index.html +++ b/docs/docs/grpc/index.html @@ -6,7 +6,7 @@ 24. Grpc 服务 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/http/index.html b/docs/docs/http/index.html index 19eeb8fcf99..d30ed22311a 100644 --- a/docs/docs/http/index.html +++ b/docs/docs/http/index.html @@ -6,7 +6,7 @@ 20. 网络请求 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/index.html b/docs/docs/index.html index c86775f8984..af5cac7f16c 100644 --- a/docs/docs/index.html +++ b/docs/docs/index.html @@ -6,7 +6,7 @@ 1.1 介绍 | Fur - + @@ -20,13 +20,13 @@ - +
-

1.1 介绍

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.34
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-rc.final.34 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.34

🍎 框架特点

  • 全新面貌:基于 .NET 5 平台,没有历史包袱
  • 极易入门:只需要一个 Inject() 即可完成配置
  • 极速开发:内置丰富的企业应用开发功能
  • 极少依赖:框架只依赖三个第三方包
  • 极其灵活:轻松面对多变复杂的需求
  • 极易维护:采用独特的架构思想,只为长久维护设计
  • 完整文档:提供完善的开发文档

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司
  • 上海奥达科股份有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...
😤 好人!10Nice 的小僧,我们的 dotnetchina 马上火起来了
😮 木木 Woody10感谢您的开源项目!
😚 Joker HouQQ 超级会员一个月
🤠 ccdfzQQ 专属红包 199
🌝 天夫李总支付宝 6666Fur 非常有意思,持续关注
😝 六尘子微信红包 199公司已经使用,小小敬意

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor 👉 IoTSharp

+

1.1 介绍

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.50
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-rc.final.50 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.50

🥜 Fur 官方包

包类型名称版本描述
nugetFurv1.0.0-rc.final.50Fur 总包
nugetFur.Extras.Authentication.JwtBearerv1.0.0-rc.final.50Fur Jwt 拓展包

🍎 框架特点

  • 全新面貌:基于 .NET 5 平台,没有历史包袱
  • 极易入门:只需要一个 Inject() 即可完成配置
  • 极速开发:内置丰富的企业应用开发功能
  • 极少依赖:框架只依赖三个第三方包
  • 极其灵活:轻松面对多变复杂的需求
  • 极易维护:采用独特的架构思想,只为长久维护设计
  • 完整文档:提供完善的开发文档

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司
  • 上海奥达科股份有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...
😤 好人!10Nice 的小僧,我们的 dotnetchina 马上火起来了
😮 木木 Woody10感谢您的开源项目!
😚 Joker HouQQ 超级会员一个月
🤠 ccdfzQQ 专属红包 199
🌝 天夫李总支付宝 6666Fur 非常有意思,持续关注
😝 六尘子微信红包 199公司已经使用,小小敬意

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor 👉 IoTSharp

- + @@ -40,6 +40,6 @@ - + \ No newline at end of file diff --git a/docs/docs/job/index.html b/docs/docs/job/index.html index 8bf4d4c9b0b..0efbacfb741 100644 --- a/docs/docs/job/index.html +++ b/docs/docs/job/index.html @@ -6,7 +6,7 @@ 22. 任务调度 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/local-language/index.html b/docs/docs/local-language/index.html index 31221419b05..9346f3a4e01 100644 --- a/docs/docs/local-language/index.html +++ b/docs/docs/local-language/index.html @@ -6,7 +6,7 @@ 16. 多语言处理 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/logging/index.html b/docs/docs/logging/index.html index e65a01d8ca3..c4b8051ded5 100644 --- a/docs/docs/logging/index.html +++ b/docs/docs/logging/index.html @@ -6,7 +6,7 @@ 19. 日志记录 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/object-mapper/index.html b/docs/docs/object-mapper/index.html index 73d66af5a83..2ae23577ad5 100644 --- a/docs/docs/object-mapper/index.html +++ b/docs/docs/object-mapper/index.html @@ -6,7 +6,7 @@ 12. 对象数据映射 | Fur - + @@ -28,7 +28,7 @@
var dto = new Dto();
dto.Id = entity.Id;
dto.Name = entity.Name;
dto.Age = entity.Age;
dto.Address = entity.Address;
dto.FullName = entity.FirstName + entity.LastName;
dto.IdCard = entity.IdCard.Replace("1234", "****");

上面的例子似乎没有任何问题,但是如果很多地方需要这样的赋值操作、或者相同的赋值操作在多个地方使用,又或者一个类中含有非常多的属性或自定义赋值操作。那么这样的操作效率极低,容易出错,且代码非常臃肿和冗余。

所以,实现自动映射赋值和支持特殊配置的需求就有了。目前 C# 平台有两个优秀的对象映射工具:MapsterAutoMapperFur 框架中,默认集成的是 MapsterMapster 是一款极易使用且超高性能的对象映射框架。

12.3 Mapster 使用

现在,我们可以通过 Mapster 提供的对象映射方法:Adapt 方法改造上面的例子:

12.3.1 极易入门

var entity = repository.Find(1);
var dto = entity.Adapt<Dto>();

仅仅一行代码就可以实现 entity -> dto 的转换,如果涉及到赋值的复制操作,如 dto.FullNamedto.IdCard,我们只需要自定义映射规则类即可。

12.3.2 自定义映射规则

using Fur.ObjectMapper;
using Mapster;
using System;
namespace Fur.Application
{
public class Mapper : IObjectMapper
{
public void Register(TypeAdapterConfig config)
{
config.ForType<Entity, Dto>()
.Map(dest => dest.FullName, src => src.FirstName + src.LastName)
.Map(dest => dest.IdCard, src => src.IdCard.Replace("1234", "****"));
}
}
}
小知识

该映射文件 Mapper.cs 可以放在任何项目或文件夹中,Fur 会在程序启动的时候自动扫描并注入配置。

12.3.3 依赖注入方式

Mapster 除了提供 Adapt 拓展方法以外,同时还提供依赖注入的方式。

public Person(IMapper mapper)
{
var dto = _mapper.Map<Dto>(entity);
}

12.3.4 和 EFCore 配合

Mapster 还提供了 ProjectToType Linq 拓展方法减少我们手动 Select 操作,如:

正常的操作:

var destinations = context.Sources
.Select(c => new Destination {
Id = p.Id,
Name = p.Name,
Surname = p.Surname,
....
})
.ToList();

使用 Mapster 之后:

var destinations = context.Sources.ProjectToType<Destination>().ToList();

12.5 全局默认配置

Fur 提供全局默认映射配置选项 TypeAdapterConfig.GlobalSettings.Default,可在 Startup 中配置即可,如:

TypeAdapterConfig.GlobalSettings.Default
.PreserveReference(true);

12.6 EFCore 映射问题

在使用 Mapster 映射实体的时候,如果实体包含 一对多、多对多的导航属性时候,当执行数据库 Update 更新操作的时候,默认就做了全量更新,会影响性能。

所以,社区开发者提供了新的解决方案,可以解决这个问题,代码传送门:TypeAdapterBuilderExtensions.cs

12.7 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 Mapster 知识可查阅 Mapster - Wiki 文档。

- + diff --git a/docs/docs/options/index.html b/docs/docs/options/index.html index 7a9eddfd692..c41147aa7b7 100644 --- a/docs/docs/options/index.html +++ b/docs/docs/options/index.html @@ -6,7 +6,7 @@ 4.2 选项 | Fur - + @@ -38,7 +38,7 @@
public void OnListener(AppInfoOptions options, IConfiguration configuration)
{
var name = options.Name; // 实时的最新值
var version = options.Version; // 实时的最新值
}
public void PostConfigure(AppInfoOptions options, IConfiguration configuration)
{
}
}
特别说明

IConfigurableOptionsListener<TOptions> 继承自 IConfigurableOptions<TOptions>

4.2.10 选项的优缺点

  • 优点

    • 强类型配置
    • 提供多种读取方式
    • 支持热加载
    • 支持设置默认值/后期配置
    • 支持在运行环境中动态配置
    • 支持验证配置有效性
    • 支持更改通知
    • 支持命名选项
  • 缺点

    • 需要定义对应类型
    • 需要在启动时注册

4.2.11 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 选项 知识可查阅 ASP.NET Core - 选项 章节。

- + diff --git a/docs/docs/performance/index.html b/docs/docs/performance/index.html index 7b13a8017d3..d0c5d2cde3a 100644 --- a/docs/docs/performance/index.html +++ b/docs/docs/performance/index.html @@ -6,7 +6,7 @@ 27.2 性能测试 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/process-service/index.html b/docs/docs/process-service/index.html index 69b443daa46..f47778a6c03 100644 --- a/docs/docs/process-service/index.html +++ b/docs/docs/process-service/index.html @@ -6,7 +6,7 @@ 21. 进程服务 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/reference/index.html b/docs/docs/reference/index.html index 0dbebe90704..a6810aeb156 100644 --- a/docs/docs/reference/index.html +++ b/docs/docs/reference/index.html @@ -6,7 +6,7 @@ 1.4 项目引用 | Fur - + @@ -28,7 +28,7 @@
namespace Fur.Web.Entry
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.Inject()
.UseStartup<Startup>();
});
}
}
}

1.4.3 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/saas/index.html b/docs/docs/saas/index.html index 3e4686a1f5d..f9c2ccd5c7a 100644 --- a/docs/docs/saas/index.html +++ b/docs/docs/saas/index.html @@ -6,7 +6,7 @@ 10. SaaS 多租户 | Fur - + @@ -63,7 +63,7 @@
public string Name { get; set; }
public string Host { get; set; }
}
}

如果需要查询该租户信息,可通过以下代码获取,如:

var tenantDbContext = Db.GetDbContext<MultiTenantDbContextLocator>();
var myTenant = tenantDbContext.Set<MyTenant>();

10.9 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/signalr/index.html b/docs/docs/signalr/index.html index 2215a0c95c7..1d20ae35066 100644 --- a/docs/docs/signalr/index.html +++ b/docs/docs/signalr/index.html @@ -6,7 +6,7 @@ 23. 即时通讯 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/source/index.html b/docs/docs/source/index.html index 95e984575b3..7ab4b903c05 100644 --- a/docs/docs/source/index.html +++ b/docs/docs/source/index.html @@ -6,7 +6,7 @@ 1.3 源码结构 | Fur - + @@ -58,7 +58,7 @@
#prefer fields not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_field = false:suggestion
#prefer methods not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_method = false:suggestion
#prefer properties not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_property = false:suggestion
# Add file header
file_header_template = -----------------------------------------------------------------------------\nFur 是 .NET 5 平台下企业应用开发最佳实践框架。\nCopyright © 2020 Fur, Baiqian Co.,Ltd.\n\n框架名称:Fur\n框架作者:百小僧\n框架版本:1.0.0\n源码地址:Gitee:https://gitee.com/monksoul/Fur \n Github:https://github.com/monksoul/Fur \n开源协议:Apache-2.0(http://www.apache.org/licenses/LICENSE-2.0)\n-----------------------------------------------------------------------------

1.2.4 Fur 核心层

Fur 核心层是 Fur 框架的中心,也是 Fur 能够支撑起来的必备层。

源码结构:

Fur
├─Fur.csproj
├─Fur.csproj.user
├─FurStartup.cs
├─ViewEngine
| ├─IViewEngine.cs
| ├─ViewEngine.cs
| ├─Templates
| | ├─IViewEngineCompiledTemplate.cs
| | ├─IViewEngineTemplate.cs
| | ├─ViewEngineCompiledTemplate.cs
| | └ViewEngineTemplate.cs
| ├─Options
| | └ViewEngineCompilationOptions.cs
| ├─Models
| | └AnonymousTypeWrapper.cs
| ├─Exceptions
| | ├─ViewEngineCompilationException.cs
| | └ViewEngineException.cs
| ├─Compilations
| | ├─IViewEngineCompilationOptionsBuilder.cs
| | └ViewEngineCompilationOptionsBuilder.cs
├─UnifyResult
| ├─Providers
| | ├─IUnifyResultProvider.cs
| | └RESTfulResultProvider.cs
| ├─Models
| | └RESTfulResult.cs
| ├─Filters
| | └SuccessUnifyResultFilter.cs
| ├─Extensions
| | └UnifyResultServiceCollectionExtensions.cs
├─SpecificationDocument
| ├─Options
| | └SpecificationDocumentSettingsOptions.cs
| ├─Models
| | ├─GroupOrder.cs
| | ├─SpecificationOpenApiInfo.cs
| | ├─SpecificationOpenApiSecurityRequirementItem.cs
| | └SpecificationOpenApiSecurityScheme.cs
| ├─Extensions
| | ├─SpecificationDocumentApplicationBuilderExtensions.cs
| | └SpecificationDocumentServiceCollectionExtensions.cs
| ├─Builders
| | └SpecificationDocumentBuilder.cs
| ├─Assets
| | └index-mini-profiler.html
├─ObjectMapper
| ├─Extensions
| | └ObjectMapperServiceCollectionExtensions.cs
| ├─Dependencies
| | └IObjectMapper.cs
├─LinqBuilder
| ├─Visitors
| | └ParameterReplaceExpressionVisitor.cs
| ├─Extensions
| | └LinqExtensions.cs
| ├─Builders
| | └LinqExpression.cs
├─FriendlyException
| ├─Oops.cs
| ├─Providers
| | └IErrorCodeTypeProvider.cs
| ├─Options
| | └ErrorCodeMessageSettingsOptions.cs
| ├─Models
| | └MethodIfException.cs
| ├─Filters
| | └FriendlyExceptionFilter.cs
| ├─Extensions
| | └FriendlyExceptionServiceCollectionExtensions.cs
| ├─Attributes
| | ├─ErrorCodeItemMetadataAttribute.cs
| | ├─ErrorCodeTypeAttribute.cs
| | └IfExceptionAttribute.cs
├─DynamicApiController
| ├─Penetrates.cs
| ├─Providers
| | └DynamicApiControllerFeatureProvider.cs
| ├─Options
| | └DynamicApiControllerSettingsOptions.cs
| ├─Models
| | └ParameterRouteTemplate.cs
| ├─Extensions
| | └DynamicApiControllerServiceCollectionExtensions.cs
| ├─Enums
| | └ApiSeats.cs
| ├─Dependencies
| | └IDynamicApiController.cs
| ├─Conventions
| | └DynamicApiControllerApplicationModelConvention.cs
| ├─Attributes
| | ├─ApiDescriptionSettingsAttribute.cs
| | ├─ApiSeatAttribute.cs
| | └DynamicApiControllerAttribute.cs
├─DependencyInjection
| ├─Options
| | └DependencyInjectionSettingsOptions.cs
| ├─Models
| | └ExternalService.cs
| ├─Extensions
| | └DependencyInjectionServiceCollectionExtensions.cs
| ├─Enums
| | ├─InjectionActions.cs
| | ├─InjectionPatterns.cs
| | └RegisterType.cs
| ├─Dependencies
| | ├─IPrivateDependency.cs
| | ├─IScoped.cs
| | ├─ISingleton.cs
| | ├─ITransient.cs
| | ├─Proxies
| | | └IDispatchProxy.cs
| ├─Attributes
| | ├─InjectionAttribute.cs
| | └SkipScanAttribute.cs
├─DataValidation
| ├─Validators
| | └DataValidator.cs
| ├─Providers
| | └IValidationMessageTypeProvider.cs
| ├─Options
| | └ValidationTypeMessageSettingsOptions.cs
| ├─Models
| | └DataValidationResult.cs
| ├─Filters
| | └DataValidationFilter.cs
| ├─Extensions
| | ├─DataValidationExtensions.cs
| | └DataValidationServiceCollectionExtensions.cs
| ├─Enums
| | ├─ValidationPattern.cs
| | └ValidationTypes.cs
| ├─Attributes
| | ├─DataValidationAttribute.cs
| | ├─NonValidationAttribute.cs
| | ├─ValidationItemMetadataAttribute.cs
| | ├─ValidationMessageAttribute.cs
| | ├─ValidationMessageTypeAttribute.cs
| | └ValidationTypeAttribute.cs
├─DataEncryption
| ├─AESEncryption.cs
| ├─DESCEncryption.cs
| └MD5Encryption.cs
├─DatabaseAccessor
| ├─UnitOfWork
| | ├─Filters
| | | └UnitOfWorkFilter.cs
| | ├─Attributes
| | | ├─NonTransactAttribute.cs
| | | └UnitOfWorkAttribute.cs
| ├─Repositories
| | ├─EFCoreRepository.cs
| | ├─IMSRepository.cs
| | ├─IRepository.cs
| | ├─ISqlRepository.cs
| | ├─MSRepository.cs
| | ├─SqlRepository.cs
| | ├─Implantations
| | | ├─DeletableRepository.cs
| | | ├─InsertableRepository.cs
| | | ├─OperableRepository.cs
| | | ├─ReadableRepository.cs
| | | ├─SqlExecutableRepository.cs
| | | ├─SqlReaderRepository.cs
| | | ├─UpdateableRepository.cs
| | | └WritableRepository.cs
| | ├─Dependencies
| | | ├─IDeletableRepository.cs
| | | ├─IInsertableRepository.cs
| | | ├─IOperableRepository.cs
| | | ├─IReadableRepository.cs
| | | ├─IRepositoryDependency.cs
| | | ├─ISqlExecutableRepository.cs
| | | ├─ISqlReaderRepository.cs
| | | ├─IUpdateableRepository.cs
| | | └IWritableRepository.cs
| ├─Pools
| | ├─DbContextPool.cs
| | └IDbContextPool.cs
| ├─MultiTenants
| | ├─Locators
| | | └MultiTenantDbContextLocator.cs
| | ├─Enums
| | | └MultiTenantOptions.cs
| | ├─Entities
| | | └Tenant.cs
| | ├─Dependencies
| | | ├─IMultiTenantOnDatabase.cs
| | | ├─IMultiTenantOnSchema.cs
| | | ├─IMultiTenantOnTable.cs
| | | └IPrivateMultiTenant.cs
| ├─Models
| | ├─DbProvider.cs
| | ├─PagedList.cs
| | ├─ProcedureOutputResult.cs
| | ├─ProcedureOutputValue.cs
| | ├─SqlTemplate.cs
| | └SqlTemplateParameter.cs
| ├─Locators
| | ├─IDbContextLocator.cs
| | └MasterDbContextLocator.cs
| ├─Interceptors
| | ├─DbContextSaveChangesInterceptor.cs
| | ├─SqlCommandProfilerInterceptor.cs
| | └SqlConnectionProfilerInterceptor.cs
| ├─Helpers
| | └DbHelpers.cs
| ├─Extensions
| | ├─DatabaseAccessorServiceCollectionExtensions.cs
| | ├─PagedQueryableExtensions.cs
| | ├─Repositories
| | | ├─IEntityExtensions.cs
| | | ├─IEntityWithDbContextLocatorExtensions.cs
| | | └SqlExtensions.cs
| | ├─DatabaseProvider
| | | ├─DatabaseProviderServiceCollectionExtensions.cs
| | | └Penetrates.cs
| | ├─DatabaseFacade
| | | ├─DbDataConvertExtensions.cs
| | | ├─DbObjectExtensions.cs
| | | └SqlAdoNetExtensions.cs
| ├─Enums
| | ├─DbFunctionType.cs
| | ├─EFCoreErrorCodes.cs
| | └ManualOptions.cs
| ├─Entities
| | ├─Dependencies
| | | ├─Entity.cs
| | | ├─EntityBase.cs
| | | ├─EntityNotKey.cs
| | | ├─IEntity.cs
| | | └IEntityNotKey.cs
| | ├─Configures
| | | ├─IEntitySeedData.cs
| | | ├─IEntityTypeBuilder.cs
| | | ├─IModelBuilderFilter.cs
| | | └IPrivateModelBuilder.cs
| | ├─Attributes
| | | ├─FakeDeleteAttribute.cs
| | | ├─NonAutomaticAttribute.cs
| | | └QueryableFunctionAttribute.cs
| ├─DynamicModels
| | ├─DynamicModelCacheKeyFactory.cs
| | └IEntityMutableTable.cs
| ├─Contexts
| | ├─AppDbContext.cs
| | ├─Builders
| | | ├─AppDbContextBuilder.cs
| | | ├─Models
| | | | └DbContextCorrelationType.cs
| | ├─Attributes
| | | └AppDbContextAttribute.cs
| ├─Attributes
| | └DbParameterAttribute.cs
| ├─Advances
| | ├─Proxies
| | | └SqlDispatchProxy.cs
| | ├─Models
| | | └SqlProxyMethod.cs
| | ├─Dependencies
| | | └ISqlDispatchProxy.cs
| | ├─Attributes
| | | ├─SqlExecuteAttribute.cs
| | | ├─SqlFunctionAttribute.cs
| | | ├─SqlProcedureAttribute.cs
| | | ├─Basics
| | | | ├─SqlObjectProxyAttribute.cs
| | | | ├─SqlProxyAttribute.cs
| | | | └SqlSentenceProxyAttribute.cs
├─CorsAccessor
| ├─Options
| | └CorsAccessorSettingsOptions.cs
| ├─Extensions
| | ├─CorsAccessorApplicationBuilderExtensions.cs
| | └CorsAccessorServiceCollectionExtensions.cs
├─ConfigurableOptions
| ├─Options
| | └IConfigurableOptions.cs
| ├─Extensions
| | └ConfigurableOptionsServiceCollectionExtensions.cs
| ├─Attributes
| | └OptionsSettingsAttribute.cs
├─Authorization
| ├─Penetrates.cs
| ├─Requirements
| | └AuthorizePolicyRequirement.cs
| ├─Providers
| | └AuthorizePolicyProvider.cs
| ├─Options
| | └JWTSettingsOptions.cs
| ├─Handlers
| | └AuthorizePolicyHandler.cs
| ├─Extensions
| | └PolicyAuthorizationServiceCollectionExtensions.cs
| ├─Attributes
| | └AuthorizePolicyAttribute.cs
├─App
| ├─App.cs
| ├─Startups
| | ├─AppStartup.cs
| | └HostingStartup.cs
| ├─Options
| | └AppSettingsOptions.cs
| ├─Filters
| | └StartupFilter.cs
| ├─Extensions
| | ├─AppApplicationBuilderExtensions.cs
| | ├─AppServiceCollectionExtensions.cs
| | ├─WebHostBuilderExtensions.cs
| | ├─Types
| | | └ObjectExtensions.cs
| ├─Attributes
| | └AppStartupAttribute.cs

1.2.5 Fur.Application 业务应用层

Fur.Application 业务应用层是最常用的层,几乎所有的业务代码都在这个层中编写。

源码结构:

Fur.Application
├─Fur.Application.Core.csproj
├─Fur.Application.Core.xml
└FurApplicationStartup.cs

1.2.6 Fur.Core 仓储实体层

Fur.Core 主要是存储自定义仓储和定义实体的层。

源码结构:

Fur.Core
├─Fur.Core.csproj
└FurCoreStartup.cs

1.2.7 Fur.Database.Migrations 数据库架构维护层

Fur.Database.Migrations 主要是用来存放 Database FirstCode First 生成的维护文件。

源码结构:

Fur.Database.Migrations
└Fur.Database.Migrations.csproj

1.2.8 Fur.EntityFramework.Core 数据库上下文配置层

Fur.EntityFramework.Core 主要是用来配置数据库上下文和其他数据库相关配置信息的。

源码结构:

Fur.EntityFramework.Core
└Fur.EntityFramework.Core.csproj

1.2.9 Fur.Web.Core 应用核心层

Fur.Web.Core 主要是用来配置 Web 入口一些代码,如 FilterMiddlewares 等。

源码结构:

Fur.Web.Core
├─Fur.Web.Core.xml
└FurWebCoreStartup.cs

1.2.10 Fur.Web.Entry 应用入口层

Fur.Web.Entry 是我们的应用层,也就是我们的 Web 项目层,发布层。

源码结构:

Fur.Web.Entry
├─appsettings.Development.json
├─appsettings.json
├─Fur.Web.Entry.csproj
├─Fur.Web.Entry.csproj.user
├─Fur.Web.Entry.xml
├─Program.cs
├─Startup.cs
├─wwwroot
| └README.md
├─Properties
| └launchSettings.json
├─Controllers
- + diff --git a/docs/docs/specification-document/index.html b/docs/docs/specification-document/index.html index 6c20b9f27b4..ab534b6b9ab 100644 --- a/docs/docs/specification-document/index.html +++ b/docs/docs/specification-document/index.html @@ -6,7 +6,7 @@ 6. 规范化接口文档 | Fur - + @@ -53,7 +53,7 @@
return new JsonResult(new RESTfulResult
{
StatusCode = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK,
Successed = true,
Data = data,
Errors = null
});
}
/// <summary>
/// 验证失败返回值
/// </summary>
/// <param name="context"></param>
/// <param name="modelStates"></param>
/// <param name="validationResults"></param>
/// <param name="validateFaildMessage"></param>
/// <returns></returns>
public IActionResult OnValidateFailed(ActionExecutingContext context, ModelStateDictionary modelStates, Dictionary<string, IEnumerable<string>> validationResults, string validateFaildMessage)
{
return new JsonResult(new RESTfulResult
{
StatusCode = StatusCodes.Status400BadRequest,
Successed = false,
Data = null,
Errors = validationResults
});
}
}
}

之后在 Startup.cs 中注册即可:

services.AddControllers().AddUnifyResult<RESTfulResult, RESTfulResultProvider>();
特别注意

由于使用了规范化结果之后, Swagger 不能显示真实的数据类型,所以需要在 Action 上面贴 [UnifyResult(返回值类型)] 即可。

6.8 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/split-db/index.html b/docs/docs/split-db/index.html index 581e6835094..352b8622bc4 100644 --- a/docs/docs/split-db/index.html +++ b/docs/docs/split-db/index.html @@ -6,7 +6,7 @@ 9.27 分表分库 | Fur - + @@ -30,7 +30,7 @@
// 通过数据库上下文定位器切换
repository.Change<Entity, MyDbContextLocator2>();

如需跨库查询,需用到数据库技术,如 SqlServer 链接服务器或同义词。

  • 动态切换数据库表
// 直接改变表,会有多线程操作bug,同时无法刷新模型
repository.ChangeTable("数据库表");
// 创建新的 DbContext,然后刷新 OnModelCreating(推荐方式)
var dynamicDbContextResolve = App.TransientServices.GetService<Func<Type, IScoped, DbContext>>();
var dynamicDbContext = dynamicDbContextResolve(typeof(MyDbContextLocator), default);
// 重新调用 OnModelCreating,在 OnModelCreating 中配置 ToTable("动态表") 即可。
DynamicModelCacheKeyFactory.RebuildModels();
var persons= dynamicDbContext.Set<Person>();
persons.Add(new Person{});
了解更多

想了解更多 DynamicModelCacheKeyFactory 知识可查阅 EF Core - 多个模型之间交替 章节。

9.27.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/docs/docs/tran/index.html b/docs/docs/tran/index.html index 52641ed6f6e..2d777a2c8ee 100644 --- a/docs/docs/tran/index.html +++ b/docs/docs/tran/index.html @@ -6,7 +6,7 @@ 9.25 事务和工作单元 | Fur - + @@ -29,7 +29,7 @@
var blogs = _testRepository.Entity
.OrderBy(b => b.Url)
.ToList();
// 提交事务
transaction.Commit();
}
catch (Exception)
{
// 回滚事务
transaction.RollBack();
}
}

9.25.4 工作单元特性说明

9.25.4.1 [UnitOfWork]

[UnitOfWork] 特性用来标记事务信息,如作用范围,隔离级别等。

  • Enabled:是否启动工作单元,默认 true
  • ScopeOption:定义事务范围行为,默认 TransactionScopeOption.Required
  • IsolationLevel:设置事务隔离级别,默认 IsolationLevel.ReadCommitted;
  • AsyncFlowOption:允许跨线程连续任务的事务流,如有异步操作需开启该选项,默认开启
特别注意

一旦方法贴了 [UnitOfWork(false)] 特性后,那么该方法不再启用工作单元模式,也就是不包含事务,也不会自动提交数据库。慎用!

9.25.5 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 事务 知识可查阅 EF Core - 使用事务 章节。

- + diff --git a/docs/docs/unittest/index.html b/docs/docs/unittest/index.html index 9437d562fee..99bd1927677 100644 --- a/docs/docs/unittest/index.html +++ b/docs/docs/unittest/index.html @@ -6,7 +6,7 @@ 27.1 单元测试 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/docs/view-engine/index.html b/docs/docs/view-engine/index.html index 417343eff6b..fb3748d0df3 100644 --- a/docs/docs/view-engine/index.html +++ b/docs/docs/view-engine/index.html @@ -6,7 +6,7 @@ 17. 视图引擎 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/docs/index.html b/docs/index.html index 91944ab3697..a4115adb180 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,7 +6,7 @@ Fur 是 .NET 5 平台下企业应用开发最佳实践框架。 Fur | Fur - + @@ -22,7 +22,7 @@

Fur 是 .NET 5 平台下企业应用开发最佳实践框架。

[object Object]

.NET 5 新起点

.NET 5 是 .NET 的重要且令人兴奋的新方向。你会看到 .NET 变得更加简单,但也有更广泛的功能和实用程序。所有新的开发和功能都将是 .NET 5 的一部分,包括新的 C# 版本

[object Object]

“六极” 架构

Fur 在设计之初就秉承着 “六极” :极易入门、极速开发、极少依赖、极少配置、极其灵活、极易维护 的设计思想,在架构设计上做了大量的优化,支持各个能力阶层技术员极速上手。

[object Object]

冲一杯咖啡的时间

Fur 除了独具创新的设计理念和灵活的架构设计以外,同时还结合了主流的敏捷开发模式打造的一款极速开发框架。只需冲制一杯咖啡的时间便可完成工作

- + diff --git a/docs/runtime~main.e2f14afc.js b/docs/runtime~main.2cbf1cb1.js similarity index 96% rename from docs/runtime~main.e2f14afc.js rename to docs/runtime~main.2cbf1cb1.js index 67fe10e0c6c..debc5b3b3c9 100644 --- a/docs/runtime~main.e2f14afc.js +++ b/docs/runtime~main.2cbf1cb1.js @@ -1 +1 @@ -!function(e){function a(a){for(var c,r,t=a[0],n=a[1],o=a[2],u=0,l=[];u=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},O={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},m=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=o(a),m=r,j=u["".concat(c,".").concat(m)]||u[m]||O[m]||b;return a?n.a.createElement(j,l(l({ref:t},p),{},{components:a})):n.a.createElement(j,l({ref:t},p))}));function j(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;pfunction(e,t,a,{forcePrependBaseUrl:r=!1,absolute:b=!1}={}){if(!a)return a;if(a.startsWith("#"))return a;if(Object(n.b)(a))return a;if(r)return t+a;const c=a.startsWith(t)?a:t+a.replace(/^\//,"");return b?e+c:c}(t,e,a,r)}}function c(e,t={}){const{withBaseUrl:a}=b();return a(e,t)}},145:function(e,t,a){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function n(e){return void 0!==e&&!r(e)}a.d(t,"b",(function(){return r})),a.d(t,"a",(function(){return n}))},79:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return l})),a.d(t,"metadata",(function(){return i})),a.d(t,"rightToc",(function(){return p})),a.d(t,"default",(function(){return u}));var r=a(2),n=a(6),b=(a(0),a(142)),c=a(144),l={slug:"welcome",title:"Fur \u4ecb\u7ecd",author:"dotnet\u4e2d\u56fd",author_title:"\u4e3a\u4e2d\u56fd .NET \u5f00\u53d1\u8005\u63d0\u4f9b\u4f18\u8d28\u7684\u8d44\u8baf\u548c\u6280\u672f\u5206\u4eab\u3002",author_url:"https://chinadot.net",author_image_url:"https://i.loli.net/2020/10/01/94AxjHp21aPKQWd.png",tags:["fur","furos",".net",".netcore",".net5"]},i={permalink:"/fur/blog/welcome",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/blog/2020-08-19-welcome.mdx",source:"@site/blog\\2020-08-19-welcome.mdx",description:"=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},O=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},j=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),O=o(a),j=r,m=O["".concat(c,".").concat(j)]||O[j]||u[j]||b;return a?n.a.createElement(m,l(l({ref:t},p),{},{components:a})):n.a.createElement(m,l({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=j;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;pfunction(e,t,a,{forcePrependBaseUrl:r=!1,absolute:b=!1}={}){if(!a)return a;if(a.startsWith("#"))return a;if(Object(n.b)(a))return a;if(r)return t+a;const c=a.startsWith(t)?a:t+a.replace(/^\//,"");return b?e+c:c}(t,e,a,r)}}function c(e,t={}){const{withBaseUrl:a}=b();return a(e,t)}},145:function(e,t,a){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function n(e){return void 0!==e&&!r(e)}a.d(t,"b",(function(){return r})),a.d(t,"a",(function(){return n}))},79:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return l})),a.d(t,"metadata",(function(){return i})),a.d(t,"rightToc",(function(){return p})),a.d(t,"default",(function(){return O}));var r=a(2),n=a(6),b=(a(0),a(142)),c=a(144),l={slug:"welcome",title:"Fur \u4ecb\u7ecd",author:"dotnet\u4e2d\u56fd",author_title:"\u4e3a\u4e2d\u56fd .NET \u5f00\u53d1\u8005\u63d0\u4f9b\u4f18\u8d28\u7684\u8d44\u8baf\u548c\u6280\u672f\u5206\u4eab\u3002",author_url:"https://chinadot.net",author_image_url:"https://i.loli.net/2020/10/01/94AxjHp21aPKQWd.png",tags:["fur","furos",".net",".netcore",".net5"]},i={permalink:"/fur/blog/welcome",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/blog/2020-08-19-welcome.mdx",source:"@site/blog\\2020-08-19-welcome.mdx",description:" Page Not Found | Fur - +

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/handbook/build/4c30b939.0e2f5b3b.js b/handbook/build/4c30b939.0e2f5b3b.js deleted file mode 100644 index d1fdc8633d8..00000000000 --- a/handbook/build/4c30b939.0e2f5b3b.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[30],{142:function(e,t,a){"use strict";a.d(t,"a",(function(){return O})),a.d(t,"b",(function(){return j}));var r=a(0),n=a.n(r);function b(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function c(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function l(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},O=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},m=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),O=o(a),m=r,j=O["".concat(c,".").concat(m)]||O[m]||u[m]||b;return a?n.a.createElement(j,l(l({ref:t},p),{},{components:a})):n.a.createElement(j,l({ref:t},p))}));function j(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;pfunction(e,t,a,{forcePrependBaseUrl:r=!1,absolute:b=!1}={}){if(!a)return a;if(a.startsWith("#"))return a;if(Object(n.b)(a))return a;if(r)return t+a;const c=a.startsWith(t)?a:t+a.replace(/^\//,"");return b?e+c:c}(t,e,a,r)}}function c(e,t={}){const{withBaseUrl:a}=b();return a(e,t)}},145:function(e,t,a){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function n(e){return void 0!==e&&!r(e)}a.d(t,"b",(function(){return r})),a.d(t,"a",(function(){return n}))},85:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return l})),a.d(t,"metadata",(function(){return i})),a.d(t,"rightToc",(function(){return p})),a.d(t,"default",(function(){return O}));var r=a(2),n=a(6),b=(a(0),a(142)),c=a(144),l={id:"introduce",title:"1.1 \u4ecb\u7ecd",sidebar_label:"1.1 \u4ecb\u7ecd",slug:"/"},i={unversionedId:"introduce",id:"introduce",isDocsHomePage:!1,title:"1.1 \u4ecb\u7ecd",description:"=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},O=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},j=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),O=o(a),j=r,m=O["".concat(c,".").concat(j)]||O[j]||u[j]||b;return a?n.a.createElement(m,l(l({ref:t},p),{},{components:a})):n.a.createElement(m,l({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=j;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;pfunction(e,t,a,{forcePrependBaseUrl:r=!1,absolute:b=!1}={}){if(!a)return a;if(a.startsWith("#"))return a;if(Object(n.b)(a))return a;if(r)return t+a;const c=a.startsWith(t)?a:t+a.replace(/^\//,"");return b?e+c:c}(t,e,a,r)}}function c(e,t={}){const{withBaseUrl:a}=b();return a(e,t)}},145:function(e,t,a){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function n(e){return void 0!==e&&!r(e)}a.d(t,"b",(function(){return r})),a.d(t,"a",(function(){return n}))},85:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return l})),a.d(t,"metadata",(function(){return i})),a.d(t,"rightToc",(function(){return p})),a.d(t,"default",(function(){return O}));var r=a(2),n=a(6),b=(a(0),a(142)),c=a(144),l={id:"introduce",title:"1.1 \u4ecb\u7ecd",sidebar_label:"1.1 \u4ecb\u7ecd",slug:"/"},i={unversionedId:"introduce",id:"introduce",isDocsHomePage:!1,title:"1.1 \u4ecb\u7ecd",description:" Blog | Fur - + @@ -18,14 +18,14 @@ - +

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/handbook/build/blog/tags/fur/index.html b/handbook/build/blog/tags/fur/index.html index 70e75af1ca4..7c4d0553c5c 100644 --- a/handbook/build/blog/tags/fur/index.html +++ b/handbook/build/blog/tags/fur/index.html @@ -6,7 +6,7 @@ Posts tagged "fur" | Fur - + @@ -18,14 +18,14 @@ - +

1 post tagged with "fur"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/handbook/build/blog/tags/furos/index.html b/handbook/build/blog/tags/furos/index.html index 65dac264135..d033b0d7cbb 100644 --- a/handbook/build/blog/tags/furos/index.html +++ b/handbook/build/blog/tags/furos/index.html @@ -6,7 +6,7 @@ Posts tagged "furos" | Fur - + @@ -18,14 +18,14 @@ - +

1 post tagged with "furos"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/handbook/build/blog/tags/index.html b/handbook/build/blog/tags/index.html index 454d24e6da6..b1077d6ae0a 100644 --- a/handbook/build/blog/tags/index.html +++ b/handbook/build/blog/tags/index.html @@ -6,7 +6,7 @@ Tags | Fur - + @@ -23,7 +23,7 @@ - + diff --git a/handbook/build/blog/tags/net-5/index.html b/handbook/build/blog/tags/net-5/index.html index 8197ad2278d..71540a442a1 100644 --- a/handbook/build/blog/tags/net-5/index.html +++ b/handbook/build/blog/tags/net-5/index.html @@ -6,7 +6,7 @@ Posts tagged ".net5" | Fur - + @@ -18,14 +18,14 @@ - +

1 post tagged with ".net5"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/handbook/build/blog/tags/net/index.html b/handbook/build/blog/tags/net/index.html index 7d12b1b0570..d115c19e2be 100644 --- a/handbook/build/blog/tags/net/index.html +++ b/handbook/build/blog/tags/net/index.html @@ -6,7 +6,7 @@ Posts tagged ".net" | Fur - + @@ -18,14 +18,14 @@ - +

1 post tagged with ".net"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/handbook/build/blog/tags/netcore/index.html b/handbook/build/blog/tags/netcore/index.html index 422481f8894..bdcfae5689b 100644 --- a/handbook/build/blog/tags/netcore/index.html +++ b/handbook/build/blog/tags/netcore/index.html @@ -6,7 +6,7 @@ Posts tagged ".netcore" | Fur - + @@ -18,14 +18,14 @@ - +

1 post tagged with ".netcore"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

- + @@ -37,7 +37,7 @@ - + \ No newline at end of file diff --git a/handbook/build/blog/welcome/index.html b/handbook/build/blog/welcome/index.html index 51b9f35ec52..a4519f6ab69 100644 --- a/handbook/build/blog/welcome/index.html +++ b/handbook/build/blog/welcome/index.html @@ -6,7 +6,7 @@ Fur 介绍 | Fur - + @@ -18,13 +18,13 @@ - +
-

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.34
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-rc.final.34 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.34

🍎 框架特点

  • 全新面貌:基于 .NET 5 平台,没有历史包袱
  • 极易入门:只需要一个 Inject() 即可完成配置
  • 极速开发:内置丰富的企业应用开发功能
  • 极少依赖:框架只依赖三个第三方包
  • 极其灵活:轻松面对多变复杂的需求
  • 极易维护:采用独特的架构思想,只为长久维护设计
  • 完整文档:提供完善的开发文档

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司
  • 上海奥达科股份有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...
😤 好人!10Nice 的小僧,我们的 dotnetchina 马上火起来了
😮 木木 Woody10感谢您的开源项目!
😚 Joker HouQQ 超级会员一个月
🤠 ccdfzQQ 专属红包 199
🌝 天夫李总支付宝 6666Fur 非常有意思,持续关注
😝 六尘子微信红包 199公司已经使用,小小敬意

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor 👉 IoTSharp

+

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.50
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-rc.final.50 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.50

🥜 Fur 官方包

包类型名称版本描述
nugetFurv1.0.0-rc.final.50Fur 总包
nugetFur.Extras.Authentication.JwtBearerv1.0.0-rc.final.50Fur Jwt 拓展包

🍎 框架特点

  • 全新面貌:基于 .NET 5 平台,没有历史包袱
  • 极易入门:只需要一个 Inject() 即可完成配置
  • 极速开发:内置丰富的企业应用开发功能
  • 极少依赖:框架只依赖三个第三方包
  • 极其灵活:轻松面对多变复杂的需求
  • 极易维护:采用独特的架构思想,只为长久维护设计
  • 完整文档:提供完善的开发文档

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司
  • 上海奥达科股份有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...
😤 好人!10Nice 的小僧,我们的 dotnetchina 马上火起来了
😮 木木 Woody10感谢您的开源项目!
😚 Joker HouQQ 超级会员一个月
🤠 ccdfzQQ 专属红包 199
🌝 天夫李总支付宝 6666Fur 非常有意思,持续关注
😝 六尘子微信红包 199公司已经使用,小小敬意

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor 👉 IoTSharp

- + @@ -36,6 +36,6 @@ - + \ No newline at end of file diff --git a/handbook/build/d3c206bc.abf6b267.js b/handbook/build/d3c206bc.abf6b267.js new file mode 100644 index 00000000000..80c04d5f671 --- /dev/null +++ b/handbook/build/d3c206bc.abf6b267.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[65],{119:function(e,t,r){"use strict";r.r(t),r.d(t,"frontMatter",(function(){return b})),r.d(t,"metadata",(function(){return i})),r.d(t,"rightToc",(function(){return u})),r.d(t,"default",(function(){return p}));var n=r(2),a=r(6),o=(r(0),r(142)),c=r(144),b={slug:"welcome",title:"Fur \u4ecb\u7ecd",author:"dotnet\u4e2d\u56fd",author_title:"\u4e3a\u4e2d\u56fd .NET \u5f00\u53d1\u8005\u63d0\u4f9b\u4f18\u8d28\u7684\u8d44\u8baf\u548c\u6280\u672f\u5206\u4eab\u3002",author_url:"https://chinadot.net",author_image_url:"https://i.loli.net/2020/10/01/94AxjHp21aPKQWd.png",tags:["fur","furos",".net",".netcore",".net5"]},i={permalink:"/fur/blog/welcome",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/blog/2020-08-19-welcome.mdx",source:"@site/blog\\2020-08-19-welcome.mdx",description:"=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var u=a.a.createContext({}),l=function(e){var t=a.a.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):b(b({},t),e)),r},p=function(e){var t=l(e.components);return a.a.createElement(u.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},m=a.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,c=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=l(r),m=n,O=p["".concat(c,".").concat(m)]||p[m]||s[m]||o;return r?a.a.createElement(O,b(b({ref:t},u),{},{components:r})):a.a.createElement(O,b({ref:t},u))}));function O(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,c=new Array(o);c[0]=m;var b={};for(var i in t)hasOwnProperty.call(t,i)&&(b[i]=t[i]);b.originalType=e,b.mdxType="string"==typeof e?e:n,c[1]=b;for(var u=2;ufunction(e,t,r,{forcePrependBaseUrl:n=!1,absolute:o=!1}={}){if(!r)return r;if(r.startsWith("#"))return r;if(Object(a.b)(r))return r;if(n)return t+r;const c=r.startsWith(t)?r:t+r.replace(/^\//,"");return o?e+c:c}(t,e,r,n)}}function c(e,t={}){const{withBaseUrl:r}=o();return r(e,t)}},145:function(e,t,r){"use strict";function n(e){return!0===/^(\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!n(e)}r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return a}))}}]); \ No newline at end of file diff --git a/handbook/build/d3c206bc.ae827c12.js b/handbook/build/d3c206bc.ae827c12.js deleted file mode 100644 index 3fa55d1863c..00000000000 --- a/handbook/build/d3c206bc.ae827c12.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[65],{119:function(e,t,r){"use strict";r.r(t),r.d(t,"frontMatter",(function(){return b})),r.d(t,"metadata",(function(){return i})),r.d(t,"rightToc",(function(){return u})),r.d(t,"default",(function(){return p}));var n=r(2),a=r(6),o=(r(0),r(142)),c=r(144),b={slug:"welcome",title:"Fur \u4ecb\u7ecd",author:"dotnet\u4e2d\u56fd",author_title:"\u4e3a\u4e2d\u56fd .NET \u5f00\u53d1\u8005\u63d0\u4f9b\u4f18\u8d28\u7684\u8d44\u8baf\u548c\u6280\u672f\u5206\u4eab\u3002",author_url:"https://chinadot.net",author_image_url:"https://i.loli.net/2020/10/01/94AxjHp21aPKQWd.png",tags:["fur","furos",".net",".netcore",".net5"]},i={permalink:"/fur/blog/welcome",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/blog/2020-08-19-welcome.mdx",source:"@site/blog\\2020-08-19-welcome.mdx",description:"=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var u=a.a.createContext({}),l=function(e){var t=a.a.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):b(b({},t),e)),r},p=function(e){var t=l(e.components);return a.a.createElement(u.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},m=a.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,c=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),p=l(r),m=n,O=p["".concat(c,".").concat(m)]||p[m]||s[m]||o;return r?a.a.createElement(O,b(b({ref:t},u),{},{components:r})):a.a.createElement(O,b({ref:t},u))}));function O(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,c=new Array(o);c[0]=m;var b={};for(var i in t)hasOwnProperty.call(t,i)&&(b[i]=t[i]);b.originalType=e,b.mdxType="string"==typeof e?e:n,c[1]=b;for(var u=2;ufunction(e,t,r,{forcePrependBaseUrl:n=!1,absolute:o=!1}={}){if(!r)return r;if(r.startsWith("#"))return r;if(Object(a.b)(r))return r;if(n)return t+r;const c=r.startsWith(t)?r:t+r.replace(/^\//,"");return o?e+c:c}(t,e,r,n)}}function c(e,t={}){const{withBaseUrl:r}=o();return r(e,t)}},145:function(e,t,r){"use strict";function n(e){return!0===/^(\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!n(e)}r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return a}))}}]); \ No newline at end of file diff --git a/handbook/build/docs/answer/index.html b/handbook/build/docs/answer/index.html index 4d03c056a16..c53be523ebd 100644 --- a/handbook/build/docs/answer/index.html +++ b/handbook/build/docs/answer/index.html @@ -6,7 +6,7 @@ 29.1 常见问题 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/appstartup/index.html b/handbook/build/docs/appstartup/index.html index 35146e917de..2dbddecd7a7 100644 --- a/handbook/build/docs/appstartup/index.html +++ b/handbook/build/docs/appstartup/index.html @@ -6,7 +6,7 @@ 3. 应用启动 | Fur - + @@ -53,7 +53,7 @@
namespace Fur.Web.Entry
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
}
}
}
Startup.cs 代码迁移

只需要将 ConfigureServicesConfigure 方法代码迁移到 FurWebCoreStartup.cs 中即可,而 Startup.cs 中两个方法留空即可。

非常简单吧。我们后续创建任何 MVCRazorPagesBlazor 项目只需要添加 Fur.Web.Core 引用和调用 Inject() 即可。

3.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/auth-control/index.html b/handbook/build/docs/auth-control/index.html index 4e2f580811e..43f5f51b029 100644 --- a/handbook/build/docs/auth-control/index.html +++ b/handbook/build/docs/auth-control/index.html @@ -6,7 +6,7 @@ 14. 安全鉴权 | Fur - + @@ -27,7 +27,7 @@

14. 安全鉴权

14.1 什么是鉴权

鉴权实际上就是一种身份认证

由用户提供凭据,然后将其与存储在操作系统、数据库、应用或资源中的凭据进行比较。 在授权过程中,如果凭据匹配,则用户身份验证成功,可执行已向其授权的操作。 授权指判断允许用户执行的操作的过程。 也可以将身份验证理解为进入空间(例如服务器、数据库、应用或资源)的一种方式,而授权是用户可以对该空间(服务器、数据库或应用)内的哪些对象执行哪些操作。

14.1.1 常见的鉴权方式

  • HTTP Basic Authentication

这是 HTTP 协议实现的基本认证方式,我们在浏览网页时,从浏览器正上方弹出的对话框要求我们输入账号密码,正是使用了这种认证方式

  • Session + Cookie

利用服务器端的 session(会话)和浏览器端的 cookie 来实现前后端的认证,由于 http 请求时是无状态的,服务器正常情况下是不知道当前请求之前有没有来过,这个时候我们如果要记录状态,就需要在服务器端创建一个会话(seesion),将同一个客户端的请求都维护在各自得会会话中,每当请求到达服务器端的时候,先去查一下该客户端有没有在服务器端创建 seesion,如果有则已经认证成功了,否则就没有认证。

  • Token

客户端在首次登陆以后,服务端再次接收 HTTP 请求的时候,就只认 Token 了,请求只要每次把 Token 带上就行了,服务器端会拦截所有的请求,然后校验 Token 的合法性,合法就放行,不合法就返回 401(鉴权失败)

Token验证比较灵活,适用于大部分场景。常用的 Token 鉴权方式的解决方案是 JWTJWT 是通过对带有相关用户信息的进行加密,加密的方式比较灵活,可以根据需求具体设计。

  • OAuth

OAuth(开放授权)是一个开放标准,允许用户授权第三方网站访问他们存储在另外的服务提供者上的信息,而不需要将用户名和密码提供给第三方网站或分享他们数据的所有内容,为了保护用户数据的安全和隐私,第三方网站访问用户数据前都需要显式的向用户征求授权。我们常见的提供 OAuth 认证服务的厂商有支付宝,QQ,微信。

OAuth 协议又有 1.0 和 2.0 两个版本。相比较 1.0 版,2.0 版整个授权验证流程更简单更安全,也是目前最主要的用户身份验证和授权方式。

14.2 如何使用

- + diff --git a/handbook/build/docs/author/index.html b/handbook/build/docs/author/index.html index 0abef4fc688..cc9e683076a 100644 --- a/handbook/build/docs/author/index.html +++ b/handbook/build/docs/author/index.html @@ -6,7 +6,7 @@ 1.2 关于作者 | Fur - + @@ -26,7 +26,7 @@

1.2 关于作者

互联网账号

  • 百小僧
  • Monk/MonkSoul

技术能力

自 2008 年 接触 IT 这个行业也有十余年了,在 后端(.NET/.NET Core/Java/PHP)、移动端(Xamarin/小程序/Java/Objective-C)、桌面端(WinForm/WPF/Electron)、前端(React/Vue/Angular/Node)等主流领域略知一二。

同时在技术培训领域也多有涉足。

职业情况

目前经营一家自己创办的软件科技公司,主要销售自主研发的 ERP 产品。

吃不起饭的时候也会接外包项目。

兴趣爱好

是个吃货,喜欢看抖音,看动漫,看美剧,看博客园、看开源中国。

对新技术颇感兴趣,喜欢开源事业,喜欢分享技术。

个人主页

https://gitee.com/monksoul

https://github.com/monksoul

- + diff --git a/handbook/build/docs/cache/index.html b/handbook/build/docs/cache/index.html index f12b30f6096..eb9fc9cfe20 100644 --- a/handbook/build/docs/cache/index.html +++ b/handbook/build/docs/cache/index.html @@ -6,7 +6,7 @@ 13. 分布式缓存 | Fur - + @@ -46,7 +46,7 @@
await _cache.SetAsync("cachedTimeUTC", encodedCurrentTimeUTC, options);
return RedirectToPage();
}
}

13.6 分布式缓存建议

确定 IDistributedCache 最适合你的应用的实现时,请考虑以下事项:

  • 现有基础结构
  • 性能要求
  • 成本
  • 团队经验

缓存解决方案通常依赖于内存中的存储以快速检索缓存的数据,但是,内存是有限的资源,并且很昂贵。 仅将常用数据存储在缓存中。

通常,Redis 缓存提供比 SQL Server 缓存更高的吞吐量和更低的延迟。 但是,通常需要进行基准测试来确定缓存策略的性能特征。

SQL Server 用作分布式缓存后备存储时,对缓存使用同一数据库,并且应用的普通数据存储和检索会对这两种情况的性能产生负面影响。 建议使用分布式缓存后备存储的专用 SQL Server 实例。

13.7 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 分布式缓存 知识可查阅 ASP.NET Core - 分布式缓存 章节。

- + diff --git a/handbook/build/docs/configuration/index.html b/handbook/build/docs/configuration/index.html index 1f4ee21a0aa..730e45f69c1 100644 --- a/handbook/build/docs/configuration/index.html +++ b/handbook/build/docs/configuration/index.html @@ -6,7 +6,7 @@ 4.1 配置 | Fur - + @@ -27,7 +27,7 @@

4.1 配置

温馨提示

推荐使用 《4.2 选项》代替本章节功能。(为什么)?

4.1.1 什么是配置

简单来说,配置将系统应用可动态调配的选项放在统一地方管理,通过不同的配置让系统做出动态调整。

ASP.NET Core 应用程序启动时默认加载 启动项目 下的 appsettings.json 作为应用配置。同时还支持不同的运行环境加载对应的配置文件,如:

  • Development:加载 appsettings.Development.json
  • Staging:加载 appsettings.Staging.json
  • {Environment}appsettings.{Environment}.json

4.1.2 配置的使用

假设我们需要在系统运行时获取系统名称、版本号及版权信息,这些信息可能随时变化而且需要在多个地方使用。这时就需要将这些信息配置起来。具体步骤如下:

4.1.2.1 配置 appsettings.json 信息

{
"AppInfo": {
"Name": "Fur",
"Version": "1.0.0",
"Company": "Baiqian"
}
}
特别注意

appsettings.json 复制输出目录为如果较新则复制,生成操作为:内容

4.1.2.2 读取 appsettings.json 信息

Fur 框架中,提供了两种读取方式:

  • 依赖注入 IConfiguration 对象读取
  • 通过 App.Configuration[jsonKey] 读取
using Microsoft.AspNetCore.Mvc;
namespace Fur.Web.Entry.Controllers
{
[Route("api/[controller]")]
public class DefaultController : ControllerBase
{
[HttpGet]
public string Get()
{
return $@"名称:{App.Configuration["AppInfo:Name"]},
版本:{App.Configuration["AppInfo:Version"]},
公司:{App.Configuration["AppInfo:Company"]}";
}
}
}
依赖注入的方式

通过依赖注入注入实例有几种方式:

  • 构造函数注入方式
private readonly IConfiguration _configuration;
public DefaultController(IConfiguration configuration)
{
_configuration = configuration;
}
  • 参数注入方式 [FromServices]
public string Get([FromServices] IConfiguration configuration)
{
}
  • 属性注入方式
public IConfiguration Configuration { get; set; }

想了解更多关于《ASP.NET Core - 依赖注入》 知识

4.1.2.3 如何选择读取方式

  • 在可依赖注入类中,依赖注入 IConfiguration 读取
  • 在静态类/非依赖注入类中,选择 App.Configuration[jsonKey] 读取

4.1.3 路径符 查找节点

ASP.NET Core 中,配置采用 : 分隔符来读取分层配置数据。如上述例子中的 AppInfo:Name。如有更多层级数据则只需要通过 : 进入下一层节点即可。

假设我们有以下配置信息:

{
"AppInfo": {
"Name": "Fur",
"Version": "1.0.0",
"Company": {
"Name": "Baiqian",
"Address": {
"City": "中国",
"Province": "广东省",
"Detail": "中山市东区紫马公园西门"
}
}
}
}
var companyName = App.Configuration["AppInfo:Name"]; // => Fur

4.1.4 自定义配置文件

大多情况下,我们的配置只需要在 appsettings.json 中配置即可,但一些特殊情况下,我们希望某些组件或功能拥有独立的配置,这个时候就需要用到自定义配置,Fur 目前支持 .json.xml 两种方式配置,如:

Fur.Web.Entry/emailsetting.json
{
"outlook": {
"smtp": {
"server": "smtp.office365.com",
"port": "587",
"ssl": "STARTTLS"
},
"pop": {
"server": "outlook.office365.com",
"port": "995",
"ssl": "TLS"
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<MyKey>MyXMLFile Value</MyKey>
<Position>
<Title>Title from MyXMLFile</Title>
<Name>Name from MyXMLFile</Name>
</Position>
<Logging>
<LogLevel>
<Default>Information</Default>
<Microsoft>Warning</Microsoft>
</LogLevel>
</Logging>
</configuration>
xml 配置事项

如果采用 xml 配置,那么文件名必须以 .config.xml 结尾(不区分大小写)。

同时 Fur 提供了非常灵活的方式支持自定义配置文件读取,如:

4.1.4.1 读取 emailsetting.json 配置

读取自定义配置文件和读取 appsettings.json 一致,系统会自动从多个配置文件中读取输入,如:

var smtpServer = App.Configuration["outlook:smtp:server"]; // => smtp.office365.com
特别说明

Fur 框架会在启动时自动扫描每一个项目层根目录下的 *.json*.xml 文件加入配置中,所以无需手工配置。新增*.json*.xml 文件的属性复制到输出目录设置为始终复制,否则会扫描不到。

另外在 类库 项目中,不能起名和 启动项目 一样的配置文件名,不然会相互覆盖。

4.1.5 不同环境读取

在实际应用开发中,我们可能会根据不同的环境加载不同的配置文件,如 数据库连接字符串

这时我们只需要遵循特定命名规范 {name}.{Environment}.json 即可。如:

  • appsettings.Development.json
  • appsettings.Staging.json
  • appsettings.Production.json
  • emailsetting.Development.json
  • emailsetting.Staging.json
  • emailsetting.Production.json

这时,ASP.NET Core 会在应用启动时自动加载不同环境的配置文件。

4.1.6 配置更改通知(热更新

.NET Core 应用程序中,配置支持更改通知,也就是热更新操作。一旦监听到 appsetting.json 或自定义配置文件发生变动,就会触发 OnChange 方法。代码如下:

var appInfoConfiguration = App.Configuration["AppInfo"];
ChangeToken.OnChange(() => appInfoConfiguration.GetReloadToken(), () =>
{
var name = appInfoConfiguration["Name"]; // 实时的最新值
var version = appInfoConfiguration["Version"]; // 实时的最新值
});

4.1.7 配置的优缺点

  • 优点

    • 能够在系统运行时快速读取
    • 无需额外配置
  • 缺点

    • 存在重复读取
    • 通过硬编码字符串读取,容易出错
    • 不能设置默认值
    • 不能在运行环境中动态配置
    • 不能验证配置有效性
    • 不支持更改通知

4.1.8 配置使用场景

如果只需要一次性读取配置信息,则使用配置,否则应该使用 《4.2 选项》代替。

4.1.9 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 配置 知识可查阅 ASP.NET Core - 配置 章节。

- + diff --git a/handbook/build/docs/contribute/index.html b/handbook/build/docs/contribute/index.html index 683a424a988..e2dcb5dfe87 100644 --- a/handbook/build/docs/contribute/index.html +++ b/handbook/build/docs/contribute/index.html @@ -6,7 +6,7 @@ 28. 贡献指南 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/cors/index.html b/handbook/build/docs/cors/index.html index 764404b719b..e00583c13ae 100644 --- a/handbook/build/docs/cors/index.html +++ b/handbook/build/docs/cors/index.html @@ -6,7 +6,7 @@ 15. CORS 跨域 | Fur - + @@ -31,7 +31,7 @@
app.UseCorsAccessor();
// ...
}
}
}
特别注意

services.AddCorsAccessor(); 需在 services.AddControllers() 之前注册。

app.UseCorsAccessor(); 需在 app.UseRouting();app.UseAuthentication(); 之间注册。

15.4.2 配置允许跨域域名

注册 CorsAccessor 服务之后需要配置运行跨域的域名或请求方式,如:

{
"CorsAccessorSettings": {
"PolicyName": "自定义跨域策略名",
"WithOrigins": ["http://localhost:4200", "https://chinadot.net"]
}
}

15.5 CorsAccessorSettings 配置

  • CorsAccessorSettings
    • PolicyName:跨域策略名,字符串类型,必填,默认 FurCorsAccessor
    • WithOrigins:允许跨域的域名列表,字符串数组类型,默认 [ "http://localhost:4200" ]
    • WithHeaders:请求表头,没有配置则允许所有表头,字符串数组类型
    • WithExposedHeaders:响应标头,字符串数组类型
    • WithMethods:设置跨域允许请求谓词,没有配置则允许所有,字符串数组类型
    • AllowCredentials:跨域请求中的凭据,bool 类型
    • SetPreflightMaxAge:设置预检过期时间,int 类型

15.6 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 跨域请求 知识可查阅 ASP.NET Core - 启用跨域请求 章节。

- + diff --git a/handbook/build/docs/data-validation/index.html b/handbook/build/docs/data-validation/index.html index b65c374265d..8da38e50a56 100644 --- a/handbook/build/docs/data-validation/index.html +++ b/handbook/build/docs/data-validation/index.html @@ -6,7 +6,7 @@ 8. 数据校验 | Fur - + @@ -74,7 +74,7 @@
namespace Fur.Application
{
public class FurAppService : IDynamicApiController
{
[TypeFilter(typeof(DataValidationFilter))]
public TestDto Post(TestDto testDto)
{
return testDto;
}
}
}

8.9.4 [ApiController] 控制器范围验证

[ApiController]Mvc 提供的控制器范围(含所有动作方法)的验证。

using Microsoft.AspNetCore.Mvc;
namespace Fur.Web.Entry.Controllers
{
[ApiController]
public class MvcController : Controller
{
public IActionResult Index()
{
return View();
}
}
}

8.10 MiniProfiler 查看

如下图所示:

8.10 多语言支持

文档整理中...

8.11 验证模型提供器

文档整理中...

8.12 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-Interceptor/index.html b/handbook/build/docs/dbcontext-Interceptor/index.html index 5a8a14d73b3..793b50d034c 100644 --- a/handbook/build/docs/dbcontext-Interceptor/index.html +++ b/handbook/build/docs/dbcontext-Interceptor/index.html @@ -6,7 +6,7 @@ 9.24 数据库操作拦截器 | Fur - + @@ -59,7 +59,7 @@
// 提交数据库失败
public override void SaveChangesFailed(DbContextErrorEventData eventData)
{
base.SaveChangesFailed(eventData);
}
// 提交数据库失败(异步)
public override Task SaveChangesFailedAsync(DbContextErrorEventData eventData, CancellationToken cancellationToken = default)
{
return base.SaveChangesFailedAsync(eventData, cancellationToken);
}
}
}

9.24.2.4 SavedChangesEvent 拦截

Fur 框架中为所有 AppDbContext 子类都提供了三个可重写的方法,这三个方法分别由三个事件触发:

  • 提交更改之前 SavingChanges 事件:触发 void SavingChangesEvent(object sender, SavingChangesEventArgs e) 方法
  • 提交更改之后 SavedChanges 事件:触发 void SavedChangesEvent(object sender, SavedChangesEventArgs e) 方法
  • 提交更改失败 SaveChangesFailed 事件:触发 void SaveChangesFailedEvent(object sender, SaveChangesFailedEventArgs e) 方法

通过这三个事件我们可以在数据库做增、删、改时候做拦截,比如设置创建时间、更新时间或其他默认操作

如自动添加租户Id:

protected override void SavingChangesEvent(object sender, SavingChangesEventArgs e)
{
// 获取当前事件对应上下文
var dbContext = sender as FurDbContext;
// 获取所有新增和更新的实体
var entities = dbContext.ChangeTracker.Entries()
.Where(u => u.State == EntityState.Added || u.State == EntityState.Modified);
foreach (var entity in entities)
{
switch (entity.State)
{
// 自动设置租户Id
case EntityState.Added:
entity.Property(nameof(Entity.TenantId)).CurrentValue = GetTenantId();
break;
// 排除租户Id
case EntityState.Modified:
entity.Property(nameof(Entity.TenantId)).IsModified = false;
break;
}
}
}

9.24.3 注册自定义过滤器

定义好过滤器之后,我们需要在数据库上下文中注册:

services.AddSqlitePool<FurDbContext>(interceptors: new IInterceptor[] {
new SqlConnectionProfilerInterceptor(),
new DbContextSaveChangesInterceptor(),
new SqlCommandProfilerInterceptor()
});

9.24.4 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-add-or-update/index.html b/handbook/build/docs/dbcontext-add-or-update/index.html index 52d335ae096..6e553b09ecc 100644 --- a/handbook/build/docs/dbcontext-add-or-update/index.html +++ b/handbook/build/docs/dbcontext-add-or-update/index.html @@ -6,7 +6,7 @@ 9.7 新增或更新操作 | Fur - + @@ -104,7 +104,7 @@
// 示例七
await user.InsertOrUpdateExcludeNowAsync(new[] { u=>u.Name, u=>u.Age});
// 示例八
await user.InsertOrUpdateExcludeNowAsync(new[] {"Age", "Name"});

9.5.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-add/index.html b/handbook/build/docs/dbcontext-add/index.html index 51c7d7545c0..224bdb2832f 100644 --- a/handbook/build/docs/dbcontext-add/index.html +++ b/handbook/build/docs/dbcontext-add/index.html @@ -6,7 +6,7 @@ 9.5 新增操作 | Fur - + @@ -55,7 +55,7 @@
// 示例二
await repository.InsertNowAsync(new List<User> { user, user2 });
// 示例三
await repository.InsertNowAsync(new[] {user, user2 });
小知识

所有带 Now 结尾的表示立即提交到数据库,也就是立即调用 SaveChangesSaveChangesAsync

9.5.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-audit/index.html b/handbook/build/docs/dbcontext-audit/index.html index 2f4a178e512..941d5f20379 100644 --- a/handbook/build/docs/dbcontext-audit/index.html +++ b/handbook/build/docs/dbcontext-audit/index.html @@ -6,7 +6,7 @@ 9.22 审计日志 | Fur - + @@ -39,7 +39,7 @@
object oldValue = null;
// 如果是新增数据,则 databaseValues 为空,所以需要判断一下
if (databaseValues != null)
{
oldValue = databaseValues[propName];
}
// 插入审计日志表
dbContext.Audits.Add(new Audit
{
Table = entityType.Name, // 表名
Column = propName, // 更新的列
NewValue = newValue, // 新值
OldValue = oldValue, // 旧值
CreatedTime = DateTime.Now, // 操作时间
UserId = userId, // 操作人
Operate = entity.State.ToString(); // 操作方式:新增、更新、删除
});
}
}
}
}
}
小知识

如果对性能有所要求,那么建议审计日志通过 日志组件 写入数据库,如,通过 Nlog、Log4Net 这些等:

// 插入审计日志表
dbContext.Audits.Add(new Audit
{
Table = entityType.Name, // 表名
Column = propName, // 更新的列
newValue = newValue, // 新值
OldValue = oldValue, // 旧值
CreatedTime = DateTime.Now, // 操作时间
UserId = userId, // 操作人
Operate = entity.State.ToString(); // 操作方式:新增、更新、删除
});

替换为:

logger.Information(JsonConvert.SerializeObject(new Audit
{
Table = entityType.Name, // 表名
Column = propName, // 更新的列
newValue = newValue, // 新值
OldValue = oldValue, // 旧值
CreatedTime = DateTime.Now, // 操作时间
UserId = userId, // 操作人
Operate = entity.State.ToString(); // 操作方式:新增、更新、删除
}));

通过上面的例子,我们就可以对数据库所有的新增、更新、删除进行监控了。

9.22.4 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-batch/index.html b/handbook/build/docs/dbcontext-batch/index.html index 5e83bdd1d9f..ffcfee41e67 100644 --- a/handbook/build/docs/dbcontext-batch/index.html +++ b/handbook/build/docs/dbcontext-batch/index.html @@ -6,7 +6,7 @@ 9.9 批量操作 | Fur - + @@ -34,7 +34,7 @@
// 根据条件批量更新
repository.Where(a => a.ItemId <= 500).BatchUpdate(a => new Item { Quantity = a.Quantity + 100 });
repository.Where(a => a.ItemId <= 500).BatchUpdate(new Item { Description = "Updated" });
await repository.Where(a => a.ItemId <= 500).BatchUpdateAsync(new Item { Description = "Updated" });
// 批量更新指定列
var updateColumns = new List<string> { nameof(Item.Quantity) };
var q = repository.Where(a => a.ItemId <= 500);
int affected = q.BatchUpdate(new Item { Description = "Updated" }, updateColumns);

9.9.3 批量操作性能

Operations\Rows100,000 EF100,000 EFBulk1,000,000 EFBulk
Insert38.98 s2.10 s17.99 s
Update109.25 s3.96 s31.45 s
Delete7.26 s2.04 s12.18 s
---------------------------------------------------------------
Together70.70 s5.88 s56.84 s

9.9.4 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 EFCore.BulkExtensions 知识可查阅 EFCore.BulkExtensions 开源仓库

- + diff --git a/handbook/build/docs/dbcontext-code-first/index.html b/handbook/build/docs/dbcontext-code-first/index.html index e4c90808964..8f369fc7476 100644 --- a/handbook/build/docs/dbcontext-code-first/index.html +++ b/handbook/build/docs/dbcontext-code-first/index.html @@ -6,7 +6,7 @@ 9.20 模型生成数据库 | Fur - + @@ -30,7 +30,7 @@
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// 住址
/// </summary>
public string Address { get; set; }
}
}
实体约定

所有数据库实体必须直接或间接继承 IEntity 接口。

9.20.2.2 打开 程序包管理控制台

9.20.2.3 切换默认项目

程序包管理控制台 默认项目设置为 Fur.Database.Migrations

9.20.2.4 创建模型版本

Add-Migration v1.0.0
特别说明

v1.0.0 是此处数据库更改的版本号,可以写任何字符串,但推荐写版本号,每次 +1

最终命令如下:

PM> Add-Migration v1.0.0
Build started...
Build succeeded.
Microsoft.EntityFrameworkCore.Model.Validation[10400]
Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data, this mode should only be enabled during development.
Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 5.0.0-rc.1.20451.13 initialized 'FurDbContext' using provider 'Microsoft.EntityFrameworkCore.Sqlite' with options: SensitiveDataLoggingEnabled DetailedErrorsEnabled MaxPoolSize=100 MigrationsAssembly=Fur.Database.Migrations
To undo this action, use Remove-Migration.
PM>

生成成功后,Fur.Database.Migrations 项目下会新增 Migrations 文件夹(如果没有),同时本次的架构生成文件,如:

9.20.2.5 更新到数据库

Update-Database

执行该命令后,数据库就会自动根据模型生成对于的表。

小知识

如果 Update-Database 后面带字符串参数,则会自动还原数据库到指定版本,如:

Update-Database v0.0.3

将数据库还原到 v0.0.3 版本

9.20.3 更新模型

如果模型改变了,重复上面操作即可,如:

Add-Migration v1.0.1
Update-Database

9.20.4 导出 Sql

有些时候,我们没有直接更新数据库的权限,或者怕出问题,我们都会先生成 Sql 看看,这时候只需要通过 Script-Migration 导出即可,如:

Script-Migration

9.20.5 VS Code 方式

9.20.5.1 安装 dotnet ef

dotnet tool install --global dotnet-ef --version 5.0.0-rc.2.20475.6

9.20.5.2 cd 目录

通过 VS Code 打开 .sln 所在的目录,如:framework

之后进入 Fur.Database.Migrations 目录

cd Fur.Database.Migrations

9.20.5.3 执行命令

dotnet ef migrations add v1.0.0 -s "../Fur.Web.Entry"
dotnet ef database update -s "../Fur.Web.Entry"

9.20.6 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 正向工厂 知识可查阅 EF Core - 管理数据库架构 章节。

- + diff --git a/handbook/build/docs/dbcontext-db-first/index.html b/handbook/build/docs/dbcontext-db-first/index.html index c674ce7d4a5..e33baa9b226 100644 --- a/handbook/build/docs/dbcontext-db-first/index.html +++ b/handbook/build/docs/dbcontext-db-first/index.html @@ -6,7 +6,7 @@ 9.19 数据库生成模型 | Fur - + @@ -63,7 +63,7 @@
}
}
Fur Tools v1.0.0 全部实体生成成功!
PM>

9.13.4 命令参数配置

Fur Tools Cli 支持多个参数配置,使用方法只需要在命令后面添加即可,如:

&"../tools/cli.ps1" -Context 数据库上下文名 -ConnectionName 连接字符串Key

支持参数如下:

  • -Tables:配置要生成的数据库表,数组类型,如果为空,则生成数据库所有表和视图。如:-Tables Person,PersonDetails
  • -Context:配置数据库上下文,默认 FurDbContext,如果有多个数据库上下文,则此参数必须配置
  • -ConnectionName:配置数据库连接字符串,对于 appsetting.json 中的 Key
  • -OutputDir:生成实体代码输出目录,默认为:./Fur.Core/Entities/
  • -DbProvider:数据库提供器,默认是 Microsoft.EntityFrameworkCore.SqlServer,其他数据库请指定对应程序集
    • SqlServerMicrosoft.EntityFrameworkCore.SqlServer
    • SqliteMicrosoft.EntityFrameworkCore.Sqlite
    • CosmosMicrosoft.EntityFrameworkCore.Cosmos
    • InMemoryDatabaseMicrosoft.EntityFrameworkCore.InMemory
    • MySqlPomelo.EntityFrameworkCore.MySql
    • PostgreSQLNpgsql.EntityFrameworkCore.PostgreSQL
    • OracleCitms.EntityFrameworkCore.Oracle
    • DmMicrosoft.EntityFrameworkCore.Dm
  • -EntryProject:Web 启用项目层名,默认 Fur.Web.Entry
  • -CoreProject:实体项目层名,默认 Fur.Core
  • -DbContextLocators:多数据库上下文定位器,默认 MasterDbContextLocator,支持多个,如:MasterDbContextLocator,MySqlDbContextLocator
  • -Product:解决方案默认前缀,如 Fur
  • -UseDatabaseNames:是否保持生成和数据库、表一致的名称

9.13.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-delete/index.html b/handbook/build/docs/dbcontext-delete/index.html index aa0736eef89..3f7d6d6e048 100644 --- a/handbook/build/docs/dbcontext-delete/index.html +++ b/handbook/build/docs/dbcontext-delete/index.html @@ -6,7 +6,7 @@ 9.8 删除操作 | Fur - + @@ -71,7 +71,7 @@
// 示例五
await entity.FakeDeleteAsync();
// 示例六
await repository.UpdateIncludeAsync(user, u => u.IsDeleted);

9.8.9 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-filter/index.html b/handbook/build/docs/dbcontext-filter/index.html index 6e9f5006e91..a0066e8e5e3 100644 --- a/handbook/build/docs/dbcontext-filter/index.html +++ b/handbook/build/docs/dbcontext-filter/index.html @@ -6,7 +6,7 @@ 9.23 实体/全局查询筛选器 | Fur - + @@ -38,7 +38,7 @@
// 创建表达式元素
var parameter = Expression.Parameter(metadata.ClrType, "u");
var properyName = Expression.Constant(nameof(Entity.IsDeleted));
var propertyValue = Expression.Constant(false);
// 构建表达式 u => EF.Property<bool>(u, "IsDeleted") == false
var expressionBody = Expression.Equal(Expression.Call(typeof(EF), nameof(EF.Property), new[] { typeof(bool) }, parameter, properyName), propertyValue);
var expression = Expression.Lambda(expressionBody, parameter);
return expression;
}
}
}
小建议

如果对动态构建 LambdaExpression 不熟悉的朋友,可以使用 System.Linq.Dynamic.Corehttps://github.com/zzzprojects/System.Linq.Dynamic.Core

9.23.3 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-function/index.html b/handbook/build/docs/dbcontext-function/index.html index 20226e02e94..a58c57b0428 100644 --- a/handbook/build/docs/dbcontext-function/index.html +++ b/handbook/build/docs/dbcontext-function/index.html @@ -6,7 +6,7 @@ 9.14 函数操作 | Fur - + @@ -50,7 +50,7 @@
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity(typeof(F_Person)).HasNoKey();
modelBuilder.HasDbFunction(() => GetPersons(default));
}
}
}

9.14.5.4 在 Linq 中使用

IQueryable<F_Person> query = _repository.DynamicDbContext.GetPersons(1);
var result = query.Where(u => u.Name.Equals("Fur")).ToList();

最终生成 Sql

SELECT [g].Id, [g].Name, [g].Age, [g].Address
FROM dbo.GetPersons(1) AS [g]
WHERE [g].Name == N'Fur';

9.14.6 在 EF Core 内置函数

EF Core 为我们提供了很多常用的内置函数,可以在 Lambda 条件中使用,主要是通过 EF.Functions 调用,如:

_repository.Where(u => EF.Functions.DateDiffHour(u.CreatedDt, DateTime.Now) > 8).FirstOrDefault();

这个语句使用了 EF.Functions.DateDiffHour 最终生成的 Sql 如下:

SELECT TOP(1) [a].*
FROM [dbo].[TEST] AS [a]
WHERE DATEDIFF(HOUR, [a].[CREATED_DT], GETDATE()) > 8

EF Core 内置函数就不一一列出了,可以通过 EF.Functions 查看更多,如果不能满足自己的需求,那么可以自定义 Linq 标量函数

9.14.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-hight-query/index.html b/handbook/build/docs/dbcontext-hight-query/index.html index b33ce4c93ff..5f7a6b94052 100644 --- a/handbook/build/docs/dbcontext-hight-query/index.html +++ b/handbook/build/docs/dbcontext-hight-query/index.html @@ -6,7 +6,7 @@ 9.11 高级查询操作 | Fur - + @@ -57,7 +57,7 @@
namespace Fur.Core
{
public class Person : Entity, IEntityTypeBuilder<Person>
{
public string Name { get; set; }
/// <summary>
/// 配置实体关系
/// </summary>
/// <param name="entityBuilder"></param>
/// <param name="dbContext"></param>
/// <param name="dbContextLocator"></param>
public void Configure(EntityTypeBuilder<City> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.ToSqlQuery(
@"select * from dbo.person.2020-09-19
union all
select * from dbo.person.2020-09-20");
}
}
}
var posts = repository.Where(u => u.Id > 10).ToList();

9.11.12 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-locator/index.html b/handbook/build/docs/dbcontext-locator/index.html index e18416a525f..b5262bbcc71 100644 --- a/handbook/build/docs/dbcontext-locator/index.html +++ b/handbook/build/docs/dbcontext-locator/index.html @@ -6,7 +6,7 @@ 9.2 数据库上下文定位器 | Fur - + @@ -28,7 +28,7 @@
namespace Fur.Core
{
public sealed class FurDbContextLocator : IDbContextLocator
{
}
}

9.2.4 默认数据库上下文定位器

Fur 框架中已经提供了 MasterDbContextLocator 默认数据库上下文定位器,所以默认数据库上下文只需继承 AppDbContext<TDbContext> 即可。

AppDbContext<TDbContext> 定义代码如下:

using Fur.DependencyInjection;
using Microsoft.EntityFrameworkCore;
namespace Fur.DatabaseAccessor
{
/// <summary>
/// 默认应用数据库上下文
/// </summary>
/// <typeparam name="TDbContext">数据库上下文</typeparam>
[NonBeScan]
public abstract class AppDbContext<TDbContext> : AppDbContext<TDbContext, MasterDbContextLocator>
where TDbContext : DbContext
{
/// <summary>
/// 构造函数
/// </summary>
/// <param name="options"></param>
public AppDbContext(DbContextOptions<TDbContext> options) : base(options)
{
}
}
}

9.2.5 数据库上下文定位器支持对象

目前数据库上下文支持以下多个对象:

  • AppDbContext<TEntity, TDbContextLocator>:数据上下文
  • IRepository<TEntity, TDbContextLocator:实体仓储
  • ISqlRepository<TDbContextLocator>: Sql 操作仓储
  • Func<Type, DbContext>:依赖注入获取数据库上下文
  • Entity<Tkey, TDbContextLocator> :实体配置
  • EntityBase<Tkey, TDbContextLocator1, ... TDbContextLocator8>:实体配置
  • EntityNotKey<TDbContextLocator1, ... TDbContextLocator8>:无键实体配置
  • IEntitySeedData<TEntity, TDbContextLocator1, ... TDbContextLocator8>:种子数据配置
  • IEntityTypeBuilder<TEntity, TDbContextLocator1, ... TDbContextLocator8>:实体类型构建器
  • IModelBuilderFilter<TDbContextLocator1, ... TDbContextLocator8>:模型构建筛选器
  • [QueryableFunction(DbContextLocators=Type[])]:查询函数

9.2.6 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-multi-database/index.html b/handbook/build/docs/dbcontext-multi-database/index.html index a69f0c1b4ab..e5470030b24 100644 --- a/handbook/build/docs/dbcontext-multi-database/index.html +++ b/handbook/build/docs/dbcontext-multi-database/index.html @@ -6,7 +6,7 @@ 9.18 多数据库操作 | Fur - + @@ -43,7 +43,7 @@
// 支持一个数据库
public class Person: IEntity<MySqlDbContextLocator>
{
// ....
}
// 支持多个数据库
public class Person: IEntity<MySqlDbContextLocator, SqliteDbContextLocator>
{
// ....
}
小知识

所有的 实体依赖接口或抽象类 都支持泛型方式 指定 数据库上下文定位器,最多支持 8 个。

9.18.3.5 Linq 函数方式

public static class QueryFunctions
{
[QueryableFunction("FN_GetId", "dbo", typeof(MySqlDbContextLocator), typeof(SqliteDbContextLocator))]
public static int GetId(int id) => throw new NotSupportedException();
}

9.18.4 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-proc/index.html b/handbook/build/docs/dbcontext-proc/index.html index 731542a33c7..f7c5c749e1e 100644 --- a/handbook/build/docs/dbcontext-proc/index.html +++ b/handbook/build/docs/dbcontext-proc/index.html @@ -6,7 +6,7 @@ 9.13 存储过程操作 | Fur - + @@ -119,7 +119,7 @@
// 获取 RETURN 返回值
var reval = result.ReturnValue;
// 获取返回结果集
var (list1,list2) = result.Result;
关于异步

Fur 框架每一个数据库操作都支持异步方式,由于篇幅有限,就不列举异步方式了。

9.13.3 关于 [DbParameter]

[DbParameter] 特性是用来标注 Sql函数存储过程 参数的,可配置属性:

  • Direction:设置参数方向,ParameterDirection 枚举类型,默认 ParameterDirection.Input
  • DbType:设置参数类型,DbType 枚举类型,无默认
  • Size:设置参数长度的,int 类型

其中 Direction 属性是默认构造函数参数。

9.13.4 关于 ProcedureOutputResult

ProcedureOutputResultProcedureOutputResult<TResult> 是复杂存储过程执行返回模型类,有以下属性:

  • OutputValues:多个输出值,ProcedureOutputValue 类型
  • ReturnValue:返回值,object 类型
  • Result:结果集,非泛型版本是 DataSet类型,否则是 泛型类型

9.13.5 存储过程参数

所有 sql 参数都支持四种方式:

  • DbParameter[]:数组类型
  • new {}:匿名类型
  • new Class{}:强类型类型(支持复杂存储过程参数)
  • Dictionary<string,object> 类型

9.13.6 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-query/index.html b/handbook/build/docs/dbcontext-query/index.html index a58fa8cab41..3814995ee2e 100644 --- a/handbook/build/docs/dbcontext-query/index.html +++ b/handbook/build/docs/dbcontext-query/index.html @@ -6,7 +6,7 @@ 9.10 查询操作 | Fur - + @@ -138,7 +138,7 @@
// 示例二
_testRepository.Where(u => u.Name.EndWith("Fur"));
// 示例三
_testRepository.Where(u => u.Name.Contains("Fur"));

9.10.6.9 Case When

数据库中的 Case When 实际上对应的是我们程序中的 三元表达式 ,也就是使用 三元表达式 即可自动生成 Case When 语句。

9.10.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-read-write/index.html b/handbook/build/docs/dbcontext-read-write/index.html index 44d67685e1e..1fdac3d8bd4 100644 --- a/handbook/build/docs/dbcontext-read-write/index.html +++ b/handbook/build/docs/dbcontext-read-write/index.html @@ -6,7 +6,7 @@ 9.26 读写分离/主从复制 | Fur - + @@ -38,7 +38,7 @@
/// <summary>
/// 查询走从库
/// </summary>
/// <returns></returns>
public List<Person> Get()
{
return _msRepository.Slave1<Person>().AsEnumerable();
}
}
}

9.26.3 主从复制

主从复制:是一种数据备份的方案。

简单来说,是使用两个或两个以上相同的数据库,将一个数据库当做主数据库,而另一个数据库当做从数据库。在主数据库中进行相应操作时,从数据库记录下所有主数据库的操作,使其二者一模一样。

9.26.4 主从复制几种方式

9.26.4.1 同步复制

所谓的同步复制,意思是 Master 的变化,必须等待 Slave-1,Slave-2,...,Slave-n 完成后才能返回。 这样,显然不可取,比如,在 Web 前端页面上,用户增加了条记录,需要等待很长时间。

9.26.4.2 异步复制

如同 AJAX 请求一样。Master 只需要完成自己的数据库操作即可。至于 Slaves 是否收到二进制日志,是否完成操作,不用关心。(推荐方式)

9.26.4.3 半同步复制

Master 只保证 Slaves 中的一个操作成功,就返回,其他 Slave 不管。

下面将使用 SqlServer 简单配置主从复制功能。

9.26.5 SqlServer 主库配置

9.26.5.1 添加 本地发布

9.26.5.2 选择 分发服务器

9.26.5.3 启用 代理

9.26.5.4 发布数据库

9.26.5.5 快照发布

具体选择何种发布类型,视具体业务场景而定。

9.26.5.6 选择发布项目

9.26.5.7 配置分发计划

9.26.5.8 配置安全设置

9.26.5.9 完成配置

9.26.6 SqlServer 从库配置

9.26.6.1 添加 本地订阅

9.26.6.2 选择 分发服务器

9.26.6.3 选择 分发代理位置

9.26.6.4 选择 订阅数据库

9.26.6.5 选择 分发安全设置

9.26.6.6 选择 同步计划

9.26.6.7 完成订阅

9.26.7 分发定义监视

9.26.8 查看主从复制结果

特别特性

主从复制有一定迟延性,所以系统设计要有一定“容忍性"。

9.26.9 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-repository/index.html b/handbook/build/docs/dbcontext-repository/index.html index 7ed8812c0f9..e7dd7d85906 100644 --- a/handbook/build/docs/dbcontext-repository/index.html +++ b/handbook/build/docs/dbcontext-repository/index.html @@ -6,7 +6,7 @@ 9.4 仓储模式 | Fur - + @@ -33,7 +33,7 @@
// 其他更多数据库一样的操作

另外任何仓储或实体配置都支持多个数据库同时操作

仓储方式

IRepository<Person, MsSqlDbContextLocator> mssqlRepository
ISqlRepository<MsSqlDbContextLocator> mssqlRepository;

动态 sql 方式

"select * from person".Change<MsSqlDbContextLocator>().SqlQuery();

实体配置方式

public class User:Entity<MsSqlDbContextLocator, MySqlDbContextLocator>
{
}

Sql 代理方式

[SqlFunction("funcName", DbContextLocator = typeof(MySqlDbContextLocator))]
int GetAge(int id);

Linq 中方式

[QueryableFunction("funcName","dbo", DbContextLocator = typeof(MySqlDbContextLocator))]
string GetName()=> throw Oops.Oh("不支持该数据库操作");

9.4.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-seed-data/index.html b/handbook/build/docs/dbcontext-seed-data/index.html index 744ce860e33..a3bd4f10262 100644 --- a/handbook/build/docs/dbcontext-seed-data/index.html +++ b/handbook/build/docs/dbcontext-seed-data/index.html @@ -6,7 +6,7 @@ 9.21 实体种子数据 | Fur - + @@ -32,7 +32,7 @@
namespace Fur.Application
{
public class PersonSeedData : IEntitySeedData<Person>
{
// 配置种子数据
public IEnumerable<Person> HasData(DbContext dbContext, Type dbContextLocator)
{
return new List<Person>
{
new Person { Id = 1, Name = "百小僧", Address = "广东省中山市" },
new Person { Id = 2, Name = "新生帝", Address = "广东省珠海市" }
};
}
}
}

9.21.3 导航属性

通常我们的实体有 一对多多对多等外键关系,那么我们需要单独为每一个实体添加数据种子,而不是直接写在主表中。

9.21.4 多个数据库种子数据

Fur 提供泛型的方式支持多个数据库种子数据设定,如:

using Fur.DatabaseAccessor;
using System.Collections.Generic;
namespace Fur.Application
{
public class PersonSeedData : IEntitySeedData<Person, MySqlDbContextLocator, SqliteDbContextLocator>
{
// 配置种子数据
public IEnumerable<Person> HasData(DbContext dbContext, Type dbContextLocator)
{
return new List<Person>
{
new Person { Id = 1, Name = "百小僧", Address = "广东省中山市" },
new Person { Id = 2, Name = "新生帝", Address = "广东省珠海市" }
};
}
}
}

上面的例子表示同时为 MySqlDbContextSqliteDbContext 创建种子数据。

9.21.5 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 数据种子 知识可查阅 EF Core - 数据种子设定 章节。

- + diff --git a/handbook/build/docs/dbcontext-sql-proxy/index.html b/handbook/build/docs/dbcontext-sql-proxy/index.html index 5eec6032809..f12e97629e8 100644 --- a/handbook/build/docs/dbcontext-sql-proxy/index.html +++ b/handbook/build/docs/dbcontext-sql-proxy/index.html @@ -6,7 +6,7 @@ 9.17 Sql 高级代理 | Fur - + @@ -76,7 +76,7 @@
namespace Fur.Application
{
public interface ISql : ISqlDispatchProxy
{
[SqlFunction("FN_Name")] // 标量函数
string GetValue(MyParam dto);
[SqlProcedure("FN_Name")] // 表值函数
List<Person> GetPersons(int id);
}
}
补充说明

Sql 代理会自动判断返回值然后自动执行特定函数类型。

9.17.6 为什么用它?

通过上面的例子大家就可以了解,这种方式操作 sql 非常简单,而且极易维护。大家不用去关系返回值,关心用哪个方法,所有东西会自动给你处理好。

所以,如果需要用 Sql 操作,推荐使用 Sql 高级代理。

9.17.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-sql-template/index.html b/handbook/build/docs/dbcontext-sql-template/index.html index 914a4bb7acd..92f3bb51228 100644 --- a/handbook/build/docs/dbcontext-sql-template/index.html +++ b/handbook/build/docs/dbcontext-sql-template/index.html @@ -6,7 +6,7 @@ 9.16 Sql 模板 | Fur - + @@ -28,7 +28,7 @@
// 懒人方式
var users = "#(Select.User)".SqlQuery<User>(new { id = 1});
// Sql 代理方式
[SqlExecute("#(Select.User)")]
List<User> GetUser(int id);

9.16.3.2 高级嵌套

var users = repository.SqlQuery<User>(
@"select * from user u
left join #(User.Detail) d on u.Id = d.UserId
where id > @id");

9.16.4 Sql 模板配置

9.16.4.1 普通模式

{
"Select.User": "select * from User"
}

9.16.4.2 更多配置

{
"Select.User": {
"Sql": "select * from User where id > @id and Name = @name",
"Params": [
{
"Name": " Id",
"Value": "1",
"DbType": "Int16",
"Size": 10
},
{
"Name": " Name",
"Value": "百小僧",
"DbType": "String",
"Size": 10
}
]
}
}

9.16.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-sql/index.html b/handbook/build/docs/dbcontext-sql/index.html index 0f7d4bfa69e..4e103a0ec3e 100644 --- a/handbook/build/docs/dbcontext-sql/index.html +++ b/handbook/build/docs/dbcontext-sql/index.html @@ -6,7 +6,7 @@ 9.15 Sql 操作 | Fur - + @@ -173,7 +173,7 @@
// 不再举例子。。。
补充说明

不管是那种方式操作 Sql ,方法名参数都是一致的,如:

  • SqlQuery
  • SqlQueryAsync
  • SqlQueries
  • SqlQueriesAsync
  • SqlNonQuery
  • SqlNonQueryAsync
  • SqlScalar
  • SqlScalarAsync
  • SqlProcedureQuery
  • SqlProcedureQueryAsync
  • SqlProcedureQueries
  • SqlProcedureQueriesAsync
  • SqlProcedureScalar
  • SqlProcedureScalarAsync
  • SqlProcedureNonQuery
  • SqlProcedureNonQueryAsync
  • SqlProcedureOutput
  • SqlProcedureOutputAsync
  • SqlFunctionScalar
  • SqlFunctionScalarAsync
  • SqlFunctionQuery
  • SqlFunctionQuery

9.15.6 IRepository 操作

IRepository 也能操作 sql,调用方法也是和上面一致的,如:

var dataTable = repository.Sql().SqlQuery("select * from person");
特别说明

由于篇幅有限,不再列举所有例子。

9.15.7 IRepository<TEntity> 操作

IRepository<TEntity> 也能操作 sql,调用方法也是和上面一致的,如:

var dataTable = personRepository.SqlQuery("select * from person");
特别说明

由于篇幅有限,不再列举所有例子。

9.15.8 关于 Sql 参数

所有 sql存储过程函数 参数都支持四种方式:

  • DbParameter[]:数组类型
  • new {}:匿名类型
  • new Class{}:强类型类型(支持复杂存储过程参数)
  • Dictionary<string,object> 类型
小知识

建议除了复杂的存储过程(带 OUTPUT/RETURN)的以外,所有参数建议使用 new {} 匿名类型,如果需要动态参数,则可以使用 Dictionary<string,object> 类型。

9.15.9 多数据库 Sql 操作 💯 💛

Fur 框架拥有非常灵活的多数据库操作方式,只需通过多数据库上下文定位器即可动态切换数据库。

9.15.9.1 懒人无敌 🐮 方式

var dataTable = "select * from person".Change<MySqlDbContextLocator>().SqlQuery();
var persons = "select * from person whre id > @id".Change<SqliteDbContextLocator>().SqlQuery<Person>();
补充说明

懒人方式 只需要通过 Change<TDbContextLocator> 方式即可动态切换数据库。

9.15.9.2 ISqlRepository 方式

只需要通过 ISqlRepository<TDbContextLocator> 注入或通过 sqlRepository.Change<TDbContextLocator>() 切换。

9.15.9.3 IRepository 方式

只需要通过 repository.Change<TDbContextLocator>() 获取即可。

9.15.9.4 IRepository<TEntity> 方式

只需要通过 IRepository<TEntity, TDbContextLocator> 注入或通过 personRepository.Change<TEntity, TDbContextLocator>() 切换。

9.15.10 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-update/index.html b/handbook/build/docs/dbcontext-update/index.html index f9d452f0fc4..7f6c4e1d935 100644 --- a/handbook/build/docs/dbcontext-update/index.html +++ b/handbook/build/docs/dbcontext-update/index.html @@ -6,7 +6,7 @@ 9.6 更新操作 | Fur - + @@ -198,7 +198,7 @@
// 示例二
await repository.UpdateNowAsync(new List<User> { user, user2 });
// 示例三
await repository.UpdateNowAsync(new[] {user, user2 });
小知识

所有带 Now 结尾的表示立即提交到数据库,也就是立即调用 SaveChangesSaveChangesAsync

9.6.15 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext-view/index.html b/handbook/build/docs/dbcontext-view/index.html index c8899a9ca27..9eba759135d 100644 --- a/handbook/build/docs/dbcontext-view/index.html +++ b/handbook/build/docs/dbcontext-view/index.html @@ -6,7 +6,7 @@ 9.12 视图操作 | Fur - + @@ -34,7 +34,7 @@
public FurService(IRepository<V_Person> repository)
{
// 初始化只读仓储
_readableRepository = repository.Constraint<IReadableRepository<V_Person>>();
}
/// <summary>
/// 读取视图
/// </summary>
/// <returns></returns>
public async Task<List<V_Person>> GetVPerson()
{
var list = await _readableRepository.AsAsyncEnumerable();
return list;
}
}
}
小知识

通过 .Constraint<TEntity,TDbContextLocator> 方法可以将仓储约束为特定仓储,如只读仓储,可读可写仓储,只新增仓储等。

9.12.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/dbcontext/index.html b/handbook/build/docs/dbcontext/index.html index 48a605e164b..efd59477f38 100644 --- a/handbook/build/docs/dbcontext/index.html +++ b/handbook/build/docs/dbcontext/index.html @@ -6,7 +6,7 @@ 9.1 数据库上下文 | Fur - + @@ -37,7 +37,7 @@
options.AddDbPool<SecondDbContext, SecondDbContextDbContextLocator>(DbProvider.SqlServer); // 第二个数据库
options.AddDbPool<ThirdDbContext, ThirdDbContextDbContextLocator>(DbProvider.SqlServer); // 第三个数据库

9.1.8 动态数据库上下文对象

Fur 框架中,数据库上下文是定义在 Fur.EntityFramework.Core 项目层,并且该层不被 Fur.ApplicationFur.Core 等层引用。

所以就不能直接在 Fur.Application 项目层直接使用 Fur.EntityFramework.Core 定义的数据库上下文。

Fur 为了解决这个问题,提供了两种方式处理:

  • respository.DbContext :当前数据库上下文对象,返回是 DbContext 抽象类型
  • respository.DynamicDbContext:当前数据库上下文对象,返回的是 dynamic 类型

如果你只是想使用 DbContext 的功能,直接使用 respository.DbContext 即可,如:

respository.DbContext.SaveChanges();

如果你想能够获取具体的数据库上下文类型,如 MyDbContext,那么使用 respository.DynamicDbContext 就可以获取到具体的 MyDbContext 类型。如:

var persons = respository.DynamicDbContext.Persons.Find(1);
var users = respository.DynamicDbContext.Users;

这样就可以直接操作 MyDbContext 定义的属性和方法了。

9.1.9 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 数据库上下文 知识可查阅 EF Core - 配置 DbContext 章节。

- + diff --git a/handbook/build/docs/dependency-injection/index.html b/handbook/build/docs/dependency-injection/index.html index d24474656c1..94a16c5af3f 100644 --- a/handbook/build/docs/dependency-injection/index.html +++ b/handbook/build/docs/dependency-injection/index.html @@ -6,7 +6,7 @@ 11. 依赖注入/控制反转 | Fur - + @@ -59,7 +59,7 @@
Console.WriteLine("SayHello 方法返回值:" + result);
return result;
}
}
}

之后我们只需要为 TestService 增加 [Injection] 特性即可,如:

[Injection(Proxy = typeof(LogDispatchProxy))]
public class TestService: ITestService, ITransient
{
public string SayHello(string word)
{
return $"Hello {word}";
}
}

之后 SayHello 方法被调用的时候就可以实现动态拦截了,比如这里写日志。

11.12.1 AOP 的作用

这种面向切面的能力(动态拦截/代理)可以实现很多很多功能,如:

  • 动态日志记录
  • 动态修改参数
  • 动态修改返回值
  • 动态方法重定向
  • 动态修改代码逻辑
  • 动态实现异常监听

还可以做更多更多的事情。

11.13 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/deploy/index.html b/handbook/build/docs/deploy/index.html index af413d98f6c..1223da96d47 100644 --- a/handbook/build/docs/deploy/index.html +++ b/handbook/build/docs/deploy/index.html @@ -6,7 +6,7 @@ 25. 托管部署 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/devops/index.html b/handbook/build/docs/devops/index.html index 23521248e9f..af865909e8b 100644 --- a/handbook/build/docs/devops/index.html +++ b/handbook/build/docs/devops/index.html @@ -6,7 +6,7 @@ 26. 持续部署集成 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/dynamic-api-controller/index.html b/handbook/build/docs/dynamic-api-controller/index.html index d5e94e69582..f3a576da0ed 100644 --- a/handbook/build/docs/dynamic-api-controller/index.html +++ b/handbook/build/docs/dynamic-api-controller/index.html @@ -6,7 +6,7 @@ 5. 动态 WebAPI | Fur - + @@ -72,7 +72,7 @@
namespace Fur.Web.Entry.Controllers
{
public class MvcController : ControllerBase
{
public string Get()
{
return nameof(Fur);
}
}
}
注意事项

启用该配置后,如果 Mvc 控制器 没有任何 [Route] 特性,但是贴了 [ApiController] 特性将会报错。原因是 [ApiController] 特性内部做了路由特性检测。所以建议使用 [ApiDataValidation] 代替。

查看 ASP.NET Core - ApiBehaviorApplicationModelProvider 源码

5.11 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/entity/index.html b/handbook/build/docs/entity/index.html index 67bfd1547b8..95facbc8ca0 100644 --- a/handbook/build/docs/entity/index.html +++ b/handbook/build/docs/entity/index.html @@ -6,7 +6,7 @@ 9.3 数据库实体 | Fur - + @@ -39,7 +39,7 @@
// 配置数据库实体
public void Configure(EntityTypeBuilder<User> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasKey(u => u.Id);
entityBuilder.HasIndex(u => u.Name);
}
}
}

9.3.3.2 在任何实例类中配置

using Fur.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
namespace Fur.Core
{
public class SomeClass : IEntityTypeBuilder<User>
{
public void Configure(EntityTypeBuilder<User> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasKey(u => u.Id);
entityBuilder.HasIndex(u => u.Name);
}
}
}

如,上面例子,通过 SomeClass 配置 User 数据库实体。

9.3.4 数据库实体配置说明

Fur 框架会自动扫描所有继承 IEntity 接口的类进行 DbSet<TEntity> 注册,也就是实现自动配置 DbContextOnModelCreating

如果需要跳过自动注册,只需要贴 [NonAutomatic][SkipScan] 特性即可。一旦贴了此特性,那么就需要手动配置 DbContextOnModelCreating

9.3.5 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/errors/index.html b/handbook/build/docs/errors/index.html index 61a833128cc..f9d6fc3c19c 100644 --- a/handbook/build/docs/errors/index.html +++ b/handbook/build/docs/errors/index.html @@ -6,7 +6,7 @@ 29.2 常见错误 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/event-bus/index.html b/handbook/build/docs/event-bus/index.html index d73bb8903de..2dd9ba6cda3 100644 --- a/handbook/build/docs/event-bus/index.html +++ b/handbook/build/docs/event-bus/index.html @@ -6,7 +6,7 @@ 18. 事件总线 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/friendly-exception/index.html b/handbook/build/docs/friendly-exception/index.html index 337e23e62f3..b98a981d27d 100644 --- a/handbook/build/docs/friendly-exception/index.html +++ b/handbook/build/docs/friendly-exception/index.html @@ -6,7 +6,7 @@ 7. 友好异常处理 | Fur - + @@ -61,7 +61,7 @@
namespace Fur.Application
{
public class LogExceptionHandler : IGlobalExceptionHandler, ISingleton
{
public Task OnExceptionAsync(ExceptionContext context)
{
// 写日志
return Task.CompletedTask;
}
}
}

7.15 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/get-start/index.html b/handbook/build/docs/get-start/index.html index 33267e8658d..25ff2502589 100644 --- a/handbook/build/docs/get-start/index.html +++ b/handbook/build/docs/get-start/index.html @@ -6,7 +6,7 @@ 2. 一分钟入门 | Fur - + @@ -37,7 +37,7 @@
app.UseInject(string.Empty); // 添加这一行,如果是 MVC和API共存项目,无需添加 string.Empty
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}

2.4 启动浏览器

启动浏览器查看效果。

说好一分钟入门,你们用了多长时间。😁

- + diff --git a/handbook/build/docs/gooduse/index.html b/handbook/build/docs/gooduse/index.html index 874d1e67b07..0dc5fcedaf6 100644 --- a/handbook/build/docs/gooduse/index.html +++ b/handbook/build/docs/gooduse/index.html @@ -6,7 +6,7 @@ 29.3 最佳实践 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/grpc/index.html b/handbook/build/docs/grpc/index.html index fa41bbea7e5..5b7d33b4f58 100644 --- a/handbook/build/docs/grpc/index.html +++ b/handbook/build/docs/grpc/index.html @@ -6,7 +6,7 @@ 24. Grpc 服务 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/http/index.html b/handbook/build/docs/http/index.html index caf3db55e3c..a83b1caf598 100644 --- a/handbook/build/docs/http/index.html +++ b/handbook/build/docs/http/index.html @@ -6,7 +6,7 @@ 20. 网络请求 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/index.html b/handbook/build/docs/index.html index 51253165a04..f1745c34c02 100644 --- a/handbook/build/docs/index.html +++ b/handbook/build/docs/index.html @@ -6,7 +6,7 @@ 1.1 介绍 | Fur - + @@ -20,13 +20,13 @@ - +
-

1.1 介绍

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.34
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-rc.final.34 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.34

🍎 框架特点

  • 全新面貌:基于 .NET 5 平台,没有历史包袱
  • 极易入门:只需要一个 Inject() 即可完成配置
  • 极速开发:内置丰富的企业应用开发功能
  • 极少依赖:框架只依赖三个第三方包
  • 极其灵活:轻松面对多变复杂的需求
  • 极易维护:采用独特的架构思想,只为长久维护设计
  • 完整文档:提供完善的开发文档

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司
  • 上海奥达科股份有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...
😤 好人!10Nice 的小僧,我们的 dotnetchina 马上火起来了
😮 木木 Woody10感谢您的开源项目!
😚 Joker HouQQ 超级会员一个月
🤠 ccdfzQQ 专属红包 199
🌝 天夫李总支付宝 6666Fur 非常有意思,持续关注
😝 六尘子微信红包 199公司已经使用,小小敬意

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor 👉 IoTSharp

+

1.1 介绍

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下企业应用开发最佳实践框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

目前文档正在逐步完善中。

🥦 系列教程

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-rc.final.50
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-rc.final.50 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-rc.final.50

🥜 Fur 官方包

包类型名称版本描述
nugetFurv1.0.0-rc.final.50Fur 总包
nugetFur.Extras.Authentication.JwtBearerv1.0.0-rc.final.50Fur Jwt 拓展包

🍎 框架特点

  • 全新面貌:基于 .NET 5 平台,没有历史包袱
  • 极易入门:只需要一个 Inject() 即可完成配置
  • 极速开发:内置丰富的企业应用开发功能
  • 极少依赖:框架只依赖三个第三方包
  • 极其灵活:轻松面对多变复杂的需求
  • 极易维护:采用独特的架构思想,只为长久维护设计
  • 完整文档:提供完善的开发文档

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司
  • 上海奥达科股份有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...
😤 好人!10Nice 的小僧,我们的 dotnetchina 马上火起来了
😮 木木 Woody10感谢您的开源项目!
😚 Joker HouQQ 超级会员一个月
🤠 ccdfzQQ 专属红包 199
🌝 天夫李总支付宝 6666Fur 非常有意思,持续关注
😝 六尘子微信红包 199公司已经使用,小小敬意

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor 👉 IoTSharp

- + @@ -40,6 +40,6 @@ - + \ No newline at end of file diff --git a/handbook/build/docs/job/index.html b/handbook/build/docs/job/index.html index 59f9e3acbb9..f00ffde4d02 100644 --- a/handbook/build/docs/job/index.html +++ b/handbook/build/docs/job/index.html @@ -6,7 +6,7 @@ 22. 任务调度 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/local-language/index.html b/handbook/build/docs/local-language/index.html index fd3f0f94620..1f9314945dc 100644 --- a/handbook/build/docs/local-language/index.html +++ b/handbook/build/docs/local-language/index.html @@ -6,7 +6,7 @@ 16. 多语言处理 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/logging/index.html b/handbook/build/docs/logging/index.html index 9b37c969772..3bbb505d9d4 100644 --- a/handbook/build/docs/logging/index.html +++ b/handbook/build/docs/logging/index.html @@ -6,7 +6,7 @@ 19. 日志记录 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/object-mapper/index.html b/handbook/build/docs/object-mapper/index.html index 0ddc3c315ac..3952a0488c6 100644 --- a/handbook/build/docs/object-mapper/index.html +++ b/handbook/build/docs/object-mapper/index.html @@ -6,7 +6,7 @@ 12. 对象数据映射 | Fur - + @@ -28,7 +28,7 @@
var dto = new Dto();
dto.Id = entity.Id;
dto.Name = entity.Name;
dto.Age = entity.Age;
dto.Address = entity.Address;
dto.FullName = entity.FirstName + entity.LastName;
dto.IdCard = entity.IdCard.Replace("1234", "****");

上面的例子似乎没有任何问题,但是如果很多地方需要这样的赋值操作、或者相同的赋值操作在多个地方使用,又或者一个类中含有非常多的属性或自定义赋值操作。那么这样的操作效率极低,容易出错,且代码非常臃肿和冗余。

所以,实现自动映射赋值和支持特殊配置的需求就有了。目前 C# 平台有两个优秀的对象映射工具:MapsterAutoMapperFur 框架中,默认集成的是 MapsterMapster 是一款极易使用且超高性能的对象映射框架。

12.3 Mapster 使用

现在,我们可以通过 Mapster 提供的对象映射方法:Adapt 方法改造上面的例子:

12.3.1 极易入门

var entity = repository.Find(1);
var dto = entity.Adapt<Dto>();

仅仅一行代码就可以实现 entity -> dto 的转换,如果涉及到赋值的复制操作,如 dto.FullNamedto.IdCard,我们只需要自定义映射规则类即可。

12.3.2 自定义映射规则

using Fur.ObjectMapper;
using Mapster;
using System;
namespace Fur.Application
{
public class Mapper : IObjectMapper
{
public void Register(TypeAdapterConfig config)
{
config.ForType<Entity, Dto>()
.Map(dest => dest.FullName, src => src.FirstName + src.LastName)
.Map(dest => dest.IdCard, src => src.IdCard.Replace("1234", "****"));
}
}
}
小知识

该映射文件 Mapper.cs 可以放在任何项目或文件夹中,Fur 会在程序启动的时候自动扫描并注入配置。

12.3.3 依赖注入方式

Mapster 除了提供 Adapt 拓展方法以外,同时还提供依赖注入的方式。

public Person(IMapper mapper)
{
var dto = _mapper.Map<Dto>(entity);
}

12.3.4 和 EFCore 配合

Mapster 还提供了 ProjectToType Linq 拓展方法减少我们手动 Select 操作,如:

正常的操作:

var destinations = context.Sources
.Select(c => new Destination {
Id = p.Id,
Name = p.Name,
Surname = p.Surname,
....
})
.ToList();

使用 Mapster 之后:

var destinations = context.Sources.ProjectToType<Destination>().ToList();

12.5 全局默认配置

Fur 提供全局默认映射配置选项 TypeAdapterConfig.GlobalSettings.Default,可在 Startup 中配置即可,如:

TypeAdapterConfig.GlobalSettings.Default
.PreserveReference(true);

12.6 EFCore 映射问题

在使用 Mapster 映射实体的时候,如果实体包含 一对多、多对多的导航属性时候,当执行数据库 Update 更新操作的时候,默认就做了全量更新,会影响性能。

所以,社区开发者提供了新的解决方案,可以解决这个问题,代码传送门:TypeAdapterBuilderExtensions.cs

12.7 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 Mapster 知识可查阅 Mapster - Wiki 文档。

- + diff --git a/handbook/build/docs/options/index.html b/handbook/build/docs/options/index.html index a25736e9453..ad2796cbac4 100644 --- a/handbook/build/docs/options/index.html +++ b/handbook/build/docs/options/index.html @@ -6,7 +6,7 @@ 4.2 选项 | Fur - + @@ -38,7 +38,7 @@
public void OnListener(AppInfoOptions options, IConfiguration configuration)
{
var name = options.Name; // 实时的最新值
var version = options.Version; // 实时的最新值
}
public void PostConfigure(AppInfoOptions options, IConfiguration configuration)
{
}
}
特别说明

IConfigurableOptionsListener<TOptions> 继承自 IConfigurableOptions<TOptions>

4.2.10 选项的优缺点

  • 优点

    • 强类型配置
    • 提供多种读取方式
    • 支持热加载
    • 支持设置默认值/后期配置
    • 支持在运行环境中动态配置
    • 支持验证配置有效性
    • 支持更改通知
    • 支持命名选项
  • 缺点

    • 需要定义对应类型
    • 需要在启动时注册

4.2.11 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 选项 知识可查阅 ASP.NET Core - 选项 章节。

- + diff --git a/handbook/build/docs/performance/index.html b/handbook/build/docs/performance/index.html index e94e1f23371..6e3360fcacb 100644 --- a/handbook/build/docs/performance/index.html +++ b/handbook/build/docs/performance/index.html @@ -6,7 +6,7 @@ 27.2 性能测试 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/process-service/index.html b/handbook/build/docs/process-service/index.html index f5fd3494e39..c1e2e9cf020 100644 --- a/handbook/build/docs/process-service/index.html +++ b/handbook/build/docs/process-service/index.html @@ -6,7 +6,7 @@ 21. 进程服务 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/reference/index.html b/handbook/build/docs/reference/index.html index 6c2d32a2790..f943744deaa 100644 --- a/handbook/build/docs/reference/index.html +++ b/handbook/build/docs/reference/index.html @@ -6,7 +6,7 @@ 1.4 项目引用 | Fur - + @@ -28,7 +28,7 @@
namespace Fur.Web.Entry
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.Inject()
.UseStartup<Startup>();
});
}
}
}

1.4.3 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/saas/index.html b/handbook/build/docs/saas/index.html index dfbae2bea78..269d9b22119 100644 --- a/handbook/build/docs/saas/index.html +++ b/handbook/build/docs/saas/index.html @@ -6,7 +6,7 @@ 10. SaaS 多租户 | Fur - + @@ -63,7 +63,7 @@
public string Name { get; set; }
public string Host { get; set; }
}
}

如果需要查询该租户信息,可通过以下代码获取,如:

var tenantDbContext = Db.GetDbContext<MultiTenantDbContextLocator>();
var myTenant = tenantDbContext.Set<MyTenant>();

10.9 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/signalr/index.html b/handbook/build/docs/signalr/index.html index f3fe886be78..90173ff05b8 100644 --- a/handbook/build/docs/signalr/index.html +++ b/handbook/build/docs/signalr/index.html @@ -6,7 +6,7 @@ 23. 即时通讯 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/source/index.html b/handbook/build/docs/source/index.html index d7df195787a..e7f49c5f5d7 100644 --- a/handbook/build/docs/source/index.html +++ b/handbook/build/docs/source/index.html @@ -6,7 +6,7 @@ 1.3 源码结构 | Fur - + @@ -58,7 +58,7 @@
#prefer fields not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_field = false:suggestion
#prefer methods not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_method = false:suggestion
#prefer properties not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_property = false:suggestion
# Add file header
file_header_template = -----------------------------------------------------------------------------\nFur 是 .NET 5 平台下企业应用开发最佳实践框架。\nCopyright © 2020 Fur, Baiqian Co.,Ltd.\n\n框架名称:Fur\n框架作者:百小僧\n框架版本:1.0.0\n源码地址:Gitee:https://gitee.com/monksoul/Fur \n Github:https://github.com/monksoul/Fur \n开源协议:Apache-2.0(http://www.apache.org/licenses/LICENSE-2.0)\n-----------------------------------------------------------------------------

1.2.4 Fur 核心层

Fur 核心层是 Fur 框架的中心,也是 Fur 能够支撑起来的必备层。

源码结构:

Fur
├─Fur.csproj
├─Fur.csproj.user
├─FurStartup.cs
├─ViewEngine
| ├─IViewEngine.cs
| ├─ViewEngine.cs
| ├─Templates
| | ├─IViewEngineCompiledTemplate.cs
| | ├─IViewEngineTemplate.cs
| | ├─ViewEngineCompiledTemplate.cs
| | └ViewEngineTemplate.cs
| ├─Options
| | └ViewEngineCompilationOptions.cs
| ├─Models
| | └AnonymousTypeWrapper.cs
| ├─Exceptions
| | ├─ViewEngineCompilationException.cs
| | └ViewEngineException.cs
| ├─Compilations
| | ├─IViewEngineCompilationOptionsBuilder.cs
| | └ViewEngineCompilationOptionsBuilder.cs
├─UnifyResult
| ├─Providers
| | ├─IUnifyResultProvider.cs
| | └RESTfulResultProvider.cs
| ├─Models
| | └RESTfulResult.cs
| ├─Filters
| | └SuccessUnifyResultFilter.cs
| ├─Extensions
| | └UnifyResultServiceCollectionExtensions.cs
├─SpecificationDocument
| ├─Options
| | └SpecificationDocumentSettingsOptions.cs
| ├─Models
| | ├─GroupOrder.cs
| | ├─SpecificationOpenApiInfo.cs
| | ├─SpecificationOpenApiSecurityRequirementItem.cs
| | └SpecificationOpenApiSecurityScheme.cs
| ├─Extensions
| | ├─SpecificationDocumentApplicationBuilderExtensions.cs
| | └SpecificationDocumentServiceCollectionExtensions.cs
| ├─Builders
| | └SpecificationDocumentBuilder.cs
| ├─Assets
| | └index-mini-profiler.html
├─ObjectMapper
| ├─Extensions
| | └ObjectMapperServiceCollectionExtensions.cs
| ├─Dependencies
| | └IObjectMapper.cs
├─LinqBuilder
| ├─Visitors
| | └ParameterReplaceExpressionVisitor.cs
| ├─Extensions
| | └LinqExtensions.cs
| ├─Builders
| | └LinqExpression.cs
├─FriendlyException
| ├─Oops.cs
| ├─Providers
| | └IErrorCodeTypeProvider.cs
| ├─Options
| | └ErrorCodeMessageSettingsOptions.cs
| ├─Models
| | └MethodIfException.cs
| ├─Filters
| | └FriendlyExceptionFilter.cs
| ├─Extensions
| | └FriendlyExceptionServiceCollectionExtensions.cs
| ├─Attributes
| | ├─ErrorCodeItemMetadataAttribute.cs
| | ├─ErrorCodeTypeAttribute.cs
| | └IfExceptionAttribute.cs
├─DynamicApiController
| ├─Penetrates.cs
| ├─Providers
| | └DynamicApiControllerFeatureProvider.cs
| ├─Options
| | └DynamicApiControllerSettingsOptions.cs
| ├─Models
| | └ParameterRouteTemplate.cs
| ├─Extensions
| | └DynamicApiControllerServiceCollectionExtensions.cs
| ├─Enums
| | └ApiSeats.cs
| ├─Dependencies
| | └IDynamicApiController.cs
| ├─Conventions
| | └DynamicApiControllerApplicationModelConvention.cs
| ├─Attributes
| | ├─ApiDescriptionSettingsAttribute.cs
| | ├─ApiSeatAttribute.cs
| | └DynamicApiControllerAttribute.cs
├─DependencyInjection
| ├─Options
| | └DependencyInjectionSettingsOptions.cs
| ├─Models
| | └ExternalService.cs
| ├─Extensions
| | └DependencyInjectionServiceCollectionExtensions.cs
| ├─Enums
| | ├─InjectionActions.cs
| | ├─InjectionPatterns.cs
| | └RegisterType.cs
| ├─Dependencies
| | ├─IPrivateDependency.cs
| | ├─IScoped.cs
| | ├─ISingleton.cs
| | ├─ITransient.cs
| | ├─Proxies
| | | └IDispatchProxy.cs
| ├─Attributes
| | ├─InjectionAttribute.cs
| | └SkipScanAttribute.cs
├─DataValidation
| ├─Validators
| | └DataValidator.cs
| ├─Providers
| | └IValidationMessageTypeProvider.cs
| ├─Options
| | └ValidationTypeMessageSettingsOptions.cs
| ├─Models
| | └DataValidationResult.cs
| ├─Filters
| | └DataValidationFilter.cs
| ├─Extensions
| | ├─DataValidationExtensions.cs
| | └DataValidationServiceCollectionExtensions.cs
| ├─Enums
| | ├─ValidationPattern.cs
| | └ValidationTypes.cs
| ├─Attributes
| | ├─DataValidationAttribute.cs
| | ├─NonValidationAttribute.cs
| | ├─ValidationItemMetadataAttribute.cs
| | ├─ValidationMessageAttribute.cs
| | ├─ValidationMessageTypeAttribute.cs
| | └ValidationTypeAttribute.cs
├─DataEncryption
| ├─AESEncryption.cs
| ├─DESCEncryption.cs
| └MD5Encryption.cs
├─DatabaseAccessor
| ├─UnitOfWork
| | ├─Filters
| | | └UnitOfWorkFilter.cs
| | ├─Attributes
| | | ├─NonTransactAttribute.cs
| | | └UnitOfWorkAttribute.cs
| ├─Repositories
| | ├─EFCoreRepository.cs
| | ├─IMSRepository.cs
| | ├─IRepository.cs
| | ├─ISqlRepository.cs
| | ├─MSRepository.cs
| | ├─SqlRepository.cs
| | ├─Implantations
| | | ├─DeletableRepository.cs
| | | ├─InsertableRepository.cs
| | | ├─OperableRepository.cs
| | | ├─ReadableRepository.cs
| | | ├─SqlExecutableRepository.cs
| | | ├─SqlReaderRepository.cs
| | | ├─UpdateableRepository.cs
| | | └WritableRepository.cs
| | ├─Dependencies
| | | ├─IDeletableRepository.cs
| | | ├─IInsertableRepository.cs
| | | ├─IOperableRepository.cs
| | | ├─IReadableRepository.cs
| | | ├─IRepositoryDependency.cs
| | | ├─ISqlExecutableRepository.cs
| | | ├─ISqlReaderRepository.cs
| | | ├─IUpdateableRepository.cs
| | | └IWritableRepository.cs
| ├─Pools
| | ├─DbContextPool.cs
| | └IDbContextPool.cs
| ├─MultiTenants
| | ├─Locators
| | | └MultiTenantDbContextLocator.cs
| | ├─Enums
| | | └MultiTenantOptions.cs
| | ├─Entities
| | | └Tenant.cs
| | ├─Dependencies
| | | ├─IMultiTenantOnDatabase.cs
| | | ├─IMultiTenantOnSchema.cs
| | | ├─IMultiTenantOnTable.cs
| | | └IPrivateMultiTenant.cs
| ├─Models
| | ├─DbProvider.cs
| | ├─PagedList.cs
| | ├─ProcedureOutputResult.cs
| | ├─ProcedureOutputValue.cs
| | ├─SqlTemplate.cs
| | └SqlTemplateParameter.cs
| ├─Locators
| | ├─IDbContextLocator.cs
| | └MasterDbContextLocator.cs
| ├─Interceptors
| | ├─DbContextSaveChangesInterceptor.cs
| | ├─SqlCommandProfilerInterceptor.cs
| | └SqlConnectionProfilerInterceptor.cs
| ├─Helpers
| | └DbHelpers.cs
| ├─Extensions
| | ├─DatabaseAccessorServiceCollectionExtensions.cs
| | ├─PagedQueryableExtensions.cs
| | ├─Repositories
| | | ├─IEntityExtensions.cs
| | | ├─IEntityWithDbContextLocatorExtensions.cs
| | | └SqlExtensions.cs
| | ├─DatabaseProvider
| | | ├─DatabaseProviderServiceCollectionExtensions.cs
| | | └Penetrates.cs
| | ├─DatabaseFacade
| | | ├─DbDataConvertExtensions.cs
| | | ├─DbObjectExtensions.cs
| | | └SqlAdoNetExtensions.cs
| ├─Enums
| | ├─DbFunctionType.cs
| | ├─EFCoreErrorCodes.cs
| | └ManualOptions.cs
| ├─Entities
| | ├─Dependencies
| | | ├─Entity.cs
| | | ├─EntityBase.cs
| | | ├─EntityNotKey.cs
| | | ├─IEntity.cs
| | | └IEntityNotKey.cs
| | ├─Configures
| | | ├─IEntitySeedData.cs
| | | ├─IEntityTypeBuilder.cs
| | | ├─IModelBuilderFilter.cs
| | | └IPrivateModelBuilder.cs
| | ├─Attributes
| | | ├─FakeDeleteAttribute.cs
| | | ├─NonAutomaticAttribute.cs
| | | └QueryableFunctionAttribute.cs
| ├─DynamicModels
| | ├─DynamicModelCacheKeyFactory.cs
| | └IEntityMutableTable.cs
| ├─Contexts
| | ├─AppDbContext.cs
| | ├─Builders
| | | ├─AppDbContextBuilder.cs
| | | ├─Models
| | | | └DbContextCorrelationType.cs
| | ├─Attributes
| | | └AppDbContextAttribute.cs
| ├─Attributes
| | └DbParameterAttribute.cs
| ├─Advances
| | ├─Proxies
| | | └SqlDispatchProxy.cs
| | ├─Models
| | | └SqlProxyMethod.cs
| | ├─Dependencies
| | | └ISqlDispatchProxy.cs
| | ├─Attributes
| | | ├─SqlExecuteAttribute.cs
| | | ├─SqlFunctionAttribute.cs
| | | ├─SqlProcedureAttribute.cs
| | | ├─Basics
| | | | ├─SqlObjectProxyAttribute.cs
| | | | ├─SqlProxyAttribute.cs
| | | | └SqlSentenceProxyAttribute.cs
├─CorsAccessor
| ├─Options
| | └CorsAccessorSettingsOptions.cs
| ├─Extensions
| | ├─CorsAccessorApplicationBuilderExtensions.cs
| | └CorsAccessorServiceCollectionExtensions.cs
├─ConfigurableOptions
| ├─Options
| | └IConfigurableOptions.cs
| ├─Extensions
| | └ConfigurableOptionsServiceCollectionExtensions.cs
| ├─Attributes
| | └OptionsSettingsAttribute.cs
├─Authorization
| ├─Penetrates.cs
| ├─Requirements
| | └AuthorizePolicyRequirement.cs
| ├─Providers
| | └AuthorizePolicyProvider.cs
| ├─Options
| | └JWTSettingsOptions.cs
| ├─Handlers
| | └AuthorizePolicyHandler.cs
| ├─Extensions
| | └PolicyAuthorizationServiceCollectionExtensions.cs
| ├─Attributes
| | └AuthorizePolicyAttribute.cs
├─App
| ├─App.cs
| ├─Startups
| | ├─AppStartup.cs
| | └HostingStartup.cs
| ├─Options
| | └AppSettingsOptions.cs
| ├─Filters
| | └StartupFilter.cs
| ├─Extensions
| | ├─AppApplicationBuilderExtensions.cs
| | ├─AppServiceCollectionExtensions.cs
| | ├─WebHostBuilderExtensions.cs
| | ├─Types
| | | └ObjectExtensions.cs
| ├─Attributes
| | └AppStartupAttribute.cs

1.2.5 Fur.Application 业务应用层

Fur.Application 业务应用层是最常用的层,几乎所有的业务代码都在这个层中编写。

源码结构:

Fur.Application
├─Fur.Application.Core.csproj
├─Fur.Application.Core.xml
└FurApplicationStartup.cs

1.2.6 Fur.Core 仓储实体层

Fur.Core 主要是存储自定义仓储和定义实体的层。

源码结构:

Fur.Core
├─Fur.Core.csproj
└FurCoreStartup.cs

1.2.7 Fur.Database.Migrations 数据库架构维护层

Fur.Database.Migrations 主要是用来存放 Database FirstCode First 生成的维护文件。

源码结构:

Fur.Database.Migrations
└Fur.Database.Migrations.csproj

1.2.8 Fur.EntityFramework.Core 数据库上下文配置层

Fur.EntityFramework.Core 主要是用来配置数据库上下文和其他数据库相关配置信息的。

源码结构:

Fur.EntityFramework.Core
└Fur.EntityFramework.Core.csproj

1.2.9 Fur.Web.Core 应用核心层

Fur.Web.Core 主要是用来配置 Web 入口一些代码,如 FilterMiddlewares 等。

源码结构:

Fur.Web.Core
├─Fur.Web.Core.xml
└FurWebCoreStartup.cs

1.2.10 Fur.Web.Entry 应用入口层

Fur.Web.Entry 是我们的应用层,也就是我们的 Web 项目层,发布层。

源码结构:

Fur.Web.Entry
├─appsettings.Development.json
├─appsettings.json
├─Fur.Web.Entry.csproj
├─Fur.Web.Entry.csproj.user
├─Fur.Web.Entry.xml
├─Program.cs
├─Startup.cs
├─wwwroot
| └README.md
├─Properties
| └launchSettings.json
├─Controllers
- + diff --git a/handbook/build/docs/specification-document/index.html b/handbook/build/docs/specification-document/index.html index 877c99b0dbe..0545fcf2f2e 100644 --- a/handbook/build/docs/specification-document/index.html +++ b/handbook/build/docs/specification-document/index.html @@ -6,7 +6,7 @@ 6. 规范化接口文档 | Fur - + @@ -53,7 +53,7 @@
return new JsonResult(new RESTfulResult
{
StatusCode = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK,
Successed = true,
Data = data,
Errors = null
});
}
/// <summary>
/// 验证失败返回值
/// </summary>
/// <param name="context"></param>
/// <param name="modelStates"></param>
/// <param name="validationResults"></param>
/// <param name="validateFaildMessage"></param>
/// <returns></returns>
public IActionResult OnValidateFailed(ActionExecutingContext context, ModelStateDictionary modelStates, Dictionary<string, IEnumerable<string>> validationResults, string validateFaildMessage)
{
return new JsonResult(new RESTfulResult
{
StatusCode = StatusCodes.Status400BadRequest,
Successed = false,
Data = null,
Errors = validationResults
});
}
}
}

之后在 Startup.cs 中注册即可:

services.AddControllers().AddUnifyResult<RESTfulResult, RESTfulResultProvider>();
特别注意

由于使用了规范化结果之后, Swagger 不能显示真实的数据类型,所以需要在 Action 上面贴 [UnifyResult(返回值类型)] 即可。

6.8 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/split-db/index.html b/handbook/build/docs/split-db/index.html index dbb4cfd3202..3d067d1a0d2 100644 --- a/handbook/build/docs/split-db/index.html +++ b/handbook/build/docs/split-db/index.html @@ -6,7 +6,7 @@ 9.27 分表分库 | Fur - + @@ -30,7 +30,7 @@
// 通过数据库上下文定位器切换
repository.Change<Entity, MyDbContextLocator2>();

如需跨库查询,需用到数据库技术,如 SqlServer 链接服务器或同义词。

  • 动态切换数据库表
// 直接改变表,会有多线程操作bug,同时无法刷新模型
repository.ChangeTable("数据库表");
// 创建新的 DbContext,然后刷新 OnModelCreating(推荐方式)
var dynamicDbContextResolve = App.TransientServices.GetService<Func<Type, IScoped, DbContext>>();
var dynamicDbContext = dynamicDbContextResolve(typeof(MyDbContextLocator), default);
// 重新调用 OnModelCreating,在 OnModelCreating 中配置 ToTable("动态表") 即可。
DynamicModelCacheKeyFactory.RebuildModels();
var persons= dynamicDbContext.Set<Person>();
persons.Add(new Person{});
了解更多

想了解更多 DynamicModelCacheKeyFactory 知识可查阅 EF Core - 多个模型之间交替 章节。

9.27.7 反馈与建议

与我们交流

给 Fur 提 Issue

- + diff --git a/handbook/build/docs/tran/index.html b/handbook/build/docs/tran/index.html index 54346de5097..b383a83261b 100644 --- a/handbook/build/docs/tran/index.html +++ b/handbook/build/docs/tran/index.html @@ -6,7 +6,7 @@ 9.25 事务和工作单元 | Fur - + @@ -29,7 +29,7 @@
var blogs = _testRepository.Entity
.OrderBy(b => b.Url)
.ToList();
// 提交事务
transaction.Commit();
}
catch (Exception)
{
// 回滚事务
transaction.RollBack();
}
}

9.25.4 工作单元特性说明

9.25.4.1 [UnitOfWork]

[UnitOfWork] 特性用来标记事务信息,如作用范围,隔离级别等。

  • Enabled:是否启动工作单元,默认 true
  • ScopeOption:定义事务范围行为,默认 TransactionScopeOption.Required
  • IsolationLevel:设置事务隔离级别,默认 IsolationLevel.ReadCommitted;
  • AsyncFlowOption:允许跨线程连续任务的事务流,如有异步操作需开启该选项,默认开启
特别注意

一旦方法贴了 [UnitOfWork(false)] 特性后,那么该方法不再启用工作单元模式,也就是不包含事务,也不会自动提交数据库。慎用!

9.25.5 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 事务 知识可查阅 EF Core - 使用事务 章节。

- + diff --git a/handbook/build/docs/unittest/index.html b/handbook/build/docs/unittest/index.html index 14cf0029a1e..c48a68da1d8 100644 --- a/handbook/build/docs/unittest/index.html +++ b/handbook/build/docs/unittest/index.html @@ -6,7 +6,7 @@ 27.1 单元测试 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/docs/view-engine/index.html b/handbook/build/docs/view-engine/index.html index f1425981d91..fc0fe3b4301 100644 --- a/handbook/build/docs/view-engine/index.html +++ b/handbook/build/docs/view-engine/index.html @@ -6,7 +6,7 @@ 17. 视图引擎 | Fur - + @@ -26,7 +26,7 @@
- + diff --git a/handbook/build/index.html b/handbook/build/index.html index 54d6a6aa030..e58451da581 100644 --- a/handbook/build/index.html +++ b/handbook/build/index.html @@ -6,7 +6,7 @@ Fur 是 .NET 5 平台下企业应用开发最佳实践框架。 Fur | Fur - + @@ -22,7 +22,7 @@

Fur 是 .NET 5 平台下企业应用开发最佳实践框架。

[object Object]

.NET 5 新起点

.NET 5 是 .NET 的重要且令人兴奋的新方向。你会看到 .NET 变得更加简单,但也有更广泛的功能和实用程序。所有新的开发和功能都将是 .NET 5 的一部分,包括新的 C# 版本

[object Object]

“六极” 架构

Fur 在设计之初就秉承着 “六极” :极易入门、极速开发、极少依赖、极少配置、极其灵活、极易维护 的设计思想,在架构设计上做了大量的优化,支持各个能力阶层技术员极速上手。

[object Object]

冲一杯咖啡的时间

Fur 除了独具创新的设计理念和灵活的架构设计以外,同时还结合了主流的敏捷开发模式打造的一款极速开发框架。只需冲制一杯咖啡的时间便可完成工作

- + diff --git a/handbook/build/runtime~main.8ad60693.js b/handbook/build/runtime~main.87448a50.js similarity index 96% rename from handbook/build/runtime~main.8ad60693.js rename to handbook/build/runtime~main.87448a50.js index 61934945615..453e8baa18c 100644 --- a/handbook/build/runtime~main.8ad60693.js +++ b/handbook/build/runtime~main.87448a50.js @@ -1 +1 @@ -!function(e){function a(a){for(var f,r,t=a[0],n=a[1],o=a[2],u=0,l=[];u