gpt4 book ai didi

c# - Entity Framework 代码首先添加额外列

转载 作者:太空宇宙 更新时间:2023-11-03 23:06:11 26 4
gpt4 key购买 nike

我已经离开 C# 和开发一段时间了,所以请耐心等待。

有一个实体类List如下:

public class List : EntityData
{
public int ListId { get; set; }
public string Name { get; set; }
public string UserId { get; set; }

public virtual List<ListItem> ListItems { get; set; }
}

但是创建的相应表使用此 DDL 以及额外的列。为什么?

CREATE TABLE [dbo].[Lists] 
(
[Id] NVARCHAR (128) DEFAULT (newid()) NOT NULL,
[ListId] INT NOT NULL,
[Name] NVARCHAR (MAX) NULL,
[UserId] NVARCHAR (MAX) NULL,
[Version] ROWVERSION NOT NULL,
[CreatedAt] DATETIMEOFFSET (7) DEFAULT (sysutcdatetime()) NOT NULL,
[UpdatedAt] DATETIMEOFFSET (7) NULL,
[Deleted] BIT NOT NULL,

CONSTRAINT [PK_dbo.Lists] PRIMARY KEY NONCLUSTERED ([Id] ASC)
);

最佳答案

它们不是额外的,而是由 Microsoft.Azure.Mobile.Server.EntityData 定义的。

这些额外的字段的目的是

An abstract implementation of the ITableData interface indicating how the system properties for a given table data model are to be serialized when communicating with clients when using Entity Framework for accessing the backend store. The uniform serialization of system properties ensures that the clients can process the system properties uniformly across platforms. Concrete entity framework models can derive from this base class in order to support the system properties.

关于c# - Entity Framework 代码首先添加额外列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41072121/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com