private static void SaveRelations(DiskModelYaml model, Entity item, EntityYaml node) { //var nodeData = new nHydrate.ModelManagement.Relation.configuration(); //nodeData.id = item.Id.ToString(); //nodeData.type = "entity.relations"; //var nodeRelations = new List<ModelManagement.Relation.configurationRelation>(); foreach (var relation in item.RelationshipList) { //var nodeRelationItem = new ModelManagement.Relation.configurationRelation(); //nodeRelations.Add(nodeRelationItem); var nodeRelationItem = node.Relations.AddNew(); nodeRelationItem.ForeignEntityId = relation.ChildEntity.Id; nodeRelationItem.DeleteAction = relation.DeleteAction.Convert <Generator.Common.DeleteActionConstants>(); nodeRelationItem.Id = relation.InternalId; nodeRelationItem.IsEnforced = relation.IsEnforced; nodeRelationItem.RoleName = relation.RoleName; nodeRelationItem.Summary = relation.Summary; var nodeRelationFields = new List <ModelManagement.Relation.configurationRelationField>(); foreach (var relationField in relation.FieldMapList()) { //var nodeRelationField = new ModelManagement.Relation.configurationRelationField(); //nodeRelationFields.Add(nodeRelationField); var nodeRelationField = nodeRelationItem.Fields.AddNew(); //nodeRelationField.Id = relationField.Id; nodeRelationField.PrimaryFieldId = relationField.SourceFieldId; nodeRelationField.ForeignFieldId = relationField.TargetFieldId; } //nodeRelationItem.relationfieldset = nodeRelationFields.ToArray(); } //nodeData.relation = nodeRelations.ToArray(); //model.Relations.Add(nodeData); }
private static void SaveEntityStaticData(DiskModelYaml model, Entity item, EntityYaml node) { //if (item.StaticDatum.Count == 0) // return; //var nodeData = new nHydrate.ModelManagement.StaticData.configuration(); //nodeData.id = item.Id.ToString(); //nodeData.type = "entity.staticdata"; //var nodeDataItems = new List<ModelManagement.StaticData.configurationData>(); foreach (var data in item.StaticDatum) { //var nodeDataItem = new ModelManagement.StaticData.configurationData(); //nodeDataItems.Add(nodeDataItem); var nodeDataItem = node.StaticData.AddNew(); nodeDataItem.ColumnId = data.ColumnKey; nodeDataItem.SortOrder = data.OrderKey; nodeDataItem.Value = data.Value; } //nodeData.data = nodeDataItems.ToArray(); //model.StaticData.Add(nodeData); }
private static void SaveEntityIndexes(DiskModelYaml model, Entity item, EntityYaml node) { //var root = new ModelManagement.Index.configuration(); //model.Indexes.Add(root); //root.id = item.Id.ToString(); //root.type = "entity.indexes"; //var nodeFields = new List<ModelManagement.Index.configurationIndex>(); foreach (var index in item.Indexes) { //var nodeField = new ModelManagement.Index.configurationIndex(); //nodeFields.Add(nodeField); var nodeField = node.Indexes.AddNew(); nodeField.Clustered = index.Clustered; nodeField.Id = index.Id; nodeField.ImportedName = index.ImportedName; nodeField.IndexType = index.IndexType.Convert <Generator.Common.IndexTypeConstants>(); nodeField.IsUnique = index.IsUnique; nodeField.Summary = index.Summary; var nodeIndexColumns = new List <ModelManagement.Index.configurationIndexColumn>(); foreach (var indexColumn in index.IndexColumns.OrderBy(x => x.SortOrder)) { //var nodeIndexColumn = new ModelManagement.Index.configurationIndexColumn(); //nodeIndexColumns.Add(nodeIndexColumn); var nodeIndexColumn = nodeField.Fields.AddNew(); nodeIndexColumn.Ascending = indexColumn.Ascending; nodeIndexColumn.FieldId = indexColumn.FieldID; nodeIndexColumn.FieldName = item.Fields.FirstOrDefault(x => x.Id == indexColumn.FieldID)?.Name; //nodeIndexColumn.Id = indexColumn.Id; } //nodeField.indexcolumnset = nodeIndexColumns.ToArray(); //nodeFields.Add(nodeField); } //root.index = nodeFields.ToArray(); }