0

I try to do the eager loading in this way:

lstResultado = miContexto.Videos
                            .Include(v => v.Series.Select(s => s.Episodios))
                            .Include(v=> v.VideosVersiones)
                            .Include(v => v.Generos).ToList<Videos>();

But I get this error: "The value can't be null. Name of the parameter: collection."

If I use only Include(v => v.Series.Select(s => s.Episodios)) it works fine, but the problem is when I use Include(v=> v.VideosVersiones).

My entities are:

public partial class Videos
    {
        public Videos()
        {
            this.Series = new HashSet<Series>();
            this.VideosPersonas = new HashSet<VideosPersonas>();
            this.VideosVersiones = new HashSet<VideosVersiones>();
            this.Generos = new HashSet<Generos>();
        }

        public long IDVideo { get; set; }
        public string Titulo { get; set; }
        public string Version { get; set; }
        public Nullable<short> Duracion { get; set; }
        public Nullable<short> Anyo { get; set; }
        public bool Favorito { get; set; }
        public bool Pendiente { get; set; }
        public string Descripcion { get; set; }
        public Nullable<long> IDPortada { get; set; }
        public long IDTipo { get; set; }

        public virtual Ficheros Ficheros { get; set; }
        public virtual ICollection<Series> Series { get; set; }
        public virtual Tipos Tipos { get; set; }
        public virtual ICollection<VideosPersonas> VideosPersonas { get; set; }
        public virtual ICollection<VideosVersiones> VideosVersiones { get; set; }
        public virtual ICollection<Generos> Generos { get; set; }
    }



public partial class VideosVersiones
    {
        public long IDVersion { get; set; }
        public long IDVideo { get; set; }
        public long IDEpisodio { get; set; }

        public virtual Episodios Episodios { get; set; }
        public virtual Versiones Versiones { get; set; }
        public virtual Videos Videos { get; set; }
    }



public partial class Series
    {
        public Series()
        {
            this.Episodios = new HashSet<Episodios>();
        }

        public long IDSerie { get; set; }
        public long IDVideo { get; set; }
        public Nullable<short> AnyoInicio { get; set; }
        public Nullable<short> AnyoFin { get; set; }
        public Nullable<short> NumeroTemporadas { get; set; }

        public virtual ICollection<Episodios> Episodios { get; set; }
        public virtual Videos Videos { get; set; }
    }



public partial class Episodios
    {
        public Episodios()
        {
            this.VideosVersiones = new HashSet<VideosVersiones>();
        }

        public long IDEpisodio { get; set; }
        public long IDSerie { get; set; }
        public byte Temporada { get; set; }
        public byte Episodio { get; set; }
        public string Titulo { get; set; }
        public Nullable<byte> Anyo { get; set; }

        public virtual Series Series { get; set; }
        public virtual ICollection<VideosVersiones> VideosVersiones { get; set; }
    }

Thanks.

4

0 回答 0