/// <summary> /// Ctor. /// </summary> /// <param name="eventAdapterService">The event adapter service.</param> /// <param name="metadata">event type metadata</param> /// <param name="eventTypeId">The event type id.</param> /// <param name="variantSpec">the variant specification</param> /// <param name="propertyResStrategy">stragegy for resolving properties</param> /// <param name="config">The config.</param> public VariantEventType( EventAdapterService eventAdapterService, EventTypeMetadata metadata, int eventTypeId, VariantSpec variantSpec, VariantPropResolutionStrategy propertyResStrategy, ConfigurationVariantStream config) { _eventAdapterService = eventAdapterService; _metadata = metadata; _eventTypeId = eventTypeId; _variants = variantSpec.EventTypes; _propertyResStrategy = propertyResStrategy; _config = config; _propertyDesc = new Dictionary <String, VariantPropertyDesc>(); foreach (EventType type in _variants) { IList <string> properties = type.PropertyNames; properties = PropertyUtility.CopyAndSort(properties); foreach (String property in properties) { if (!_propertyDesc.ContainsKey(property)) { FindProperty(property); } } } ICollection <String> propertyNameKeySet = _propertyDesc.Keys; _propertyNames = propertyNameKeySet.ToArray(); // for each of the properties in each type, attempt to load the property to build a property list _propertyDescriptors = new EventPropertyDescriptor[_propertyDesc.Count]; _propertyDescriptorMap = new Dictionary <String, EventPropertyDescriptor>(); int count = 0; foreach (var desc in _propertyDesc) { var type = desc.Value.PropertyType; var indexType = type.GetIndexType(); var isIndexed = indexType != null; var descriptor = new EventPropertyDescriptor(desc.Key, type, indexType, false, false, isIndexed, false, desc.Value.PropertyType.IsFragmentableType()); _propertyDescriptors[count++] = descriptor; _propertyDescriptorMap.Put(desc.Key, descriptor); } }
/// <summary> /// Ctor. /// </summary> /// <param name="variantSpec">the variant specification</param> /// <param name="metadata">event type metadata</param> public VariantEventType( EventTypeMetadata metadata, VariantSpec variantSpec) { Metadata = metadata; Variants = variantSpec.EventTypes; IsVariantAny = variantSpec.TypeVariance == TypeVariance.ANY; VariantPropertyGetterCache = new VariantPropertyGetterCache(variantSpec.EventTypes); if (IsVariantAny) { propertyResStrategy = new VariantPropResolutionStrategyAny(this); } else { propertyResStrategy = new VariantPropResolutionStrategyDefault(this); } propertyDesc = new Dictionary<string, VariantPropertyDesc>(); foreach (var type in Variants) { foreach (var property in CollectionUtil.CopyAndSort(type.PropertyNames)) { if (!propertyDesc.ContainsKey(property)) { FindProperty(property); } } } var propertyNameKeySet = propertyDesc.Keys; PropertyNames = propertyNameKeySet.ToArray(); // for each of the properties in each type, attempt to load the property to build a property list PropertyDescriptors = new EventPropertyDescriptor[propertyDesc.Count]; propertyDescriptorMap = new Dictionary<string, EventPropertyDescriptor>(); var count = 0; foreach (var desc in propertyDesc) { var type = desc.Value.PropertyType; var descriptor = new EventPropertyDescriptor( desc.Key, type, type.GetIndexType(), false, false, type.IsIndexed(), false, desc.Value.PropertyType.IsFragmentableType()); PropertyDescriptors[count++] = descriptor; propertyDescriptorMap.Put(desc.Key, descriptor); } }