發表文章

目前顯示的是 5月, 2017的文章

Web Api Help 引用其他專案Model, Description是空的

在開發時 Model 會放在另一個專案 但在建立API說明文件時 會導致Model的說明文件沒有匯入 首先將 Model 的文件改到 WebApi 的文件路徑 WebApi的文件路徑: ~/App_Data/XmlDocument.XML Model的文件路徑: ../WebApi專案名稱/App_Data/XmlDocument2.XML 文件路徑設置請參考:  連結 開啟: WebApi專案>Areas>HelpPage>App_Start>HelpPageConfig.cs 修改 //config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.XML"))); config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data"))); 開啟: WebApi專案>Areas>HelpPage>XmlDocumentationProvider.cs 加入 private List<XPathNavigator> _documentNavigators = new List<XPathNavigator>(); 在建構式裡修改 public XmlDocumentationProvider(string documentPath) { if (documentPath == null) { throw new ArgumentNullException("documentPath"); } //XPathDocument xpath = new XPathDocument(documentPath); //_documentNavigator = xpath.CreateNavi...

C# ClaimsIdentity 登入

Web.config <configuration> <appSettings> <add key="owin:AppStartup" value="APP.App_Start.Startup" /> </appSettings> </configuration> Startup.cs namespace APP.App_Start { public partial class Startup { public void Configuration(IAppBuilder app) { app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, AuthenticationMode = AuthenticationMode.Active, LoginPath = new PathString("/Account/LogOn"), ExpireTimeSpan = TimeSpan.FromDays(365), CookieName="StuAppAuth", CookieHttpOnly=true }); } } } 登入 var claim = new List<Claim> { new Claim(ClaimTypes.Name, "test1"), new Claim(ClaimTypes.UserData, "test2"), new Claim(ClaimTypes.Sid, ...

取得資料表時間戳記(TIMESTAMP)

資料表異動的時間戳記(TIMESTAMP)語法 SELECT OBJECT_NAME(OBJECT_ID) AS DB_NAME, DATEDIFF(SECOND,'1970-1-1',LAST_USER_UPDATE) AS TABLE_TIMESTAMP FROM SYS.DM_DB_INDEX_USAGE_STATS WHERE DATABASE_ID = DB_ID( '資料庫' ) AND OBJECT_ID = OBJECT_ID( '資料表' )