How to make a nullable property in EF Codefirst?

前端 未结 3 1654
感动是毒
感动是毒 2021-01-27 02:43

I have two POCOs in my \"Bookshelf\" test application:

/// 
/// Represents a book
/// 
public class Book
{
    public int ID { get         


        
3条回答
  •  粉色の甜心
    2021-01-27 03:23

    If you are talking about a simple property like int, bool, or float use int?, bool?, or float?

    like

     public int? ID { get; set; }
     public bool? Exists { get; set; }
    

提交回复
热议问题