TopL TopM TopR
MiddleL

LINQ - Schema specified is not valid

Jun 5

Written by:
6/5/2011 8:39 AM  RssIcon

The types in the assembly ‘{0}’ cannot be loaded because the assembly contains the EdmSchemaAttribute, and the closure of types is being loaded by name.  Loading by both name and attribute is not allowed.

This is a tough one. So you’re trying to get things faster by precompiling queries, eh?
Something like:
static readonly Func< Context,
            QueryParams,
IQueryable< ReturnType>>
            QueryFunc =
            System.Data.Objects.CompiledQuery.Compile(
            (Context ctx, QueryParams queryInfo) => (…)

One way to bypass the error is to have your Context entity declared statically and globally (to the eyes of the function). Then change ctx (in the function) to ctxDummy. Leave all the function contents intact. This has the drawback of thread access and such becoming increasingly difficult.

Other approach (painfull, also) is to guarantee that there are no two classes with the same name, despite their namespaces. PublicObject.Client BDObject.Client will cause this error.

Tags: LINQ
Categories:
Location: Blogs Parent Separator keystrokes
MiddleR
BottomL BottomM BottomR