/// <summary> /// Constructor. /// </summary> internal EpmResourceTypeAnnotation() { DebugUtils.CheckNoExternalCallers(); // Note that we new up everything here eagerly because we will only create the EPM annotation for types // for which we know for sure that they have EPM and thus we will need all of these anyway. this.inheritedEpmAttributes = new List<EntityPropertyMappingAttribute>(); this.ownEpmAttributes = new List<EntityPropertyMappingAttribute>(); this.epmTargetTree = new EpmTargetTree(); this.epmSourceTree = new EpmSourceTree(this.epmTargetTree); }
/// <summary> /// Constructor. /// </summary> /// <param name="mappings">The EPM mappings to create the cache for.</param> /// <param name="model">The EDM model.</param> /// <param name="totalMappingCount">The total number of entity property mappings /// for the entity type that this cache is created for (on the type itself and all its base types).</param> internal ODataEntityPropertyMappingCache(ODataEntityPropertyMappingCollection mappings, IEdmModel model, int totalMappingCount) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(model.IsUserModel(), "model.IsUserModel()"); this.mappings = mappings; this.model = model; this.totalMappingCount = totalMappingCount; // Note that we new up everything here eagerly because we will only create the EPM annotation for types // for which we know for sure that they have EPM and thus we will need all of these anyway. this.mappingsForInheritedProperties = new List <EntityPropertyMappingAttribute>(); this.mappingsForDeclaredProperties = mappings == null ? new List <EntityPropertyMappingAttribute>() : new List <EntityPropertyMappingAttribute>(mappings); this.epmTargetTree = new EpmTargetTree(); this.epmSourceTree = new EpmSourceTree(this.epmTargetTree); }
/// <summary> /// Constructor. /// </summary> /// <param name="mappings">The EPM mappings to create the cache for.</param> /// <param name="model">The EDM model.</param> /// <param name="totalMappingCount">The total number of entity property mappings /// for the entity type that this cache is created for (on the type itself and all its base types).</param> internal ODataEntityPropertyMappingCache(ODataEntityPropertyMappingCollection mappings, IEdmModel model, int totalMappingCount) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(model.IsUserModel(), "model.IsUserModel()"); this.mappings = mappings; this.model = model; this.totalMappingCount = totalMappingCount; // Note that we new up everything here eagerly because we will only create the EPM annotation for types // for which we know for sure that they have EPM and thus we will need all of these anyway. this.mappingsForInheritedProperties = new List<EntityPropertyMappingAttribute>(); this.mappingsForDeclaredProperties = mappings == null ? new List<EntityPropertyMappingAttribute>() : new List<EntityPropertyMappingAttribute>(mappings); this.epmTargetTree = new EpmTargetTree(); this.epmSourceTree = new EpmSourceTree(this.epmTargetTree); }
/// <summary> /// Removes all data created internally by ResourceType. This is needed when building epm /// info fails since the trees may be left in undefined state (i.e. half constructed) and /// if inherited EPM attributes exist duplicates will be added. /// </summary> internal void Reset() { this.epmTargetTree = null; this.epmSourceTree = null; this.inheritedEpmInfo = null; }
/// <summary> /// Cache all the properties and collection item enumerations needed for EPM processing. /// </summary> /// <param name="propertyValueCache">The property value cache to cache the EPM related properties in.</param> /// <param name="sourceTree">The source tree describing all properties taking part in entity property mappings.</param> internal static void CacheEpmProperties(EntryPropertiesValueCache propertyValueCache, EpmSourceTree sourceTree) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(propertyValueCache != null, "propertyValueCache != null"); Debug.Assert(sourceTree != null, "sourceTree != null"); EpmSourcePathSegment rootSegment = sourceTree.Root; Debug.Assert(rootSegment.PropertyName == null, "Root segment should have 'null' property name."); CacheEpmSourcePathSegments(propertyValueCache, rootSegment.SubProperties, propertyValueCache.EntryProperties); }
internal static void CacheEpmProperties(EntryPropertiesValueCache propertyValueCache, EpmSourceTree sourceTree) { EpmSourcePathSegment root = sourceTree.Root; CacheEpmSourcePathSegments(propertyValueCache, root.SubProperties, propertyValueCache.EntryProperties); }