I have to build a Code First DB and want to make a Foreign Key Nullable. But I dont know how to do it because it shows that this field can't be Null.
Order_Item:
namespace ORDER_DATABASE.Tables
{
public class Order_Item
{
public int Id { get; set; }
public virtual Order Order { get; set; }
public virtual Product Product { get; set; }
public int Amount { get; set; }
}
}
Product:
using System;
using System.Collections.Generic;
namespace ORDER_DATABASE.Tables
{
public class Product
{
public int Id { get; set; }
public virtual Supplier Supplier { get; set; }
public virtual Category Category { get; set; }
public String Name { get; set; }
public int Price { get; set; }
public virtual List<Order_Item> OrderItems { get; set; }
}
}
The Column i want to be null is Product !