EF为什么会生成多余字段???
EF模型
用“根据模型生成数据库”生成的SQL脚本:
CREATE TABLE [dbo].[User] (
[ID] int IDENTITY(1,1) NOT NULL,
[Name] nvarchar(max) NOT NULL,
[Blog_ID] int NOT NULL
);
GO
-- Creating table 'Blog'
CREATE TABLE [dbo].[Blog] (
[ID] int IDENTITY(1,1) NOT NULL,
[Name] nvarchar(max) NOT NULL,
[UserId] int NOT NULL
);
GO
-- Creating table 'Post'
CREATE TABLE [dbo].[Post] (
[ID] int IDENTITY(1,1) NOT NULL,
[Title] nvarchar(max) NOT NULL,
[Content] nvarchar(max) NOT NULL,
[BlogId] int NOT NULL,
[Blog_ID] int NOT NULL
);
GO
-- Creating table 'Comment'
CREATE TABLE [dbo].[Comment] (
[ID] int IDENTITY(1,1) NOT NULL,
[Title] nvarchar(max) NOT NULL,
[Content] nvarchar(max) NOT NULL,
[PostId] int NOT NULL,
[Post_ID] int NOT NULL
);
GO
[ForeignKey("tid")]
public AdDisplayType DisplayType
{
get;
set;
}
public int tid { get; set; }