0
아래의 설정으로 사용자를 찾으려고 할 때 스택 오버플로 오류가 발생합니다. 지연로드 (Lazy Loading) 및 프록시 생성 (Proxy Creation)을 해제하려고 시도했지만 오류가 계속 발생합니다. 모델 만들기에코드 첫 번째 EF6 자체 참조 다 대다 예외 스택 오버플로 오류
public class Authority
{
public int Id { get; set; }
public string Domain { get; set; }
public string Name { get; set; }
public AuthorityTypeEnum Type { get; set; }
public virtual List<Authority> Groups { get; set; }
}
:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<ManyToManyCascadeDeleteConvention>();
modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
modelBuilder.Entity<Authority>()
.HasMany(a => a.Groups)
.WithMany().
Map(m =>
{
m.MapLeftKey("UserId");
m.MapRightKey("GroupId");
m.ToTable("UsersGroups");
}
);
base.OnModelCreating(modelBuilder);
}
컨텍스트 생성자 :
var byUserAndDomain = db.Authorities
.FirstOrDefault(a => a.Type == AuthorityTypeEnum.User && a.Domain == MvcApplication.Domain && a.Name == MvcApplication.UserName);
방금 MvcApplication.Domain 및 MvcApplication.UserName을 상수로 대체했으며 여전히 동일한 스택 오버플로 오류가 발생합니다. – RoboKitten
재생할 수 없습니다. –