// ReSharper disable once UnusedParameter.Local private static void ProcessFetchXmlItem(LocalCrmDatabaseOrganizationService service, LinkEntity entityLink, filter filter) { var linkedEntitiesByAliasName = entityLink.LinkEntities.Where(l => l.EntityAlias != null).ToDictionary(e => e.EntityAlias); entityLink.LinkCriteria.AddFilter( GetFilterExpression(service, service.GetType(entityLink.LinkToEntityName), linkedEntitiesByAliasName, filter)); }
private static void AddToFilter(LocalCrmDatabaseOrganizationService service, Type entityType, Dictionary <String, LinkEntity> links, FilterExpression criteria, condition condition) { string entityName = null; if (!String.IsNullOrWhiteSpace(condition.entityname)) { entityName = condition.entityname; entityType = service.GetType(links[condition.entityname].LinkToEntityName); } var property = entityType.GetProperty(condition.attribute) ?? entityType.GetProperty(condition.attribute, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase); if (property == null) { throw new Exception("No Property '" + condition.attribute + "' found for entity type: " + entityType.Name); } var op = Convert(condition.@operator); criteria.AddCondition(entityName, condition.attribute, op, GetConditionValue(condition, property.PropertyType, op)); }