Can't get Dynamic LINQ to work -Reflection error

dynamic-linq linq reflection sql-server

Question

Trying to produce my first sample with Dynamic LINQ and I just can't seem to get it to work. Here's what I've got. NBL It's a bit rugged because I've been culling it back trying to find the problem.

Dim blah = (New dcDataContext).Employees.Where("AccountGUID=@1", accountId)

The error I am getting is:

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.



[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) +0
   System.Reflection.RuntimeModule.GetTypes() +4
   System.Reflection.Assembly.GetTypes() +70
   System.Linq.Dynamic.DefaultDynamicLinqCustomTypeProvider.<FindTypesMarkedWithAttribute>b__0(Assembly x) +38
   System.Linq.<SelectManyIterator>d__14`2.MoveNext() +234
   System.Linq.WhereEnumerableIterator`1.MoveNext() +152
   System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other) +82
   System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer) +125
   System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection) +50
   System.Linq.Dynamic.DefaultDynamicLinqCustomTypeProvider.GetCustomTypes() +81
   System.Linq.Dynamic.ExpressionParser.CreateKeywords() +532
   System.Linq.Dynamic.ExpressionParser..ctor(ParameterExpression[] parameters, String expression, Object[] values) +66
   System.Linq.Dynamic.DynamicExpression.ParseLambda(ParameterExpression[] parameters, Type resultType, String expression, Object[] values) +72
   System.Linq.Dynamic.DynamicExpression.ParseLambda(Type itType, Type resultType, String expression, Object[] values) +132
   System.Linq.Dynamic.DynamicQueryable.Where(IQueryable source, String predicate, Object[] args) +252
   System.Linq.Dynamic.DynamicQueryable.Where(IQueryable`1 source, String predicate, Object[] args) +51
   TimeClock.Linq.Filters.Employees.QueryableExtensions.FromAccount(IQueryable`1 source, Guid accountId) in C:\Visual Studio Projects\mtc
   tc

.login.Page_Load(Object sender, EventArgs e) in C:\Visual Studio Projects\mtc\tc\login.aspx.vb:13 System.Web.UI.Control.OnLoad(EventArgs e) +92 System.Web.UI.Control.LoadRecursive() +54 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

1
1
8/15/2014 6:20:41 AM

Popular Answer

You should write it like this:

Dim blah = (New dcDataContext).Employees.Where("AccountGUID=@0", accountId)

refer:

enter image description here

2
8/15/2014 6:26:41 AM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow