private bool DoProcessing(string outputFilename, out List<ModelElement> newElements) { newElements = new List<ModelElement>(); try { using (StreamReader sr = new StreamReader(outputFilename)) { string json = sr.ReadToEnd(); ParsingModels.ModelRoot rootData = JsonConvert.DeserializeObject<ParsingModels.ModelRoot>(json); newElements = ProcessRootData(rootData); return true; } } catch (Exception e) { ErrorDisplay.Show(Store, $"Error procesing assembly: {e.Message}"); } finally { if (!string.IsNullOrEmpty(outputFilename)) File.Delete(outputFilename); } return false; }
private void ProcessRootData(ParsingModels.ModelRoot rootData) { ModelRoot modelRoot = Store.ModelRoot(); modelRoot.EntityContainerName = rootData.EntityContainerName; modelRoot.Namespace = rootData.Namespace; ProcessClasses(modelRoot, rootData.Classes); ProcessEnumerations(modelRoot, rootData.Enumerations); }
private List<ModelElement> ProcessRootData(ParsingModels.ModelRoot rootData) { List<ModelElement> result = new List<ModelElement>(); ModelRoot modelRoot = Store.ModelRoot(); modelRoot.EntityContainerName = rootData.EntityContainerName; modelRoot.Namespace = rootData.Namespace; result.AddRange(ProcessClasses(modelRoot, rootData.Classes)); result.AddRange(ProcessEnumerations(modelRoot, rootData.Enumerations)); foreach (Association association in modelRoot.Store.GetAll<Association>()) { AssociationChangedRules.SetEndpointRoles(association); AssociationChangedRules.FixupForeignKeys(association); } return result; }