書名: 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.
推薦閱讀
- Developing Mobile Web ArcGIS Applications
- Rust Cookbook
- Learning Laravel 4 Application Development
- 高級C/C++編譯技術(典藏版)
- Interactive Applications Using Matplotlib
- Python程序設計與算法基礎教程(第2版)(微課版)
- Python入門很輕松(微課超值版)
- Bootstrap for Rails
- Machine Learning for OpenCV
- Oracle 12c從入門到精通(視頻教學超值版)
- Xamarin Cross-Platform Development Cookbook
- Python應用開發技術
- HTML并不簡單:Web前端開發精進秘籍
- Mastering XenApp?
- Learning Ionic(Second Edition)