所以我使用SPmetal工具生成数据类以使用LINQ to SharePoint.
该工具的一个功能是通过其显示名称使站点列别名.
如何覆盖SPMetal设置以使用内部名称或静态名称?
在我们的SharePoint 2010项目中,我们使用Linq to SharePoint来获取ConfigurationItems列表.在我们的测试环境中,我们从未从此列表中获取数据时遇到问题.在我们的生产环境中,我们现在有时(我们现在找不到模式)在循环遍历列表中的项时获取空引用异常.
以下是从Linq到SharePoint代码抛出的异常:
Object reference not set to an instance of an object. StackTrace: at Microsoft.SharePoint.Linq.FieldRef.GetHashCode() at Microsoft.SharePoint.Linq.FieldRef.FieldRefEqualityComparer.GetHashCode(FieldRef obj) at System.Linq.Set`1.InternalGetHashCode(TElement value) at System.Linq.Set`1.Find(TElement value, Boolean add) at System.Linq.Enumerable.d__7a`1.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.SharePoint.Linq.SelectMappingInfo.GetDistinctMappedFields() at Microsoft.SharePoint.Linq.Rules.PushDownProcessor.SelectWithInfoOp.PushDownSelect(Context ctx) at Microsoft.SharePoint.Linq.Rules.PushDownProcessor.SelectWithInfoOp.Process(Context ctx) at Microsoft.SharePoint.Linq.Rules.GuardedRule`4.c__DisplayClass7.b__6(TSourceBase src, TContext ctx) at Microsoft.SharePoint.Linq.Rules.RewriteRule`2.Apply(TNode src, TContext ctx) at Microsoft.SharePoint.Linq.Rules.CacheRule`3.Apply(TSource src, TContext ctx) at Microsoft.SharePoint.Linq.Rules.PushDownProcessor.b__0(Expression e, Context ctx) at Microsoft.SharePoint.Linq.Rules.ChildRule`2.Apply(TNode src, TContext ctx) at Microsoft.SharePoint.Linq.Rules.PushDownProcessor.b__3(Expression e, Context ctx) at Microsoft.SharePoint.Linq.Rules.RewriteRule`2.Apply(TNode src, TContext ctx) …