尝试使用Dynamic LINQ生成我的第一个示例,我似乎无法让它工作。这就是我所拥有的。 NBL它有点崎岖,因为我一直在试图找回问题。
Dim blah = (New dcDataContext).Employees.Where("AccountGUID=@1", accountId)
我得到的错误是:
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
C:\ Visual Studio Projects \ mtc \ tc \ login.aspx.vb中的.login.Page_Load(Object sender,EventArgs e):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
答案 0 :(得分:2)
你应该这样写:
Dim blah = (New dcDataContext).Employees.Where("AccountGUID=@0", accountId)
参阅:
答案 1 :(得分:0)
这完全是奇怪的,但这就是我所做的(尝试修复别的东西),现在它起作用了。我为“所有人”设置了完全访问权限。在文件夹C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Temporary ASP.NET Files
上