/// <summary> /// Loads a model from the store. /// </summary> /// <param name="contextType">The type of context representing the model.</param> /// <returns>The loaded metadata model.</returns> public override DbCompiledModel TryLoad(Type contextType) { return(LoadXml( contextType, reader => { var defaultSchema = GetDefaultSchema(contextType); return EdmxReader.Read(reader, defaultSchema); })); }
public void Read_loads_edmx_from_EdmxWriter_into_DbCompiledModel() { var stream = new MemoryStream(); var xmlWriter = XmlWriter.Create(stream); using (var context = new EmptyContext()) { EdmxWriter.WriteEdmx(context, xmlWriter); } stream.Seek(0, SeekOrigin.Begin); var defaultSchema = "default"; var xmlReader = XmlReader.Create(stream); var readModel = EdmxReader.Read(xmlReader, defaultSchema); Assert.IsType <DbCompiledModel>(readModel); Assert.Equal(defaultSchema, readModel.DefaultSchema); Assert.NotNull(readModel.ProviderInfo); }
public void Read_throws_when_given_null_reader() { Assert.Equal( "reader", Assert.Throws <ArgumentNullException>(() => EdmxReader.Read(null, "defaultSchema")).ParamName); }