/// <summary> /// Creates Collection instance of store Collection items. /// </summary> /// <param name="edmCollectionTypeReference">The edm collection type reference.</param> /// <param name="clientCollectionType">Type of the client collection.</param> /// <param name="error">Error to throw.</param> /// <returns> /// Newly created Collection instance. Never null. /// </returns> private object CreateCollectionInstance(IEdmCollectionTypeReference edmCollectionTypeReference, Type clientCollectionType, Func <string> error) { Debug.Assert(clientCollectionType != null, "clientCollectionType != null"); Debug.Assert(edmCollectionTypeReference != null, "edmCollectionTypeReference != null"); Debug.Assert(error != null, "error != null"); // DataServiceCollection cannot track non-entity types so it should not be used for storing primitive or complex types if (ClientTypeUtil.IsDataServiceCollection(clientCollectionType)) { throw DSClient.Error.InvalidOperation(DSClient.Strings.AtomMaterializer_DataServiceCollectionNotSupportedForNonEntities); } try { return(this.CreateNewInstance(edmCollectionTypeReference, clientCollectionType)); } #if PORTABLELIB catch (MissingMemberException ex) #else catch (MissingMethodException ex) #endif { throw DSClient.Error.InvalidOperation(error(), ex); } }