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

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.

主站蜘蛛池模板: 社会| 巩留县| 霍林郭勒市| 行唐县| 新源县| 宁武县| 信宜市| 图片| 靖边县| 襄樊市| 洱源县| 绩溪县| 诸城市| 沂源县| 乐都县| 和田市| 巨鹿县| 华安县| 华阴市| 宕昌县| 建水县| 怀集县| 张家口市| 山阴县| 汉沽区| 镇安县| 吉首市| 大理市| 临朐县| 新河县| 弥渡县| 巢湖市| 阳泉市| 鲁山县| 保定市| 扬中市| 天峻县| 长沙市| 新干县| 南召县| 方正县|