public string [] GetAllMappedAttributes() { List <string> mappedAttributes = new List <string>(); mappedAttributes.AddRange(Mapping.Select(t => t.Target)); mappedAttributes.AddRange(RelationMapping.Select(t => t.LogicalName)); return(mappedAttributes.ToArray()); }
void bgwEntityChanged_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.entityMetadata = ((object[])e.Result)[0] as EntityMetadata; attributeMapping = CreateAttributeMappingWindow(this.entityMetadata); existingCheck = CreateImportSettingsControl(); relationMapping = CreateRelationmappingWindow(this.entityMetadata); ConfigurationContent.Content = new ConfigurationContent(attributeMapping, existingCheck, relationMapping); }
public static async Task WriteRelationshipHeader(TextWriter writer, RelationMapping relationMapping) { await writer.WriteAsync($"{relationMapping.StartIdField.FieldName}{DELIMITER}").ConfigureAwait(false); await writer.WriteAsync($"{relationMapping.EndIdField.FieldName}").ConfigureAwait(false); foreach (var fieldInfo in relationMapping.FieldInfos) { await writer.WriteAsync(DELIMITER).ConfigureAwait(false); await WriteFieldInfo(writer, fieldInfo).ConfigureAwait(false); } await writer.WriteLineAsync().ConfigureAwait(false); }
public static async Task WriteRelationship(TextWriter writer, RelationMapping relationMapping, Edge edge) { await WriteField(writer, relationMapping.StartIdField, edge.OutKey).ConfigureAwait(false); await writer.WriteAsync(DELIMITER).ConfigureAwait(false); await WriteField(writer, relationMapping.EndIdField, edge.InKey).ConfigureAwait(false); foreach (var fieldInfo in relationMapping.FieldInfos) { await writer.WriteAsync(DELIMITER).ConfigureAwait(false); await WriteField(writer, fieldInfo, edge.Properties[fieldInfo.FieldName]).ConfigureAwait(false); } await writer.WriteLineAsync().ConfigureAwait(false); }
private void ddTargetTables_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ddTargetTables.SelectedItem == null) { return; } DbMetadataTable selectedTable = ((ComboBoxItem)ddTargetTables.SelectedItem).Tag as DbMetadataTable; this.configuration.TargetTable = selectedTable.TableName; attributeMapping = CreateAttributeMappingWindow(selectedTable); existingCheck = CreateExistingCheckWindow(); relationMapping = CreateRelationmappingWindow(); ConfigurationContent.Content = new ConfigurationContent(attributeMapping, existingCheck, relationMapping); }
public ConfigurationContent(AttributeMapping attributeMapping, ImportSettings importSettings, RelationMapping relationMapping) { InitializeComponent(); MappingTab.Content = attributeMapping; ImportSettingsTab.Content = importSettings; RelationmappingTab.Content = relationMapping; }
private RelationMapping CreateRelationmappingWindow(EntityMetadata entityMetadata) { RelationMapping relationMapping = new RelationMapping(orgServiceInstance, this.configuration, this.dataObject, entityMetadata); return(relationMapping); }
public override IDesignModel GenerateDesignModel(IXmlElement xmlElement, DesignModelParseContext context) { var sourceDesignModelName = xmlElement.GetStringAttributeValue("src"); var sourceDesignModelNameSet = !string.IsNullOrWhiteSpace(sourceDesignModelName); var destinationDesignModelName = xmlElement.GetStringAttributeValue("dest"); var destinationDesignModelNameSet = !string.IsNullOrWhiteSpace(destinationDesignModelName); if (sourceDesignModelNameSet && destinationDesignModelNameSet) { throw new ParseException(xmlElement.ParseLocation, $"Both 'src' and 'dest' attributes cannot be set."); } if (!sourceDesignModelNameSet && !destinationDesignModelNameSet) { throw new ParseException(xmlElement.ParseLocation, $"Either 'src' or 'dest' attribute must be set."); } var currentDesignModel = context.DesignModel; if (!(currentDesignModel is IClassModel currentClassModel)) { throw new ParseException(xmlElement.ParseLocation, $"Mapping model '{currentDesignModel.FullyQualifiedName}' must be a class-like design model."); } var ns = currentDesignModel.Namespace; var sourceReference = sourceDesignModelNameSet ? _designModelCollection.CreateClassModelReference(ns, xmlElement.ParseLocation, sourceDesignModelName) : currentClassModel.CreateClassModelReference(xmlElement.ParseLocation); var destinationReference = destinationDesignModelNameSet ? _designModelCollection.CreateClassModelReference(ns, xmlElement.ParseLocation, destinationDesignModelName) : currentClassModel.CreateClassModelReference(xmlElement.ParseLocation); var classMapping = new ClassMapping { Name = xmlElement.GetStringAttributeValue("name", null), Source = sourceReference, Destination = destinationReference, MapAttributes = xmlElement.GetBoolAttributeValue("attributes", true), MapRelations = xmlElement.GetBoolAttributeValue("relations", true), AddMissing = xmlElement.GetBoolAttributeValue("add-missing", true), TwoWay = xmlElement.GetBoolAttributeValue("two-way", true), ParseLocation = xmlElement.ParseLocation }; foreach (var attributeElement in xmlElement.GetChildElments("Attribute")) { var mapping = new AttributeMapping { Source = new ClassAttributeReference(attributeElement.GetStringAttributeValue("src"), attributeElement.ParseLocation), Destination = new ClassAttributeReference(attributeElement.GetStringAttributeValue("dest"), attributeElement.ParseLocation), ParseLocation = attributeElement.ParseLocation }; classMapping.AttributeMappings.Add(mapping); } foreach (var relationElement in xmlElement.GetChildElments("Relation")) { var relationMapping = new RelationMapping { Source = new ClassRelationReference(relationElement.GetStringAttributeValue("src"), relationElement.ParseLocation), Destination = new ClassRelationReference(relationElement.GetStringAttributeValue("dest"), relationElement.ParseLocation), MapAttributes = relationElement.GetBoolAttributeValue("attributes", true), AddMissing = relationElement.GetBoolAttributeValue("add-missing", true), TwoWay = relationElement.GetBoolAttributeValue("two-way", true), ParseLocation = relationElement.ParseLocation }; foreach (var attributeElement in relationElement.GetChildElments("Attribute")) { var relationAttributeMapping = new AttributeMapping { Source = new ClassAttributeReference(attributeElement.GetStringAttributeValue("src"), attributeElement.ParseLocation), Destination = new ClassAttributeReference(attributeElement.GetStringAttributeValue("dest"), attributeElement.ParseLocation), ParseLocation = attributeElement.ParseLocation }; relationMapping.AttributeMappings.Add(relationAttributeMapping); } classMapping.RelationMappings.Add(relationMapping); } currentClassModel.SetClassMappingData(classMapping); return(null); }