小编use*_*311的帖子

如何在实体框架中具有映射到可空数据库列的值类型?

我有以下实体模型:

public class Todo  
{  
    [Required]  
    public int ID { get; set; }  
    public int OrderId { get; set; } //Not required  
    public string Description { get; set; }  
    public bool Finished { get; set; }  
    public DateTime CreationDate { get; set; }  
    public int Priority { get; set; } //Not required  
    public string CreatedBy { get; set; }  
    public bool Deleted { get; set; }  
}
Run Code Online (Sandbox Code Playgroud)

在相应的数据库表中,所有字段都创建为"not null".我想允许一些字段为空.我该怎么做呢?

c# entity-framework nullable

1
推荐指数
1
解决办法
6163
查看次数

标签 统计

c# ×1

entity-framework ×1

nullable ×1