diff --git a/Examples/website/FreeSql.Site.DAL/DocumentContentDAL.cs b/Examples/website/FreeSql.Site.DAL/DocumentContentDAL.cs new file mode 100644 index 00000000..22222018 --- /dev/null +++ b/Examples/website/FreeSql.Site.DAL/DocumentContentDAL.cs @@ -0,0 +1,42 @@ +//using FreeSql.Site.Entity; +using FreeSql.Site.Entity; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text; + +namespace FreeSql.Site.DAL +{ + public class DocumentContentDAL + { + public long Insert(DocumentContent model) + { + return Db.mysql.Insert(model).ExecuteIdentity(); + } + + public bool Update(DocumentContent model) + { + return Db.mysql.Update(model.ID).ExecuteUpdated().Count > 0; + } + + public bool Delete(long id) + { + return Db.mysql.Delete(id).ExecuteDeleted().Count > 0; + } + + public DocumentContent GetByOne(Expression> where) + { + return Db.mysql.Select() + .Where(where).ToOne(); + } + + public List Query(Expression> where, + Expression> orderby = null) + { + var list = Db.mysql.Select() + .Where(where); + if (orderby != null) list = list.OrderBy(b => b.CreateDt); + return list.ToList(); + } + } +} diff --git a/Examples/website/FreeSql.Site.Entity/DocumentComment.cs b/Examples/website/FreeSql.Site.Entity/DocumentComment.cs new file mode 100644 index 00000000..3c930630 --- /dev/null +++ b/Examples/website/FreeSql.Site.Entity/DocumentComment.cs @@ -0,0 +1,58 @@ +//using FreeSql.DataAnnotations; +using FreeSql.DataAnnotations; +using System; + +namespace FreeSql.Site.Entity +{ + public class DocumentComment + { + [Column(IsIdentity = true, IsPrimary = true)] + public int ID { get; set; } + + /// + /// 功能类型(文章、模板、示例等) + /// + public int FunctionType { get; set; } + + /// + /// 功能ID 文章、模板、示例等 + /// + public int FunctionID { get; set; } + + /// + /// 是否匿名访问 + /// + public int IsAnonymous { get; set; } + + /// + /// 评论人 + /// + public string Commentator { get; set; } + + /// + /// 评论者IP + /// + public string CommentatorIp { get; set; } + + /// + /// 回复评论编号 + /// + public int ReplyID { get; set; } + + /// + /// 评论内容 + /// + public string CommentContent { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateDt { get; set; } + + /// + /// 创建人 + /// + public string CreateBy { get; set; } + + } +} diff --git a/Examples/website/FreeSql.Site.Entity/DocumentContent.cs b/Examples/website/FreeSql.Site.Entity/DocumentContent.cs new file mode 100644 index 00000000..4197d508 --- /dev/null +++ b/Examples/website/FreeSql.Site.Entity/DocumentContent.cs @@ -0,0 +1,67 @@ +//using FreeSql.DataAnnotations; +using FreeSql.DataAnnotations; +using System; + +namespace FreeSql.Site.Entity +{ + public class DocumentContent + { + [Column(IsIdentity = true, IsPrimary = true)] + public int ID { get; set; } + + /// + /// 类型编号 + /// + public int TypeID { get; set; } + + /// + /// 标题 + /// + public string DocTitle { get; set; } + + /// + /// 摘要 + /// + public string DocAbstract { get; set; } + + /// + /// 文档内容 + /// + public string DocContent { get; set; } + + /// + /// 状态 + /// + public int Status { get; set; } + + /// + /// 查看次数 + /// + public int WatchCount { get; set; } + + /// + /// Star统计 + /// + public int StarCount { get; set; } + + /// + /// 创建时间 + /// + public DateTime? CreateDt { get; set; } + + /// + /// 创建人 + /// + public string CreateBy { get; set; } + + /// + /// 修改时间 + /// + public DateTime? UpdateDt { get; set; } + + /// + /// 修改人 + /// + public string UpdateBy { get; set; } + } +} diff --git a/Examples/website/FreeSql.Site.Entity/DocumentType.cs b/Examples/website/FreeSql.Site.Entity/DocumentType.cs index 2f9f92e5..4c2da05d 100644 --- a/Examples/website/FreeSql.Site.Entity/DocumentType.cs +++ b/Examples/website/FreeSql.Site.Entity/DocumentType.cs @@ -13,6 +13,11 @@ namespace FreeSql.Site.Entity public int? UpID { get; set; } + /// + /// 状态 + /// + public int Status { get; set; } + public DateTime? CreateDt { get; set; } public string CreateBy { get; set; } diff --git a/Examples/website/FreeSql.Site.Entity/TemplateExample.cs b/Examples/website/FreeSql.Site.Entity/TemplateExample.cs new file mode 100644 index 00000000..0431e647 --- /dev/null +++ b/Examples/website/FreeSql.Site.Entity/TemplateExample.cs @@ -0,0 +1,59 @@ +using FreeSql.DataAnnotations; +using System; +using System.Collections.Generic; +using System.Text; + +namespace FreeSql.Site.Entity +{ + /// + /// 模板示例 + /// + public class TemplateExample + { + [Column(IsIdentity = true, IsPrimary = true)] + public int ID { get; set; } + + /// + /// 模板图片 + /// + public string TemplateImg { get; set; } + + /// + /// 模板名称 + /// + public string TempateName { get; set; } + + /// + /// 模板路径 + /// + public string TemplatePath { get; set; } + + /// + /// 查看次数 + /// + public int WatchCount { get; set; } + + /// + /// 下载统计 + /// + public int DownloadCount { get; set; } + + /// + /// Star统计 + /// + public int StarCount { get; set; } + + /// + /// 状态 + /// + public int Status { get; set; } + + public DateTime? CreateDt { get; set; } + + public string CreateBy { get; set; } + + public DateTime? UpdateDt { get; set; } + + public string UpdateBy { get; set; } + } +} diff --git a/Examples/website/FreeSql.Site.UI/Areas/Doc/Controllers/DocumentsController.cs b/Examples/website/FreeSql.Site.UI/Areas/Doc/Controllers/DocumentsController.cs index 31bacce1..bbb6ee94 100644 --- a/Examples/website/FreeSql.Site.UI/Areas/Doc/Controllers/DocumentsController.cs +++ b/Examples/website/FreeSql.Site.UI/Areas/Doc/Controllers/DocumentsController.cs @@ -2,7 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using FreeSql.Site.DAL; +using FreeSql.Site.Entity; using FreeSql.Site.UI.Controllers; +using FreeSql.Site.UI.Models; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -11,17 +14,49 @@ namespace FreeSql.Site.UI.Areas.Doc.Controllers [Area("Doc")] public class DocumentsController : BaseController { - // GET: Documents - public IActionResult Index() + public DocumentTypeDAL DocumentTypeDAL { get; set; } + + public DocumentContentDAL DocumentContentDAL { get; set; } + + public DocumentsController() { - ViewBag.DocumentList = new FreeSql.Site.DAL.DocumentTypeDAL().Query(d => d.ID != 0); + this.DocumentTypeDAL = new DocumentTypeDAL(); + this.DocumentContentDAL = new DocumentContentDAL(); + } + + // GET: Documents + public IActionResult Index(int id = 1) + { + var typeList = DocumentTypeDAL.Query(d => d.ID != 0); + var contentlist = DocumentContentDAL.Query(d => d.Status == 1); + + //适应两层结构即可 + var query = (from p in typeList + where p.UpID == null || p.UpID == 0 + select new TreeData(p, typeList).AddChildrens(GetContentTreeData(p.ID, contentlist), (tid) => GetContentTreeData(tid, contentlist))).ToList(); + + ViewBag.DocumentList = query; + ViewBag.DocID = id; return View(); } + private List GetContentTreeData(int id, List contentlist) + { + return contentlist.Where(w => w.TypeID == id).Select(s => new TreeData + { + id = s.ID, + text = s.DocTitle, + datatype = 1 + }).ToList(); + } + // GET: Documents/Details/5 public ActionResult Details(int id) { - return View(); + ViewBag.DocumentID = id; + var doc = this.DocumentContentDAL.GetByOne(w => w.ID == id); + ViewBag.DocumentInfo = doc; + return this.PartialView(); } // GET: Documents/Create diff --git a/Examples/website/FreeSql.Site.UI/Areas/Doc/Views/Documents/Details.cshtml b/Examples/website/FreeSql.Site.UI/Areas/Doc/Views/Documents/Details.cshtml new file mode 100644 index 00000000..04d4f7d5 --- /dev/null +++ b/Examples/website/FreeSql.Site.UI/Areas/Doc/Views/Documents/Details.cshtml @@ -0,0 +1,71 @@ +@{ + Layout = null; + var documentinfo = (FreeSql.Site.Entity.DocumentContent)ViewBag.DocumentInfo; +} +@if (ViewBag.DocumentInfo == null) +{ + + 编号: @ViewBag.DocumentID + + 测试没有 +} +else +{ +

