I have an Entity called User. User should be used in multilingual environment So User looks like
class User{
virtual ICollection<TextEntry> Name {get; set;}
virtual ICollection<TextEntry> Info {get; set;}
...
}
class TextEntry
{
int id {get; set;}
string Text {get; set;}
string Culture {get;set;}
}
Also I have a rule for user
modelBuilder.Entity<User>()
.HasMany(q => q.Name)
.WithOptional()
.WillCascadeOnDelete();
modelBuilder.Entity<User>()
.HasMany(q => q.Info)
.WithOptional()
.WillCascadeOnDelete();
With this rules EF could not create model Esception message is "Introducing FOREIGN KEY constraint 'User_Info' on table 'TextEntry' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.\r\nCould not create constraint. See previous errors."
Without this rules I get an exception when trying delete user, because of references constraints.
How it possible to solve this wihout creating additional entity for User.Info data?