Создаю покупку для веб-приложения. У меня есть User, Order, OrderDetails, Product.
Проблема заключается, что при создании миграции, получаю ошибку:
The property 'UserId' cannot be removed from entity type 'ShoppingCart.Domain.Entities.Order' because it is being used in the foreign key {'UserId'} on 'ShoppingCart.Domain.Entities.Order'. All containing foreign keys must be removed or redefined before the property can be removed.
public class Order
{
public int Id { get; set; }
public string City { get; set; }
public string Country { get; set; }
public int ZipCode { get; set; }
public User UserId { get; set; }
public IList<OrderDetail> OrderDetails { get; set; }
}
public class User
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string Role { get; set; }
public byte[] PasswordHash { get; set; }
public byte[] PasswordSalt { get; set; }
public IList<Order> Orders { get; set; }
}