Rex dotNET學習筆記
2019年6月9日 星期日
Request.IsAjaxRequest()
判斷是否是AJAX Request
https://docs.microsoft.com/en-us/dotnet/api/system.web.mvc.ajaxrequestextensions.isajaxrequest?view=aspnet-mvc-5.2
https://dotblogs.com.tw/alonstar/2010/08/17/17259
https://demo.tc/post/633
MvcHandler.DisableMvcResponseHeader = true; 隱藏版本資訊
https://blog.miniasp.com/post/2009/09/02/ASPNET-MVC-Developer-Note-Part-10-Hide-MVC-Version-from-HTTP-Header
在Global.asax.cs的 Application_Start() 事件方法加入
MvcHandler.DisableMvcResponseHeader = true;
2019年6月3日 星期一
ASP.NET MVC:创建 ModelBinder 自动 Trim 所有字符串
https://www.cnblogs.com/ldp615/archive/2010/12/29/asp-net-mvc-create-model-binder-to-trim-all-string.html
Core版本
https://vikutech.blogspot.com/2018/02/trim-text-in-mvc-core-through-model-binder.html
ASP.NET MVC移除不需要的顯示引擎
確定網站不會使用WebForm(aspx),不需要
WebFormViewEngine
,
可以把只留
RazorViewEngine
在Global.asax.cs加入以下兩行
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
ASP.NET Core如何進行Database First開發?
https://ithelp.ithome.com.tw/articles/10201333
Scaffold-DbContext "DBConnectionString" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
2019年6月2日 星期日
示範利用HtmlHelper達到View不同的呈現效果
https://github.com/imrexhuang/MVCitemstatusUseHtmlHelper
本範例是status為00顯示成功,其他狀態碼顯示失敗
Many-to-Many在EF和EFcore的寫法差異
Relationships寫法EF和EFcore有點差異,發現有個網站有對照版本,以Many-to-Many為例:
EF版本(用Map)
https://www.entityframeworktutorial.net/code-first/configure-many-to-many-relationship-in-code-first.aspx
EFcore版本(用HasKey)
https://www.entityframeworktutorial.net/efcore/configure-many-to-many-relationship-in-ef-core.aspx
較新的文章
較舊的文章
首頁
訂閱:
文章 (Atom)