2016-11-02 7 views
1

많은 사람들에게 알려진 문제를 제시하고 있지만 그게 문제가 있으며 도움이 필요합니다. 어쩌면 메서드에 대한 형식 인수 System.Data.Entity.ModelConfiguration.EntityTypeConfiguration <Proyect.Models.Entity> .HasMany <TTargetEntity>

나는이 방법이 .... 간단하게 ...하지만 때로는 다른 사람의 눈은 우리가 볼 수없는 것을 볼 수 있습니다 :

protected override void OnModelCreating(DbModelBuilder modelBuilder) 
     { 
      base.OnModelCreating(modelBuilder); 
      modelBuilder.Entity<ValorAtributoProducto>() 
       .HasMany(i => i.AtributoProducto) 
       .WithRequired().WillCascadeOnDelete(true); 
     } 

을이 전체 오류 :

System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<Proyect.Models.ValorAtributoProducto>.HasMany<TTargetEntity>(System.Linq.Expressions.Expression<System.Func<Proyect.Models.ValorAtributoProducto,System.Collections.Generic.ICollection<TTargetEntity>) cannot be inferred from the usage. Try specifying the type arguments explicitly. 

답변

0

하여 사용하려면 HasMany 속성은 ICollecion을 구현해야합니다. 그렇지 않으면 "하나"만 "많음"이 없습니다.

나는 정말로 당신이 HasRequired을 사용해야한다고 생각합니다.

+0

귀하의 조언에 감사드립니다. – Harry