public static bool GetDottedName(System.Data.Entity.Core.SchemaObjectModel.Schema schema, XmlReader reader, out string name) { if (!Utils.GetString(schema, reader, out name)) { return(false); } return(Utils.ValidateDottedName(schema, reader, name)); }
public static bool GetString(System.Data.Entity.Core.SchemaObjectModel.Schema schema, XmlReader reader, out string value) { if (reader.SchemaInfo.Validity == XmlSchemaValidity.Invalid) { value = (string)null; return(false); } value = reader.Value; if (!string.IsNullOrEmpty(value)) { return(true); } schema.AddError(ErrorCode.InvalidName, EdmSchemaErrorSeverity.Error, reader, (object)Strings.InvalidName((object)value, (object)reader.Name)); return(false); }
public static bool GetByte(System.Data.Entity.Core.SchemaObjectModel.Schema schema, XmlReader reader, out byte value) { if (reader.SchemaInfo.Validity == XmlSchemaValidity.Invalid) { value = (byte)0; return(false); } string s = reader.Value; value = (byte)0; if (byte.TryParse(s, NumberStyles.Integer, (IFormatProvider)CultureInfo.InvariantCulture, out value)) { return(true); } schema.AddError(ErrorCode.ByteValueExpected, EdmSchemaErrorSeverity.Error, reader, (object)Strings.ValueNotUnderstood((object)reader.Value, (object)reader.Name)); return(false); }
internal static bool ValidateDottedName(System.Data.Entity.Core.SchemaObjectModel.Schema schema, XmlReader reader, string name) { if (schema.DataModel == SchemaDataModelOption.EntityDataModel) { string str = name; char[] chArray = new char[1] { '.' }; foreach (string name1 in str.Split(chArray)) { if (!name1.IsValidUndottedName()) { schema.AddError(ErrorCode.InvalidName, EdmSchemaErrorSeverity.Error, reader, (object)Strings.InvalidName((object)name, (object)reader.Name)); return(false); } } } return(true); }
public static bool GetBool(System.Data.Entity.Core.SchemaObjectModel.Schema schema, XmlReader reader, out bool value) { if (reader.SchemaInfo.Validity == XmlSchemaValidity.Invalid) { value = true; return(false); } try { value = reader.ReadContentAsBoolean(); return(true); } catch (XmlException ex) { schema.AddError(ErrorCode.BoolValueExpected, EdmSchemaErrorSeverity.Error, reader, (object)Strings.ValueNotUnderstood((object)reader.Value, (object)reader.Name)); } value = true; return(false); }
public static bool GetUndottedName(System.Data.Entity.Core.SchemaObjectModel.Schema schema, XmlReader reader, out string name) { if (reader.SchemaInfo.Validity == XmlSchemaValidity.Invalid) { name = (string)null; return(false); } name = reader.Value; if (string.IsNullOrEmpty(name)) { schema.AddError(ErrorCode.InvalidName, EdmSchemaErrorSeverity.Error, reader, (object)Strings.EmptyName((object)reader.Name)); return(false); } if (schema.DataModel != SchemaDataModelOption.EntityDataModel || name.IsValidUndottedName()) { return(true); } schema.AddError(ErrorCode.InvalidName, EdmSchemaErrorSeverity.Error, reader, (object)Strings.InvalidName((object)name, (object)reader.Name)); return(false); }
internal SchemaElement(SchemaElement parentElement, IDbDependencyResolver resolver = null) { this._resolver = resolver ?? DbConfiguration.DependencyResolver; if (parentElement == null) { return; } this.ParentElement = parentElement; for (SchemaElement schemaElement = parentElement; schemaElement != null; schemaElement = schemaElement.ParentElement) { System.Data.Entity.Core.SchemaObjectModel.Schema schema = schemaElement as System.Data.Entity.Core.SchemaObjectModel.Schema; if (schema != null) { this.Schema = schema; break; } } if (this.Schema == null) { throw new InvalidOperationException(Strings.AllElementsMustBeInSchema); } }