0

exemple: dbContext.Shortlist.Include (a => a.Shortlist_crew). La partie .Include() n'est pas disponible du tout. Idem sur toutes les autres entités: table.Include (q => q.OtherEntity). Ceci provient des classes générées exécutant dnx ef dbcontext échafaudage EntityFramework.SqlServer. Exécution d'un projet asp.net 5 (beta 7) avec EF 7 beta-7 Qu'est-ce qui manque ici? Fragment du contexte db généré:base de données de structure d'entité premier échafaudage dbcontext ne pas activer la navigation d'entité

protected override void OnModelCreating(ModelBuilder modelBuilder) 
{ 
... 
modelBuilder.Entity<Shortlist>(entity => 
      { 
       entity.ToTable("Shortlist", "dbSchemaName"); 
       entity.Property(e => e.id).ValueGeneratedNever(); 
       entity.Property(e => e.name).Required(); 
       entity.Property(e => e.production_id).Required(); 
       entity.Property(e => e.user_id).Required(); 
       entity.Reference(d => d.production).InverseCollection(p => p.Shortlist).ForeignKey(d => d.production_id); 
       entity.Reference(d => d.user).InverseCollection(p => p.Shortlist).ForeignKey(d => d.user_id); 
      }); 

modelBuilder.Entity<Shortlist_crew>(entity => 
      { 
       entity.ToTable("Shortlist_crew", "dbSchemaName"); 
       entity.Property(e => e.id).ValueGeneratedNever(); 
       entity.Property(e => e.added) 
        .Required() 
        .HasDefaultValueSql("getutcdate()"); 
       entity.Property(e => e.crew_id).Required(); 
       entity.Property(e => e.shortlist_id).Required(); 
       entity.Reference(d => d.shortlist).InverseCollection(p => p.Shortlist_crew).ForeignKey(d => d.shortlist_id); 
       entity.Reference(d => d.crew).InverseCollection(p => p.Shortlist_crew).ForeignKey(d => d.crew_id); 
      }); 
... 
} 
public virtual DbSet<Shortlist> Shortlist { get; set; } 
public virtual DbSet<Shortlist_crew> Shortlist_crew { get; set; } 

et le produit de POCO:

public class Shortlist 
    { 
     public Shortlist() 
     { 
      Production_shortlist = new HashSet<Production_shortlist>(); 
      Shortlist_crew = new HashSet<Shortlist_crew>(); 
     } 

     public Guid id { get; set; } 
     public string name { get; set; } 
     public Guid production_id { get; set; } 
     public string remarks { get; set; } 
     public Guid user_id { get; set; } 
     public virtual ICollection<Production_shortlist> Production_shortlist { get; set; } 
     public virtual ICollection<Shortlist_crew> Shortlist_crew { get; set; } 
     public virtual Production production { get; set; } 
     public virtual SearchUser user { get; set; } 
    } 

public class Shortlist_crew 
    { 
     public Guid id { get; set; } 
     public DateTimeOffset added { get; set; } 
     public Guid crew_id { get; set; } 
     public Guid shortlist_id { get; set; } 
     public virtual Crew crew { get; set; } 
     public virtual Shortlist shortlist { get; set; } 
    } 

Répondre

0

Eh bien, une réponse tout à fait évident. A manqué un usage.

using Microsoft.Data.Entity;