/// <summary> /// Constructs an instance of the ODataVersionCache. /// </summary> /// <param name="factory">The method to call to create a new instance of <typeparamref name="T"/> for a given ODataVersion.</param> internal ODataVersionCache(Func <ODataVersion, T> factory) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(factory != null, "factory != null"); this.v1 = new SimpleLazy <T>(() => factory(ODataVersion.V1), true /*isThreadSafe*/); this.v2 = new SimpleLazy <T>(() => factory(ODataVersion.V2), true /*isThreadSafe*/); this.v3 = new SimpleLazy <T>(() => factory(ODataVersion.V3), true /*isThreadSafe*/); }
/// <summary> /// Constructs an instance of <see cref="ODataFeedAndEntryTypeContext"/>. /// </summary> /// <param name="entitySet">The entity set of the feed or entry.</param> /// <param name="entitySetElementType">The element type of the entity set.</param> /// <param name="expectedEntityType">The expected entity type of the feed or entry.</param> /// <param name="model">The Edm model instance to use.</param> internal ODataFeedAndEntryTypeContextWithModel(IEdmEntitySet entitySet, IEdmEntityType entitySetElementType, IEdmEntityType expectedEntityType, IEdmModel model) : base(/*throwIfMissingTypeInfo*/ false) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(model != null, "model != null"); Debug.Assert(entitySet != null, "entitySet != null"); Debug.Assert(entitySetElementType != null, "entitySetElementType != null"); Debug.Assert(expectedEntityType != null, "expectedEntityType != null"); this.entitySet = entitySet; this.entitySetElementType = entitySetElementType; this.expectedEntityType = expectedEntityType; this.model = model; this.lazyEntitySetName = new SimpleLazy <string>(() => this.model.IsDefaultEntityContainer(this.entitySet.Container) ? this.entitySet.Name : this.entitySet.Container.FullName() + "." + this.entitySet.Name); this.lazyIsMediaLinkEntry = new SimpleLazy <bool>(() => this.model.HasDefaultStream(this.expectedEntityType)); this.lazyUrlConvention = new SimpleLazy <UrlConvention>(() => UrlConvention.ForEntityContainer(this.model, this.entitySet.Container)); }