سلام
میشه مشکل این ارور رو بگید
این کد خطا میده . ولی وقتی ریلیشن این دوتا مدل رو پاک میکنم بدون هیچ مشکلی ساخته میشه
Introducing FOREIGN KEY constraint 'FK_Orders_Users_UserId' on table 'Orders' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Could not create constraint or index. See previous errors.مدل Order :
public Order()
{
UnderOrders = new List<UnderOrder>();
}
[Key]
public int OrderId { get; set; }
[Required]
public DateTime RegisterDate { get; set; }
[Required]
public string OrderStatus { get; set; }
public int UserId { get; set; }
public int AddressId { get; set; }
public Address Address { get; set; }
public User User { get; set; }
public List<UnderOrder> UnderOrders { get; set; }مدل User :
public User()
{
Addresses = new List<Address>();
Carts = new List<Cart>();
Contacts = new List<Contact>();
Accounting = new List<Accounting>();
Orders = new List<Order>();
ProductComments = new List<ProductComment>();
SavedProducts = new List<SavedProduct>();
}
[Key]
public int UserId { get; set; }
[Required]
[MaxLength(180)]
public string FullName { get; set; }
[Required]
[MaxLength(11)]
[MinLength(10)]
public string Mobile { get; set; }
[MaxLength(200)]
public string Email { get; set; }
[Required]
[MaxLength(16)]
[MinLength(8)]
public string Password { get; set; }
[MaxLength(5000)]
public string WebSite { get; set; }
public bool IsAdmin { get; set; }
public bool IsCustomer { get; set; }
public DateTime RegisterDate { get; set; }
public List<Address> Addresses { get; set; }
public List<Cart> Carts { get; set; }
public List<Contact> Contacts { get; set; }
public List<Accounting> Accounting { get; set; }
public List<Order> Orders { get; set; }
public List<ProductComment> ProductComments { get; set; }
public List<SavedProduct> SavedProducts { get; set; }ممنون
خواهش میکنم دوست من موفق باشید