官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 广宁县| 荃湾区| 泰州市| 泽普县| 新乡市| 疏勒县| 玛沁县| 柯坪县| 枣强县| 闻喜县| 丹东市| 荣成市| 九龙县| 葵青区| 湘乡市| 高要市| 荥经县| 光山县| 塔河县| 张北县| 班戈县| 西华县| 德化县| 通辽市| 天镇县| 汶川县| 厦门市| 体育| 错那县| 安西县| 临澧县| 霸州市| 东源县| 山东| 利辛县| 特克斯县| 十堰市| 祁连县| 章丘市| 攀枝花市| 海宁市|