internal object GetConditionValue(Type columnValueType, Action handleTypeNotComparable, Action handleInvalidConditionValue) { // Check that the type is supported and comparable. PrimitiveType primitiveType; if (!ClrProviderManifest.Instance.TryGetPrimitiveType(columnValueType, out primitiveType) || !MappingItemLoader.IsTypeSupportedForCondition(primitiveType.PrimitiveTypeKind)) { handleTypeNotComparable(); return(null); } if (_value != null) { if (_value.GetType() == columnValueType) { return(_value); } handleInvalidConditionValue(); return(null); } try { return(_xPathValue.ValueAs(columnValueType)); } catch (FormatException) { handleInvalidConditionValue(); return(null); } }
private static void AddToSchemaErrorsWithMemberInfo( Func <object, string> messageFormat, string errorMember, MappingErrorCode errorCode, string location, IXmlLineInfo lineInfo, IList <EdmSchemaError> parsingErrors) { MappingItemLoader.AddToSchemaErrorsWithMemberInfo( messageFormat, errorMember, errorCode, location, lineInfo, parsingErrors); }
private static void AddToSchemaErrors( string message, MappingErrorCode errorCode, string location, IXmlLineInfo lineInfo, IList <EdmSchemaError> parsingErrors) { MappingItemLoader.AddToSchemaErrors(message, errorCode, location, lineInfo, parsingErrors); }
// <summary> // This helper method loads items based on contents of in-memory XmlReader instances. // Assumption: This method is called only from the constructor because m_extentMappingViews is not thread safe. // </summary> // <param name="xmlReaders"> A list of XmlReader instances </param> // <param name="mappingSchemaUris"> A list of URIs </param> // <returns> A list of schema errors </returns> private List<EdmSchemaError> LoadItems( IEnumerable<XmlReader> xmlReaders, IList<string> mappingSchemaUris, Dictionary<EntitySetBase, GeneratedView> userDefinedQueryViewsDict, Dictionary<OfTypeQVCacheKey, GeneratedView> userDefinedQueryViewsOfTypeDict, double expectedVersion) { Debug.Assert( m_memberMappings.Count == 0, "Assumption: This method is called only once, and from the constructor because m_extentMappingViews is not thread safe."); var errors = new List<EdmSchemaError>(); var index = -1; foreach (var xmlReader in xmlReaders) { index++; string location = null; if (mappingSchemaUris == null) { SchemaManager.TryGetBaseUri(xmlReader, out location); } else { location = mappingSchemaUris[index]; } var mapLoader = new MappingItemLoader( xmlReader, this, location, // ASSUMPTION: location is only used for generating error-messages m_memberMappings); errors.AddRange(mapLoader.ParsingErrors); CheckIsSameVersion(expectedVersion, mapLoader.MappingVersion, errors); // Process container mapping. var containerMapping = mapLoader.ContainerMapping; if (mapLoader.HasQueryViews && containerMapping != null) { // Compile the query views so that we can report the errors in the user specified views. CompileUserDefinedQueryViews(containerMapping, userDefinedQueryViewsDict, userDefinedQueryViewsOfTypeDict, errors); } // Add container mapping if there are no errors and entity container mapping is not already present. if (MetadataHelper.CheckIfAllErrorsAreWarnings(errors) && !Contains(containerMapping)) { containerMapping.SetReadOnly(); AddInternal(containerMapping); } } CheckForDuplicateItems(EdmItemCollection, StoreItemCollection, errors); return errors; }
private static string GetInvalidMemberMappingErrorMessage(EdmMember cSpaceMember, EdmMember sSpaceMember) { return(MappingItemLoader.GetInvalidMemberMappingErrorMessage(cSpaceMember, sSpaceMember)); }
private static TypeUsage ResolveTypeUsageForEnums(TypeUsage typeUsage) { return(MappingItemLoader.ResolveTypeUsageForEnums(typeUsage)); }