can't find any matching solution.
Let's head to the point: MVC4 application, EF and CodeFirstSharpMembership provider.
There is an entity
public class User
{
...
public virtual ICollection<Role> Roles { get; set; }
}
And standard Role Entity:
public class Role
{
...
public virtual ICollection<User> Users { get; set; }
}
And of course when I try to make my own Entity with FK to User
public class MyEntity
{
...
public virtual User Developer { get; set; }
}
I always get Self-Referrence loop because User reffers to Roles, and Roles reffers to User.
Then I tryed to
Context = new DataContext();
Context.Configuration.LazyLoadingEnabled = false;
To avoid selecting any Foreign Keys, and after selecting something
var Developers = Context.MyEntities;
And of course my IQueryable was without "Developer" field.
Then I tryed to:
var Developers = Context.MyEntities.Include("Developer");
And of course got Self-Referrence loop.
How can I keep selecting FKeys and exclude "Role" field from User?