2 ارتباط یک به چند در code first
سلام.
من می خوام در code first 2 ارتباط یک به چند بدم. بصورت زیر
public string Url { get; set; }
public virtual ICollection<Gallery> Galleries { get; set; }
public virtual ICollection<GCategory> GCategories { get; set; }
این هم relation در database
//realtion
public Guid GCategoryId { get; set; }
public virtual GCategory GCategory { get; set; }
//relation
public Guid UploadId { get; set; }
public virtual Upload Upload { get; set; }
و قتی 2 تا ارتباط یک به چند دادم این ارور رو میده
Introducing FOREIGN KEY constraint 'FK_dbo.GCategories_dbo.Uploads_UploadId' on table 'GCategories' 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.
نقل قول: 2 ارتباط یک به چند در code first
سلام.
دوستان اگه مشکل من رو داشتن لینک زیر می تونه کمکشون کنه. باید از fluent api استفاده کنید.
http://stackoverflow.com/questions/5...rom-same-table