- 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.
推薦閱讀
- C#高級編程(第10版) C# 6 & .NET Core 1.0 (.NET開發(fā)經(jīng)典名著)
- 一步一步學(xué)Spring Boot 2:微服務(wù)項(xiàng)目實(shí)戰(zhàn)
- Monkey Game Development:Beginner's Guide
- Mastering Natural Language Processing with Python
- Python自動化運(yùn)維快速入門
- Offer來了:Java面試核心知識點(diǎn)精講(原理篇)
- Python Tools for Visual Studio
- Implementing Cisco Networking Solutions
- Silverlight魔幻銀燈
- PHP+MySQL網(wǎng)站開發(fā)項(xiàng)目式教程
- Python之光:Python編程入門與實(shí)戰(zhàn)
- ElasticSearch Cookbook(Second Edition)
- R用戶Python學(xué)習(xí)指南:數(shù)據(jù)科學(xué)方法
- 智能搜索和推薦系統(tǒng):原理、算法與應(yīng)用
- 區(qū)塊鏈技術(shù)進(jìn)階與實(shí)戰(zhàn)(第2版)