internal EFDesignerInfoRoot(EFArtifact parent, XElement element) : base(parent, element) { // Allow the Diagrams node comes from DiagramArtifact. var artifact = Artifact as EntityDesignArtifact; if (artifact != null && artifact.DiagramArtifact != null) { _diagramArtifact = artifact.DiagramArtifact; } }
internal EFDesignerInfoRoot(EFArtifact parent, XElement element) : base(parent, element) { // Allow the Diagrams node comes from DiagramArtifact. var artifact = Artifact as EntityDesignArtifact; if (artifact != null && artifact.DiagramArtifact != null) { _diagramArtifact = artifact.DiagramArtifact; } }
public void DetermineIfArtifactIsDesignerSafe_sets_IsDesignerSafe_to_false_for_xml_that_is_not_using_edmx_namespace() { var modelManager = new Mock <ModelManager>(null, null).Object; var modelProvider = new Mock <XmlModelProvider>().Object; using (var diagramArtifact = new DiagramArtifact(modelManager, new Uri("urn:dummy"), modelProvider)) { diagramArtifact.SetXObject( XDocument.Parse("<Edmx xmlns=\"bar\" />")); diagramArtifact.DetermineIfArtifactIsDesignerSafe(); Assert.False(diagramArtifact.IsDesignerSafe); } }
public void DetermineIfArtifactIsDesignerSafe_sets_IsDesignerSafe_to_true_for_valid_diagram_edmx() { var modelManager = new Mock <ModelManager>(null, null).Object; var modelProvider = new Mock <XmlModelProvider>().Object; using (var diagramArtifact = new DiagramArtifact(modelManager, new Uri("urn:dummy"), modelProvider)) { diagramArtifact.SetXObject( XDocument.Parse("<Edmx Version=\"3.0\" xmlns=\"http://schemas.microsoft.com/ado/2009/11/edmx\" />")); diagramArtifact.DetermineIfArtifactIsDesignerSafe(); Assert.True(diagramArtifact.IsDesignerSafe); } }
public void DetermineIfArtifactIsDesignerSafe_sets_IsDesignerSafe_to_false_for_xml_that_is_not_using_edmx_namespace() { var modelManager = new Mock<ModelManager>(null, null).Object; var modelProvider = new Mock<XmlModelProvider>().Object; using (var diagramArtifact = new DiagramArtifact(modelManager, new Uri("urn:dummy"), modelProvider)) { diagramArtifact.SetXObject( XDocument.Parse("<Edmx xmlns=\"bar\" />")); diagramArtifact.DetermineIfArtifactIsDesignerSafe(); Assert.False(diagramArtifact.IsDesignerSafe); } }
public void DetermineIfArtifactIsDesignerSafe_sets_IsDesignerSafe_to_true_for_valid_diagram_edmx() { var modelManager = new Mock<ModelManager>(null, null).Object; var modelProvider = new Mock<XmlModelProvider>().Object; using (var diagramArtifact = new DiagramArtifact(modelManager, new Uri("urn:dummy"), modelProvider)) { diagramArtifact.SetXObject( XDocument.Parse("<Edmx Version=\"3.0\" xmlns=\"http://schemas.microsoft.com/ado/2009/11/edmx\" />")); diagramArtifact.DetermineIfArtifactIsDesignerSafe(); Assert.True(diagramArtifact.IsDesignerSafe); } }
public void DetermineIfArtifactIsDesignerSafe_sets_IsDesignerSafe_to_false_for_xml_that_is_not_valid_diagram_edmx() { var modelManager = new Mock <ModelManager>(null, null).Object; var modelProvider = new Mock <XmlModelProvider>().Object; using (var diagramArtifact = new DiagramArtifact(modelManager, new Uri("urn:dummy"), modelProvider)) { //missing Version attribute makes the Xml below invalid accoring to the edmx schema diagramArtifact.SetXObject( XDocument.Parse("<Edmx xmlns=\"http://schemas.microsoft.com/ado/2009/11/edmx\" />")); diagramArtifact.DetermineIfArtifactIsDesignerSafe(); Assert.False(diagramArtifact.IsDesignerSafe); } }
public void DetermineIfArtifactIsDesignerSafe_sets_IsDesignerSafe_to_false_for_xml_that_is_not_valid_diagram_edmx() { var modelManager = new Mock<ModelManager>(null, null).Object; var modelProvider = new Mock<XmlModelProvider>().Object; using (var diagramArtifact = new DiagramArtifact(modelManager, new Uri("urn:dummy"), modelProvider)) { //missing Version attribute makes the Xml below invalid accoring to the edmx schema diagramArtifact.SetXObject( XDocument.Parse("<Edmx xmlns=\"http://schemas.microsoft.com/ado/2009/11/edmx\" />")); diagramArtifact.DetermineIfArtifactIsDesignerSafe(); Assert.False(diagramArtifact.IsDesignerSafe); } }
protected override void Dispose(bool disposing) { try { if (disposing) { if (_designerInfoRoot != null) { _designerInfoRoot.Dispose(); _designerInfoRoot = null; } if (_mappingModel != null) { _mappingModel.Dispose(); _mappingModel = null; } if (_conceptualEntityModel != null) { _conceptualEntityModel.Dispose(); _conceptualEntityModel = null; } if (_storageEntityModel != null) { _storageEntityModel.Dispose(); _storageEntityModel = null; } if (DiagramArtifact != null) { ModelManager.ClearArtifact(DiagramArtifact.Uri); DiagramArtifact = null; } } } finally { base.Dispose(disposing); } }
protected override void Dispose(bool disposing) { try { if (disposing) { if (_designerInfoRoot != null) { _designerInfoRoot.Dispose(); _designerInfoRoot = null; } if (_mappingModel != null) { _mappingModel.Dispose(); _mappingModel = null; } if (_conceptualEntityModel != null) { _conceptualEntityModel.Dispose(); _conceptualEntityModel = null; } if (_storageEntityModel != null) { _storageEntityModel.Dispose(); _storageEntityModel = null; } if (DiagramArtifact != null) { ModelManager.ClearArtifact(DiagramArtifact.Uri); DiagramArtifact = null; } } } finally { base.Dispose(disposing); } }