2019年2月15日 星期五

EF 匯入 view 注意 primary key 問題

自動變成PK : 使用 isnull 或 定義為 not null
不會變成PK : 使用 nullif

避免 view 的 not null 欄位且非PK 於EF 被誤判為PK
若不修正可能會造成儲存EF圖表時會刪除相關 .cs file

ex: select nullif(a.active,0) active,... from table1 a inner join table2 b on a.oid=b.id

沒有留言:

自訂權限驗證機制

// 使用 filter [Route("api/[controller]")] [ApiController] [Authorize] [TypeFilter(typeof(CustomAsyncAuthorizationFilter))] public c...