如何使表“ PRODUCT”的外键接受空值?
我要求在填写PRODUCT表单时,您可以保存信息而不必选择银行。我使用实体框架生成表单PRODUCT(Controller)
外键del模型产品-> “ public int EntidadID {get; set;}”
我有两个相关的模型。
public class Product
{
[Key]
public int ProductID { get; set; }
public string NumContrato { get; set; }
public float TasaReal { get; set; }
public decimal Capital { get; set; }
public DateTime FechaValor { get; set; }
public DateTime FechaVencimiento { get; set; }
public int Plazo { get; set; }
public int BankID { get; set; }
public virtual …
Run Code Online (Sandbox Code Playgroud)