// <summary> // Search for a Mapping metadata with the specified type key. // </summary> // <returns> Returns false if no match found. </returns> internal override bool TryGetMap(GlobalItem item, out MappingBase map) { if (item == null) { map = null; return(false); } var typeSpace = item.DataSpace; //For transient types just create a map on fly and return var edmType = item as EdmType; if (edmType != null) { if (Helper.IsTransientType(edmType)) { map = GetOCMapForTransientType(edmType, typeSpace); if (map != null) { return(true); } else { return(false); } } } return(TryGetMap(item.Identity, typeSpace, out map)); }
internal virtual bool TryGetMap( string identity, DataSpace typeSpace, bool ignoreCase, out MappingBase map) { throw Error.NotSupported(); }
internal override bool TryGetMap(GlobalItem item, out MappingBase map) { if (item == null) { map = (MappingBase)null; return(false); } DataSpace dataSpace = item.DataSpace; EdmType edmType = item as EdmType; if (edmType == null || !Helper.IsTransientType(edmType)) { return(this.TryGetMap(item.Identity, dataSpace, out map)); } map = this.GetOCMapForTransientType(edmType, dataSpace); return(map != null); }
// <summary> // Search for a Mapping metadata with the specified type key. // </summary> // <param name="identity"> identity of the type </param> // <param name="typeSpace"> The dataspace that the type for which map needs to be returned belongs to </param> // <returns> Returns false if no match found. </returns> internal override bool TryGetMap(string identity, DataSpace typeSpace, out MappingBase map) { return(TryGetMap(identity, typeSpace, false /*ignoreCase*/, out map)); }
// <summary> // Search for a Mapping metadata with the specified type key. // </summary> // <returns> Returns false if no match found. </returns> internal override bool TryGetMap(GlobalItem item, out MappingBase map) { if (item == null) { map = null; return false; } var typeSpace = item.DataSpace; if (typeSpace != DataSpace.CSpace) { map = null; return false; } return TryGetMap(item.Identity, typeSpace, out map); }
// <summary> // Search for a Mapping metadata with the specified type key. // </summary> // <param name="identity"> identity of the type </param> // <param name="typeSpace"> The dataspace that the type for which map needs to be returned belongs to </param> // <returns> Returns false if no match found. </returns> internal override bool TryGetMap(string identity, DataSpace typeSpace, out MappingBase map) { return TryGetMap(identity, typeSpace, false /*ignoreCase*/, out map); }
// <summary> // Search for a Mapping metadata with the specified type key. // </summary> // <param name="identity"> identity of the type </param> // <param name="typeSpace"> The dataspace that the type for which map needs to be returned belongs to </param> // <param name="ignoreCase"> true for case-insensitive lookup </param> // <returns> Returns false if no match found. </returns> internal override bool TryGetMap(string identity, DataSpace typeSpace, bool ignoreCase, out MappingBase map) { if (typeSpace != DataSpace.CSpace) { throw new InvalidOperationException(Strings.Mapping_Storage_InvalidSpace(typeSpace)); } return TryGetItem(identity, ignoreCase, out map); }
// Add to the cache. If it is already present, then throw an exception private void AddInternal(MappingBase storageMap) { storageMap.DataSpace = DataSpace.CSSpace; try { base.AddInternal(storageMap); } catch (ArgumentException e) { throw new MappingException(Strings.Mapping_Duplicate_Type(storageMap.EdmItem.Identity), e); } }
// <summary> // Search for a Mapping metadata with the specified type key. // </summary> // <param name="identity"> identity of the type </param> // <param name="typeSpace"> The dataspace that the type for which map needs to be returned belongs to </param> // <param name="ignoreCase"> true for case-insensitive lookup </param> // <returns> Returns false if no match found. </returns> internal virtual bool TryGetMap(string identity, DataSpace typeSpace, bool ignoreCase, out MappingBase map) { //will only be implemented by Mapping Item Collections throw Error.NotSupported(); }
internal override bool TryGetMap( string identity, DataSpace typeSpace, bool ignoreCase, out MappingBase map) { EdmType edmType1 = (EdmType)null; EdmType edmType2 = (EdmType)null; switch (typeSpace) { case DataSpace.OSpace: if (ignoreCase) { if (!this._objectCollection.TryGetItem <EdmType>(identity, true, out edmType2)) { map = (MappingBase)null; return(false); } identity = edmType2.Identity; } int index1; if (this._clrTypeIndexes.TryGetValue(identity, out index1)) { map = (MappingBase)this[index1]; return(true); } if (edmType2 != null || this._objectCollection.TryGetItem <EdmType>(identity, ignoreCase, out edmType2)) { this._edmCollection.TryGetItem <EdmType>(ObjectItemCollection.TryGetMappingCSpaceTypeIdentity(edmType2), out edmType1); break; } break; case DataSpace.CSpace: if (ignoreCase) { if (!this._edmCollection.TryGetItem <EdmType>(identity, true, out edmType1)) { map = (MappingBase)null; return(false); } identity = edmType1.Identity; } int index2; if (this._edmTypeIndexes.TryGetValue(identity, out index2)) { map = (MappingBase)this[index2]; return(true); } if (edmType1 != null || this._edmCollection.TryGetItem <EdmType>(identity, ignoreCase, out edmType1)) { this._objectCollection.TryGetOSpaceType(edmType1, out edmType2); break; } break; } if (edmType2 == null || edmType1 == null) { map = (MappingBase)null; return(false); } map = this.GetDefaultMapping(edmType1, edmType2); return(true); }
internal override bool TryGetMap(string identity, DataSpace typeSpace, out MappingBase map) { return(this.TryGetMap(identity, typeSpace, false, out map)); }
// <summary> // Search for a Mapping metadata with the specified type key. // </summary> // <param name="identity"> identity of the type </param> // <param name="typeSpace"> The dataspace that the type for which map needs to be returned belongs to </param> // <param name="ignoreCase"> true for case-insensitive lookup </param> // <returns> Returns false if no match found. </returns> internal override bool TryGetMap(string identity, DataSpace typeSpace, bool ignoreCase, out MappingBase map) { EdmType cdmType = null; EdmType clrType = null; if (typeSpace == DataSpace.CSpace) { if (ignoreCase) { // Get the correct casing of the identity first if we are asked to do ignore case if (!_edmCollection.TryGetItem(identity, true, out cdmType)) { map = null; return false; } identity = cdmType.Identity; } int index; if (_edmTypeIndexes.TryGetValue(identity, out index)) { map = (MappingBase)this[index]; return true; } if (cdmType != null || _edmCollection.TryGetItem(identity, ignoreCase, out cdmType)) { // If the mapping is not already loaded, then get the mapping ospace type _objectCollection.TryGetOSpaceType(cdmType, out clrType); } } else if (typeSpace == DataSpace.OSpace) { if (ignoreCase) { // Get the correct casing of the identity first if we are asked to do ignore case if (!_objectCollection.TryGetItem(identity, true, out clrType)) { map = null; return false; } identity = clrType.Identity; } int index; if (_clrTypeIndexes.TryGetValue(identity, out index)) { map = (MappingBase)this[index]; return true; } if (clrType != null || _objectCollection.TryGetItem(identity, ignoreCase, out clrType)) { // If the mapping is not already loaded, get the mapping cspace type var cspaceTypeName = ObjectItemCollection.TryGetMappingCSpaceTypeIdentity(clrType); _edmCollection.TryGetItem(cspaceTypeName, out cdmType); } } if ((clrType == null) || (cdmType == null)) { map = null; return false; } else { map = GetDefaultMapping(cdmType, clrType); return true; } }
// <summary> // Search for a Mapping metadata with the specified type key. // </summary> // <returns> Returns false if no match found. </returns> internal override bool TryGetMap(GlobalItem item, out MappingBase map) { if (item == null) { map = null; return false; } var typeSpace = item.DataSpace; //For transient types just create a map on fly and return var edmType = item as EdmType; if (edmType != null) { if (Helper.IsTransientType(edmType)) { map = GetOCMapForTransientType(edmType, typeSpace); if (map != null) { return true; } else { return false; } } } return TryGetMap(item.Identity, typeSpace, out map); }
// <summary> // Given a map, dereference the EdmItem, ensure that it is // an EdmType and return a TypeUsage for the type, otherwise // return null. // </summary> // <param name="map"> The OC map to use to get the EdmType </param> // <returns> A TypeUsage for the mapped EdmType or null if no EdmType was mapped </returns> private static TypeUsage GetMappedTypeUsage(MappingBase map) { TypeUsage typeUsage = null; if (null != map) { var item = map.EdmItem; var edmItem = item as EdmType; if (null != item && edmItem != null) { typeUsage = TypeUsage.Create(edmItem); } } return typeUsage; }
// <summary> // Search for a Mapping metadata with the specified type key. // </summary> // <returns> Returns false if no match found. </returns> internal virtual bool TryGetMap(GlobalItem item, out MappingBase map) { //will only be implemented by Mapping Item Collections throw Error.NotSupported(); }
// <summary> // Search for a Mapping metadata with the specified type key. // </summary> // <param name="identity"> identity of the type </param> // <param name="typeSpace"> The dataspace that the type for which map needs to be returned belongs to </param> // <param name="ignoreCase"> true for case-insensitive lookup </param> // <returns> Returns false if no match found. </returns> internal override bool TryGetMap(string identity, DataSpace typeSpace, bool ignoreCase, out MappingBase map) { EdmType cdmType = null; EdmType clrType = null; if (typeSpace == DataSpace.CSpace) { if (ignoreCase) { // Get the correct casing of the identity first if we are asked to do ignore case if (!_edmCollection.TryGetItem(identity, true, out cdmType)) { map = null; return(false); } identity = cdmType.Identity; } int index; if (_edmTypeIndexes.TryGetValue(identity, out index)) { map = (MappingBase)this[index]; return(true); } if (cdmType != null || _edmCollection.TryGetItem(identity, ignoreCase, out cdmType)) { // If the mapping is not already loaded, then get the mapping ospace type _objectCollection.TryGetOSpaceType(cdmType, out clrType); } } else if (typeSpace == DataSpace.OSpace) { if (ignoreCase) { // Get the correct casing of the identity first if we are asked to do ignore case if (!_objectCollection.TryGetItem(identity, true, out clrType)) { map = null; return(false); } identity = clrType.Identity; } int index; if (_clrTypeIndexes.TryGetValue(identity, out index)) { map = (MappingBase)this[index]; return(true); } if (clrType != null || _objectCollection.TryGetItem(identity, ignoreCase, out clrType)) { // If the mapping is not already loaded, get the mapping cspace type var cspaceTypeName = ObjectItemCollection.TryGetMappingCSpaceTypeIdentity(clrType); _edmCollection.TryGetItem(cspaceTypeName, out cdmType); } } if ((clrType == null) || (cdmType == null)) { map = null; return(false); } else { map = GetDefaultMapping(cdmType, clrType); return(true); } }
internal virtual bool TryGetMap(GlobalItem item, out MappingBase map) { throw Error.NotSupported(); }