Home
Options

Will LINQKit work with EF 5.0?

edited July 2012
Hi,
We're using LINQKit on our Production environment, and we're not sure if it'll break with EF 5.0 .
Please advise.
Regards,
Shlomi

Comments

  • Options
    I'm not aware of any issues with EF 5.0, although I've not tested it.
  • Options
    I have a problem and as near as I can tell, it's with LinqKit and EF 5.0.

    I have the following code:
    public IEnumerable Get(Expression> filter = null)
    {
    IQueryable query = DbSet;

    if (filter != null)
    query = query.AsExpandable().Where(filter);

    return query.ToList();
    }
    And when run, it fails in LinqKit in ExpandableQuery at:
    Expression IQueryable.Expression { get { return _inner.Expression; } }
    with the error:
    System.Data.MetadataException occurred
    HResult=-2146232007
    Message=Schema specified is not valid. Errors:
    error 0194: All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered.
    Source=System.Data.Entity
    StackTrace:
    at System.Data.Metadata.Edm.EdmItemCollection.LoadItems(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModelOption, DbProviderManifest providerManifest, ItemCollection itemCollection, Boolean throwOnError)
    at System.Data.Metadata.Edm.EdmItemCollection.Init(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths, Boolean throwOnError)
    at System.Data.Metadata.Edm.EdmItemCollection..ctor(IEnumerable`1 xmlReaders, IEnumerable`1 filePaths)
    at System.Data.Metadata.Edm.MetadataCache.EdmMetadataEntry.LoadEdmItemCollection(MetadataArtifactLoader loader)
    at System.Data.Metadata.Edm.MetadataCache.EdmItemCollectionLoader.LoadItemCollection(EdmMetadataEntry entry)
    at System.Data.Metadata.Edm.MetadataCache.LoadItemCollection[T](IItemCollectionLoader`1 itemCollectionLoader, T entry)
    at System.Data.Metadata.Edm.MetadataCache.GetOrCreateEdmItemCollection(String cacheKey, MetadataArtifactLoader loader, Object& entryToken)
    at System.Data.EntityClient.EntityConnection.LoadEdmItemCollection(MetadataWorkspace workspace, MetadataArtifactLoader artifactLoader)
    at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
    at System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
    at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
    at System.Data.Objects.ObjectContext..ctor(EntityConnection connection)
    at System.Data.Entity.Internal.InternalConnection.CreateObjectContextFromConnectionModel()
    at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
    at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
    at System.Data.Entity.Internal.InternalContext.Initialize()
    at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
    at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
    at System.Data.Entity.Internal.Linq.InternalSet`1.get_Expression()
    at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Expression()
    at LinqKit.ExpandableQuery`1.System.Linq.IQueryable.get_Expression()
    InnerException:
    If I use EF 4.0 instead, it works fine.

    Any ideas?
  • Options
    Found the issue. There was an older EDMX version file from another project in the solution. Once I updated that too, all is good.
Sign In or Register to comment.