을 선택할 때 속성 제외는 일치하는 솔루션을 찾을 수 없습니다. MVC4 응용 프로그램, EF 및 CodeFirstSharpMembership 공급자에게 알려주십시오.
엔티티 Entity Framework 5
public class User
{
...
public virtual ICollection<Role> Roles { get; set; }
}
그리고 표준 역할 법인이 :
public class Role
{
...
public virtual ICollection<User> Users { get; set; }
}
내가 사용
public class MyEntity
{
...
public virtual User Developer { get; set; }
}
에 FK 내 자신의 실체를 만들려고 할 때 물론 나는 사용자가 역할, 역할 reffers에 reffers 때문에 항상 셀프 레퍼런스 루프를 얻는다. 사용자에게.
다음 나는 어떤 외래 키를 선택하지 않도록하고,
var Developers = Context.MyEntities;
그리고 내 된 IQueryable는 "개발자"필드 선수는 물론 뭔가 를 선택한 후
Context = new DataContext();
Context.Configuration.LazyLoadingEnabled = false;
에 tryed.
그럼 난에 tryed :
var Developers = Context.MyEntities.Include("Developer");
물론 자기 Referrence 루프를 얻었다.
어떻게 계속 FKeys를 선택하고 사용자로부터 "역할"필드를 제외시킬 수 있습니까?
오류가 발생하고 있습니까? – IronMan84
예외 ""System.Data.Entity.DynamicProxies.User_0AFA654F65C3FB4CE9ADD687E486B5EB3BE472E040A3B97DA79144EA5F3D75AC '형식의 자체 참조 루프가 감지되었습니다.'행 [0] .Developer.Roles [0] .Users '. " – linuxod