Allow null in model when using Code first Allow null in model when using Code first asp.net asp.net

Allow null in model when using Code first


You should declare optional fields using a nullable type

public int? RequisitionID { get; set; }


To accept the null values you can you the following solution.

public int? RequisitionID { get; set; }