我构建了一个简单的查询返回一个用户组的成员(N:N的关系)。 这为所有用户工作正常,但是当我添加一个where子句来限制它抛出一个错误异常的特定用户(见下面的堆栈跟踪)。
奇怪的是这个工作正常“其中Users.FullName.StartsWith(”亚历克斯“)”。 请问动态CRM SDK LINQ实现不支持在where子句中的GUID?
有什么建议?
示例代码
using (var service = new OrganizationService("Xrm"))
{
using (var xrm = new XrmServiceContext(service))
{
var AlexUser = xrm.SystemUserSet.Where(p => p.FullName.StartsWith("Alex")).First();
var AlexID = AlexUser.Id;
var Test =
from Users in xrm.SystemUserSet
join TeamMemberships in xrm.TeamMembershipSet on Users.Id equals TeamMemberships.SystemUserId
join Teams in xrm.TeamSet on TeamMemberships.TeamId equals Teams.Id
where Users.Id == AlexID // <-- problematic where clause
orderby Users.FullName
select new
{
FullName = Users.FullName,
UserID = Users.Id,
TeamName = Teams.Name
};
var Test1 = Test.ToList();
}
}
堆栈跟踪 :
服务器堆栈跟踪:在System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime操作,ProxyRpc&RPC)在System.ServiceModel.Channels.ServiceChannel.Call(字符串动作,布尔单向,ProxyOperationRuntime操作,对象[]项,对象[]奏,时间跨度超时)在System.ServiceModel.Channels.ServiceChannel.Call(字符串动作,布尔单向,ProxyOperationRuntime操作,对象[]项,在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage包括methodCall,ProxyOperationRuntime操作对象[]奏) )在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即时聊天消息)
在异常重新抛出[0]:在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天reqMsg,即时聊天retMsg)处Microsoft.Xrm System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&MSGDATA,的Int32类型)。 Sdk.IOrganizationService.Execute在Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest请求)在Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Execute(OrganizationRequest请求)在Microsoft.Xrm.Client.Services(OrganizationRequest请求)。 OrganizationService。<> C_ DisplayClass19.b _18(IOrganizationService S)在Microsoft.Xrm.Client.Services.OrganizationService.InnerOrganizationService.UsingService [TResult](Func键
2 action) at Microsoft.Xrm.Client.Services.OrganizationService.Execute(OrganizationRequest request) at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request) at Microsoft.Xrm.Sdk.Linq.QueryProvider.RetrieveEntityCollection(OrganizationRequest request, NavigationSource source) at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List
2 action) at Microsoft.Xrm.Client.Services.OrganizationService.Execute(OrganizationRequest request) at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request) at Microsoft.Xrm.Sdk.Linq.QueryProvider.RetrieveEntityCollection(OrganizationRequest request, NavigationSource source) at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List
1个linkLookups,字符串&pagingCookie,布尔逻辑moreRecords)在Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute [TElement](QueryExpression QE,布尔throwIfSequenceIsEmpty,布尔throwIfSequenceNotSingle,投影投影,NavigationSource源,列表1 linkLookups)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](Expression expression) at Microsoft.Xrm.Sdk.Linq.QueryProvider.GetEnumerator[TElement](Expression expression) at Microsoft.Xrm.Sdk.Linq.Query1 linkLookups)
at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](Expression expression) at Microsoft.Xrm.Sdk.Linq.QueryProvider.GetEnumerator[TElement](Expression expression) at Microsoft.Xrm.Sdk.Linq.Query1 linkLookups)
1。的GetEnumerator()在System.Collections.Generic.List
at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](Expression expression) at Microsoft.Xrm.Sdk.Linq.QueryProvider.GetEnumerator[TElement](Expression expression) at Microsoft.Xrm.Sdk.Linq.Query1..ctor(IEnumerable
1集)
在System.Linq.Enumerable.ToList [TSource](IEnumerable`1源)在aspirets.crm.test.Program.Main(字串[] args)在C:\用户\ a_marshall \文件\视觉工作室2010 \项目\ aspirets .crm \ aspirets.crm.test \ Program.cs的:线37在System.AppDomain._nExecuteAssembly(RuntimeAssembly组件,字串[] args)在System.AppDomain.ExecuteAssembly(字符串assemblyFile,证据assemblySecurity,字串[] args)在微软.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
在System.Threading.ThreadHelper.ThreadStart_Context(对象状态)
在System.Threading.ExecutionContext.Run(的ExecutionContext的ExecutionContext,ContextCallback回调,对象的状态,布尔ignoreSyncCtx)在System.Threading.ExecutionContext.Run(的ExecutionContext的ExecutionContext,ContextCallback回调,对象状态)在System.Threading.ThreadHelper.ThreadStart()