@*开始使用 - 入门指南*@@documentinfo.DocTitle

+
+ @*@documentinfo.DocContent*@ + @documentinfo.DocContent + @*
+ lFreeSql 是轻量化、可扩展和跨平台版的 .NETStandard 数据访问技术实现。
+ FreeSql 可用作对象关系映射程序 (O/RM),以便于开发人员能够使用 .NETStandard 对象来处理数据库,不必经常编写大部分数据访问代码。
+ FreeSql 支持 MySql/SqlServer/PostgreSQL 数据库技术实现。
+ FreeSql 打造 .NETCore 最方便的 ORM,dbfirst codefirst混合使用,codefirst模式下的开发阶段,建好实体不用执行任何操作,就能创建表和修改字段,dbfirst模式下提供api+模板,自定义生成代码,作者提供了3种模板。
+ FreeSql 目前仍处在测试阶段,您可以持续关注或者参与给出宝贵意见,QQ群:4336577 +
+
+ 兼容性和面向场景 +
+
+

1. 官网首页下载

+
+ 您可以通过 Github 下载到FreeSql的最新版: +
+

codeFreeSql

  1. ├─css //css目录
  2. │ │─modules //模块css目录(一般如果模块相对较大,我们会单独提取,比如下面三个:)
  3. │ │ ├─laydate
  4. │ │ ├─layer
  5. │ │ └─layim
  6. │ └─layui.css //核心样式文件
  7. ├─font //字体图标目录
  8. ├─images //图片资源目录(目前只有layim和编辑器用到的GIF表情)
  9. │─lay //模块核心目录
  10. │ └─modules //各模块组件
  11. │─layui.js //基础核心库
  12. └─layui.all.js //包含layui.js和所有模块的合并文件
