這邊會建立SQL server Data Base Project用來管理資料庫面相關的檔案,會有Table、Stored Procedure、View….等
這個範例會簡單的實作建立一個Table ->部署到Localhost SQL Server為例
Step 1 – click Folder DataAccessLayer add new Project

Step 2 – 選擇 SQL Server類型 選擇SQL server Data Base Project

Step 3 – click Folder dbo add new item [ Table and Views 類型 ] -> [Table]

Step 4 – 簡單設計一下這個資料表

Step 5 – click database Project and Publish

Step 6 – set database connecting string

Step 7 – use Server Name:(Localdb)\MSSQLLocalDB
Authentication: Windows Authentication

Step 8 – Save Profile As xml:這邊可以先設定好指定的目標資料庫,這個步驟主要是方便之後部署用

Step 9 – Save publish xml File

Step 10 – Publish

Finish

Conclusion: 這篇簡單介紹了新增資料表接著連線資料庫進行部署的功能,在管理資料庫上非常方便,database Project版本控管上非常方便,我可以透過最新版本上的內容得知最新的版本資料庫針對資料表是如何設計的。
.Net Core Project GitHub:Link
下一篇 .Net Core Project 從零開始 — 資料庫存取利器Dapper
Source : .Net Core Project 從零開始 — 10個內步驟完成資料庫部署 Data Base Project