select ca.Name,l.ListName,ci.EntityId,ci.EntityType,c.FullName from List l
inner join Contact c on c.ContactId = 'D48457AB-C0B5-E211-838F-000C29DFF60A'
inner join CampaignItem ci on ci.EntityId = l.ListId
inner join Campaign ca on ca.CampaignId = ci.CampaignId
where l.CreatedFromCode = 2
and ci.EntityType = 4300
如何在 Linq 中加入静态 guid?
这是我的 linq 声明。运行此查询时出现异常。如何将静态 Guid 加入我的查询?
var list = (from li in context.ListSet
join lm in context.ListMemberSet on li.ListId.Value equals lm.ListId.Id
join c in context.ContactSet on lm.EntityId.Id equals on new Guid("D48457AB-C0B5-E211-838F-000C29DFF60A")
join ci in context.CampaignItemSet on li.ListId.Value equals ci.EntityId
join cam in context.CampaignSet on ci.CampaignId.Id equals cam.CampaignId.Value
select new
{
ListId = li.ListId,
ListType = li.Type,
MemberType = li.CreatedFromCode,
EntityType = lm.EntityType,
EntityId = lm.EntityId,
ContactNumber = c.trd_CustomerNumber,
CampaignRelatedEntity = ci.EntityType,
CampaignName = cam.Name == null ? string.Empty : cam.Name,
CampaignCode = cam.CodeName == null ? string.Empty : cam.CodeName,
Objective = cam.Objective == null ? string.Empty : cam.Objective,
CampaignType = cam.TypeCode == null ? string.Empty : ((FinansCrm.BusinessLibrary.Utils.XrmHelper.OptionSetInfo)XrmHelper.GetOption(service, Campaign.EntityLogicalName, "typecode", cam.TypeCode.Value)).Label,
BeginDate = cam.ActualStart == null ? string.Empty : cam.ActualStart.Value.ToString(),
EndDate = cam.ActualEnd == null ? string.Empty : cam.ActualEnd.Value.ToString(),
CampaignId = cam.CampaignId.Value
}).ToList()
.Where(p => p.ListType.Value.Equals(false) && p.EntityType.Equals(Contact.EntityLogicalName) &&
p.MemberType.Value.Equals(Contact.EntityTypeCode) && p.ContactNumber.Equals(id) &&
p.CampaignRelatedEntity.Equals(List.EntityLogicalName))
.ToList();