+

2. Git 仓库下载

+
+ 你也可以通过 GitHub码云 得到 FreeSql 的完整开发包,以便于你进行二次开发,或者 Fork FreeSql 为我们贡献方案 +

+ + +
+

3. npm 安装

+

codeFreeSql

  1. Install-Package FreeSql
+

一般用于 WebPack 管理

+
+
+ 快速上手 +
+
+

1. 官网首页下载

+
+ 你可以在我们的 官网首页 下载到 layui 的最新版,它经过了自动化构建,更适合用于生产环境。目录结构如下: +
+

codeFreeSql

  1. ├─css //css目录
  2. │ │─modules //模块css目录(一般如果模块相对较大,我们会单独提取,比如下面三个:)
  3. │ │ ├─laydate
  4. │ │ ├─layer
  5. │ │ └─layim
  6. │ └─layui.css //核心样式文件
  7. ├─font //字体图标目录
  8. ├─images //图片资源目录(目前只有layim和编辑器用到的GIF表情)
  9. │─lay //模块核心目录
  10. │ └─modules //各模块组件
  11. │─layui.js //基础核心库
  12. └─layui.all.js //包含layui.js和所有模块的合并文件
+
*@ +
+ +} \ No newline at end of file diff --git a/Examples/website/FreeSql.Site.UI/Areas/Doc/Views/Documents/Index.cshtml b/Examples/website/FreeSql.Site.UI/Areas/Doc/Views/Documents/Index.cshtml index 6cbee870..a7e03cec 100644 --- a/Examples/website/FreeSql.Site.UI/Areas/Doc/Views/Documents/Index.cshtml +++ b/Examples/website/FreeSql.Site.UI/Areas/Doc/Views/Documents/Index.cshtml @@ -1,61 +1,62 @@ @{ - //ViewBag.Title = Model.ResultInfo.CurrentType.TypeName + "-" + Model.ResultInfo.Master.MasterName + PubConst.SitePrefix; + }
    -
  • 基础说明

  • - @foreach (var item in (List)ViewBag.DocumentList) + @foreach (var item in (List)ViewBag.DocumentList) { -
  • - @item.TypeName -
  • +
  • @item.text

  • + foreach (var children in item.children) + { + if (children.datatype == 1) + { +
  • + @children.text +
  • + } + else + { +
  • + > @children.text +
  • + foreach (var children2 in children.children) + { +
  • +     @children2.text +
  • + } + } + } }
-

开始使用 - 入门指南

-
-
- lFreeSql 是轻量化、可扩展和跨平台版的 .NETStandard 数据访问技术实现。
- FreeSql 可用作对象关系映射程序 (O/RM),以便于开发人员能够使用 .NETStandard 对象来处理数据库,不必经常编写大部分数据访问代码。
- FreeSql 支持 MySql/SqlServer/PostgreSQL 数据库技术实现。
- FreeSql 打造 .NETCore 最方便的 ORM,dbfirst codefirst混合使用,codefirst模式下的开发阶段,建好实体不用执行任何操作,就能创建表和修改字段,dbfirst模式下提供api+模板,自定义生成代码,作者提供了3种模板。
- FreeSql 目前仍处在测试阶段,您可以持续关注或者参与给出宝贵意见,QQ群:4336577 -
-
- 兼容性和面向场景 -
-
-

1. 官网首页下载

-
- 您可以通过 Github 下载到FreeSql的最新版: -
-

codeFreeSql

  1. ├─css //css目录
  2. │ │─modules //模块css目录(一般如果模块相对较大,我们会单独提取,比如下面三个:)
  3. │ │ ├─laydate
  4. │ │ ├─layer
  5. │ │ └─layim
  6. │ └─layui.css //核心样式文件
  7. ├─font //字体图标目录
  8. ├─images //图片资源目录(目前只有layim和编辑器用到的GIF表情)
  9. │─lay //模块核心目录
  10. │ └─modules //各模块组件
  11. │─layui.js //基础核心库
  12. └─layui.all.js //包含layui.js和所有模块的合并文件
-

2. Git 仓库下载

-
- 你也可以通过 GitHub码云 得到 FreeSql 的完整开发包,以便于你进行二次开发,或者 Fork FreeSql 为我们贡献方案 -

- - -
-

3. npm 安装

-

codeFreeSql

  1. Install-Package FreeSql
-

一般用于 WebPack 管理

-
-
- 快速上手 -
-
-

1. 官网首页下载

-
- 你可以在我们的 官网首页 下载到 layui 的最新版,它经过了自动化构建,更适合用于生产环境。目录结构如下: -
-

codeFreeSql

  1. ├─css //css目录
  2. │ │─modules //模块css目录(一般如果模块相对较大,我们会单独提取,比如下面三个:)
  3. │ │ ├─laydate
  4. │ │ ├─layer
  5. │ │ └─layim
  6. │ └─layui.css //核心样式文件
  7. ├─font //字体图标目录
  8. ├─images //图片资源目录(目前只有layim和编辑器用到的GIF表情)
  9. │─lay //模块核心目录
  10. │ └─modules //各模块组件
  11. │─layui.js //基础核心库
  12. └─layui.all.js //包含layui.js和所有模块的合并文件
-
-
+ @Html.Action("Details", new RouteValueDictionary { { "id", ViewBag.DocID } })
-
\ No newline at end of file + + + \ No newline at end of file diff --git a/Examples/website/FreeSql.Site.UI/Areas/Doc/_ViewImports.cshtml b/Examples/website/FreeSql.Site.UI/Areas/Doc/_ViewImports.cshtml new file mode 100644 index 00000000..0008112d --- /dev/null +++ b/Examples/website/FreeSql.Site.UI/Areas/Doc/_ViewImports.cshtml @@ -0,0 +1,7 @@ +@using FreeSql.Site.UI; +@using FreeSql.Site.UI.Models; +@using FreeSql.Site.UI.Common; +@using Microsoft.AspNetCore.Routing; +@using Microsoft.AspNetCore.Mvc; +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper "FreeSql.Site.UI.Common.TagHelpers.MarkdownTagHelper, FreeSql.Site.UI" \ No newline at end of file diff --git a/Examples/website/FreeSql.Site.UI/Common/HtmlHelperViewExtensions.cs b/Examples/website/FreeSql.Site.UI/Common/HtmlHelperViewExtensions.cs new file mode 100644 index 00000000..961c2de2 --- /dev/null +++ b/Examples/website/FreeSql.Site.UI/Common/HtmlHelperViewExtensions.cs @@ -0,0 +1,101 @@ +using Microsoft.AspNetCore.Html; +using Microsoft.AspNetCore.Mvc; +using System; +using Microsoft.AspNetCore.Routing; +using System.IO; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc.Infrastructure; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Mvc.Rendering; + +namespace FreeSql.Site.UI.Common +{ + public static class HtmlHelperViewExtensions + { + public static IHtmlContent Action(this IHtmlHelper helper, string action, object parameters = null) + { + var controller = (string)helper.ViewContext.RouteData.Values["controller"]; + + return Action(helper, action, controller, parameters); + } + + public static IHtmlContent Action(this IHtmlHelper helper, string action, string controller, object parameters = null) + { + var area = (string)helper.ViewContext.RouteData.Values["area"]; + + return Action(helper, action, controller, area, parameters); + } + + public static IHtmlContent Action(this IHtmlHelper helper, string action, string controller, string area, object parameters = null) + { + if (action == null) + throw new ArgumentNullException("action"); + + if (controller == null) + throw new ArgumentNullException("controller"); + + + var task = RenderActionAsync(helper, action, controller, area, parameters); + + return task.Result; + } + + private static async Task RenderActionAsync(this IHtmlHelper helper, string action, string controller, string area, object parameters = null) + { + // fetching required services for invocation + var serviceProvider = helper.ViewContext.HttpContext.RequestServices; + var actionContextAccessor = helper.ViewContext.HttpContext.RequestServices.GetRequiredService(); + var httpContextAccessor = helper.ViewContext.HttpContext.RequestServices.GetRequiredService(); + var actionSelector = serviceProvider.GetRequiredService(); + + // creating new action invocation context + var routeData = new RouteData(); + foreach (var router in helper.ViewContext.RouteData.Routers) + { + routeData.PushState(router, null, null); + } + routeData.PushState(null, new RouteValueDictionary(new { controller = controller, action = action, area = area }), null); + routeData.PushState(null, new RouteValueDictionary(parameters ?? new { }), null); + + //get the actiondescriptor + RouteContext routeContext = new RouteContext(helper.ViewContext.HttpContext) { RouteData = routeData }; + var candidates = actionSelector.SelectCandidates(routeContext); + var actionDescriptor = actionSelector.SelectBestCandidate(routeContext, candidates); + + var originalActionContext = actionContextAccessor.ActionContext; + var originalhttpContext = httpContextAccessor.HttpContext; + try + { + var newHttpContext = serviceProvider.GetRequiredService().Create(helper.ViewContext.HttpContext.Features); + if (newHttpContext.Items.ContainsKey(typeof(IUrlHelper))) + { + newHttpContext.Items.Remove(typeof(IUrlHelper)); + } + newHttpContext.Response.Body = new MemoryStream(); + var actionContext = new ActionContext(newHttpContext, routeData, actionDescriptor); + actionContextAccessor.ActionContext = actionContext; + var invoker = serviceProvider.GetRequiredService().CreateInvoker(actionContext); + await invoker.InvokeAsync(); + newHttpContext.Response.Body.Position = 0; + using (var reader = new StreamReader(newHttpContext.Response.Body)) + { + return new HtmlString(reader.ReadToEnd()); + } + } + catch (Exception ex) + { + return new HtmlString(ex.Message); + } + finally + { + actionContextAccessor.ActionContext = originalActionContext; + httpContextAccessor.HttpContext = originalhttpContext; + if (helper.ViewContext.HttpContext.Items.ContainsKey(typeof(IUrlHelper))) + { + helper.ViewContext.HttpContext.Items.Remove(typeof(IUrlHelper)); + } + } + } + } +} diff --git a/Examples/website/FreeSql.Site.UI/Common/MarkdownTagHelper.cs b/Examples/website/FreeSql.Site.UI/Common/MarkdownTagHelper.cs new file mode 100644 index 00000000..b9f35ce2 --- /dev/null +++ b/Examples/website/FreeSql.Site.UI/Common/MarkdownTagHelper.cs @@ -0,0 +1,40 @@ +using CommonMark; +using Microsoft.AspNetCore.Mvc.ViewFeatures; +using Microsoft.AspNetCore.Razor.TagHelpers; +using System.Net; +using System.Threading.Tasks; + +namespace FreeSql.Site.UI.Common.TagHelpers +{ + [HtmlTargetElement("markdown", TagStructure = TagStructure.NormalOrSelfClosing)] + [HtmlTargetElement(Attributes = "markdown")] + public class MarkdownTagHelper : TagHelper + { + public MarkdownTagHelper() + { + + } + + public ModelExpression Content { get; set; } + + public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + { + if (output.TagName == "markdown") + { + output.TagName = null; + } + output.Attributes.RemoveAll("markdown"); + var content = await GetContent(output); + var markdown = WebUtility.HtmlEncode(WebUtility.HtmlDecode(content)); + var html = CommonMarkConverter.Convert(markdown); + output.Content.SetHtmlContent(html ?? ""); + } + + private async Task GetContent(TagHelperOutput output) + { + if (Content == null) + return (await output.GetChildContentAsync()).GetContent(); + return Content.Model?.ToString(); + } + } +} diff --git a/Examples/website/FreeSql.Site.UI/FreeSql.Site.UI.csproj b/Examples/website/FreeSql.Site.UI/FreeSql.Site.UI.csproj index f1aa89c0..1d7ddd94 100644 --- a/Examples/website/FreeSql.Site.UI/FreeSql.Site.UI.csproj +++ b/Examples/website/FreeSql.Site.UI/FreeSql.Site.UI.csproj @@ -5,6 +5,7 @@ + diff --git a/Examples/website/FreeSql.Site.UI/Models/TreeDataConvert.cs b/Examples/website/FreeSql.Site.UI/Models/TreeDataConvert.cs new file mode 100644 index 00000000..2f44ff1e --- /dev/null +++ b/Examples/website/FreeSql.Site.UI/Models/TreeDataConvert.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using FreeSql.Site.Entity; + +namespace FreeSql.Site.UI.Models +{ + public class TreeData + { + public TreeData() { } + + public TreeData(DocumentType type) + { + this.id = type.ID; + this.text = type.TypeName; + } + + public TreeData(DocumentType type, List list) + { + this.id = type.ID; + this.text = type.TypeName; + this.children = (from l in list where l.UpID == type.ID select new TreeData(l, list)).ToList(); + } + + /// + /// 唯一编号 + /// + public int id { get; set; } + + /// + /// 标题 + /// + public string text { get; set; } + + /// + /// 类型 =0 表示类型 =1 表示内容 + /// + public int datatype { get; set; } = 0; + + public List children { get; set; } + + public TreeData AddChildrens(List list, Func> bind = null) + { + if (this.children != null && bind != null) + { + this.children.ForEach(f => + { + f.children = bind(f.id); + }); + } + this.children?.AddRange(list); + return this; + } + } +} diff --git a/Examples/website/FreeSql.Site.UI/Startup.cs b/Examples/website/FreeSql.Site.UI/Startup.cs index 9e6faa3d..ad749c9b 100644 --- a/Examples/website/FreeSql.Site.UI/Startup.cs +++ b/Examples/website/FreeSql.Site.UI/Startup.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json.Serialization; @@ -32,6 +33,9 @@ namespace FreeSql.Site.UI options.MinimumSameSitePolicy = SameSiteMode.None; }); + //设置Action方法 + services.AddSingleton(); + services.AddSingleton(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1) //设置返回内容得大小写格式 diff --git a/Examples/website/FreeSql.Site.UI/Views/Shared/_Layout.cshtml b/Examples/website/FreeSql.Site.UI/Views/Shared/_Layout.cshtml index 64f1609d..99ef64de 100644 --- a/Examples/website/FreeSql.Site.UI/Views/Shared/_Layout.cshtml +++ b/Examples/website/FreeSql.Site.UI/Views/Shared/_Layout.cshtml @@ -8,12 +8,19 @@ + + + + + + + @@ -155,8 +162,6 @@ - - @**@