︿
Top

2022年10月25日 星期二

行尾結束字元探討(End of Line) PART 1 : Git

前言

最近在 study vs code + dotne CLI 的開發方式, 當然也括 git 的部份. 當手工下達 git add . 指令時, 會出現 LF will be replaced by CRLF the next time Git touches it 的警告訊息.

PS D:\22-Projects.Git\52-ASP.NET Core\MvcFriends> git add .
warning: in the working copy of '.gitignore', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.vscode/launch.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'wwwroot/lib/bootstrap/dist/css/bootstrap-grid.css', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'wwwroot/lib/bootstrap/dist/css/bootstrap-grid.min.css', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'wwwroot/lib/bootstrap/dist/css/bootstrap-grid.rtl.css', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'wwwroot/lib/bootstrap/dist/css/bootstrap-grid.rtl.min.css', LF will be replaced by CRLF the next time Git touches it

2022年3月14日 星期一

.NET 6 Console Program with EF Core From Existing Database


0. 前言


最近剛好有一些空檔, 由 .NET Framework 4.x 跨入 .NET Core 的世界, 目前 .NET Core 最新的 LTS (長期支援版本) 為 .NET 6. 而最簡單的程式, 就是 Console 主控台程式.

因此, 本文將撰寫一支 Console 主控台程式, 利用 Entity Framework Core (以下簡稱 EF Core)的工具, 將資料庫的 Table 轉為 C# 的 class, 並由前述主控台程式, 對資料庫進行讀取.

以下茲分幾個章節, 進行說明.

最後並附上 結論參考文件.

相關程式 可由此下載.


2021年2月15日 星期一

SQL Server 資料庫版本控管 (Part 3) : Schema Compare with .dacpac (資料層應用程式)


1. 情境


廠商要將資料庫結構異動, 發行至客戶測試機. 但廠商及客戶開發人員, 均不能連接至資料庫進行結構異動, 必須由客戶 DBA 進行處理.

回想以前在寫資料庫版本管控的文章時, 印象中 Will 保哥有提到 .dacpac 可以處理該狀況, 故作了一下複習及實作.

相關的程式碼, 可 由此下載.


2020年12月31日 星期四

Oracle: Synonym (別名) 的用途及實作練習


0. 前言


由於目前的專案採用 Oracle, 且整個資料庫是由客戶的 DBA 在管理, 為了安全上的考量, 在存取客戶現行使用者的資料表時, 只會提供廠商新的使用者帳號及密碼, 而不會提供現行使用者的帳號及密碼.

舉例而言, 假設 table: T2 由客戶的 USER2 所建立, 而客戶提供給廠商的使用者為 USER1; 雖然客戶已將 USER2.T2 這個 table 的權限開放給 USER1, 當然可以採用 USER2.T2 去存取.

但這樣會造成 參考文件1 提到的狀況:

  • 每次使用用 Table 時都要加上 "USER2.".
  • 程式碼寫死了 Schema 名稱, 一旦Schema名稱調整, 將有改不完的程式.

在網路上查了一下, 看來應該可以透過 Synonym (別名) 的方式來處理. Synonym 的用途如下:

  • 主要用在縮短資料庫物件 (table, view, sequence or program unit) 的名稱, 不需實際指定 schema.
  • 亦可用在如上述的資安議題.

以下茲分幾個步驟, 進行狀況模擬實測:

最後並附上 結論參考文件.


2020年12月28日 星期一

Oracle: Empty string and NOT NULL column


0. 前言


最近的專案又回到 Oracle, 印象中, 在作空字串與 Null 的處理時, 有一些要注意的地方. 所以, 就整理了本篇及 上一篇 的文章.

茲區分以下幾個部份作說明.


Oracle: Empty string and NULL allowd column


0. 前言


最近的專案又回到 Oracle, 印象中, 在作空字串與 Null 的處理時, 有一些要注意的地方. 所以, 就整理了本篇及 下一篇 的文章.

茲區分以下幾個部份作說明.


2020年12月25日 星期五

How to set network profile to PRIVATE after windows server restart


需求


因為開發測試需求, 在本機用 Virtual Box 安裝一個 VM, 內含 Windows Server 2019 及 Oracle 資料庫, 且只啟用 HostOnly 的網卡.

茲將整個設定過程留下記錄, 以備參考.