- Mastering Entity Framework Core 2.0
- Prabhakaran Anbazhagan
- 121字
- 2021-07-02 21:16:39
Blog entity script
We will create a Blog table, then alter it to add a primary key constraint, and finally, insert some dummy data into the table. The complete script is available in the GitHub repository at https://github.com/PacktPublishing/Mastering-Entity-Framework-Core/blob/master/Chapter%202/Final/MasteringEFCore.DatabaseFirst.Final/dbo.Blog.sql.
The script required for creating the Blog table and inserting the data is displayed as follows:
// Code removed for brevity
CREATE TABLE [dbo].[Blog] (
[Id] INT IDENTITY (1, 1) NOT NULL,
[Url] NVARCHAR (MAX) NULL
);
GO
// Code removed for brevity
INSERT INTO [Blog] (Url) VALUES
('http://blogs.packtpub.com/dotnet'),
('http://blogs.packtpub.com/dotnetcore'),
('http://blogs.packtpub.com/signalr')
GO
We have looked at the Blog table SQL script, now let's look at the Post table script that will introduce a non-clustered index and foreign key.
推薦閱讀
- 數字媒體應用教程
- Learning Real-time Processing with Spark Streaming
- C#程序設計(慕課版)
- oreilly精品圖書:軟件開發者路線圖叢書(共8冊)
- Android Native Development Kit Cookbook
- SQL基礎教程(第2版)
- INSTANT Sinatra Starter
- PrimeFaces Blueprints
- Java程序設計與項目案例教程
- Android Studio Cookbook
- 監控的藝術:云原生時代的監控框架
- Mastering Embedded Linux Programming
- 大規模語言模型開發基礎與實踐
- Scratch編程從入門到精通
- Spring Boot從入門到實戰