Ticket Hash: | 9e0983eb01795fc9fe6f88193ba1796a4b03d95b | |||
Title: | SQL logic error or missing database\r\nunrecognized token | |||
Status: | Closed | Type: | Incident | |
Severity: | Important | Priority: | Medium | |
Subsystem: | LINQ | Resolution: | Works_As_Designed | |
Last Modified: | 2013-08-19 21:05:43 | |||
Version Found In: | 1.0.88.0 | |||
User Comments: | ||||
anonymous added on 2013-08-17 18:47:58:
(text/x-fossil-plain)
I have this tables in my sqlite database: 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; } } I want to get the Videos, and its related VideosVersiones, so I am trying to use eager loading. using (catalogoEntities miContexto = new catalogoEntities()) { lstResultado = miContexto.Videos .Include(v=>v.VideosVersiones) .Include(v => v.Generos).ToList<Videos>(); } I get this error: en System.Data.EntityKey.AddHashValue(Int32 hashCode, Object keyValue) en System.Data.EntityKey.GetHashCode() en System.Collections.Generic.GenericEqualityComparer`1.GetHashCode(T obj) en System.Collections.Generic.Dictionary`2.FindEntry(TKey key) en System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value) en System.Data.Objects.ObjectStateManager.TryGetEntityEntry(EntityKey key, EntityEntry& entry) en System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet) en lambda_method(Closure , Shaper ) en System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper) en System.Data.Common.Internal.Materialization.Shaper`1.RowNestedResultEnumerator.MoveNext() en System.Data.Common.Internal.Materialization.Shaper`1.ObjectQueryNestedEnumerator.TryReadToNextElement() en System.Data.Common.Internal.Materialization.Shaper`1.ObjectQueryNestedEnumerator.ReadElement() en System.Data.Common.Internal.Materialization.Shaper`1.ObjectQueryNestedEnumerator.MoveNext() en System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) en System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) en Catalogo.Models.RepositorySQLite3.buscarVideos(ParamVideos paramVideo) en C:\proyectos\Catalogo\Catalogo\Models\RepositorySQLite3.cs:lĂnea 168 Is something related with the collection VideosVersiones in the entity Videos, that it seems that is null. But I don't know occurs this, because I can do eager loading of all others related entities. anonymous added on 2013-08-18 10:11:20: (text/x-fossil-plain) Solved. It was my badm bacause I can't use null in a field that is part of a multi field primary key. |