public void SetMapping(ComponentPropertyMarker property, IColumn column) { int index = properties.IndexOf(property); if (index == -1 && column != null) { AddPropertyAndColumn(property, column); return; } if (column == null) { properties.RemoveAt(index); columns.RemoveAt(index); if (MappingSet != null) { MappingSet.InvalidateCache(); } RaisePropertyChanged("Mappings"); return; } columns[index] = column; if (MappingSet != null) { MappingSet.InvalidateCache(); } RaisePropertyChanged("Mappings"); }
public void AddPropertyAndColumn(ComponentPropertyMarker prop, IColumn col) { if (FromTable == null) { FromTable = col.Parent; } if (ToComponent == null) { ToComponent = prop.Component; } if (col.Parent != FromTable) { throw new ArgumentException("Cannot add columns from multiple tables to a single Mapping object"); } if (prop.Component != ToComponent) { throw new ArgumentException("Cannot add properties from multiple components to a single Mapping object"); } properties.Add(prop); columns.Add(col); if (MappingSet != null) { MappingSet.InvalidateCache(); } RaisePropertyChanged("Mappings"); }
public void RemoveMappingBetween(ComponentPropertyMarker property, IColumn column) { if (column == null) { throw new ArgumentNullException("column"); } if (property == null) { throw new ArgumentNullException("property"); } var component = property.Component; var table = column.Parent; var mapping = componentMappings.FirstOrDefault(m => m.ToComponent == component && m.FromTable == table); if (mapping != null) { mapping.SetMapping(property, null); if (mapping.Mappings.Count() == 0) { RemoveMapping(mapping); } } CacheInvalid = true; }
public IColumn GetMappedColumnFor(ComponentPropertyMarker property) { if (CacheInvalid) { ClearAndRebuildCache(); } return(componentPropertyColumnCache.GetMappedObject(property)); }
/// <summary> /// Gets the MappingSet object that the Component belongs to, or null if it doesn't belong to one. /// </summary> /// <param name="marker"></param> /// <returns></returns> public static MappingSet GetMappingSet(this ComponentPropertyMarker marker) { if (marker == null || marker.Component == null || marker.Component.Specification == null || marker.Component.Specification.EntitySet == null) { return(null); } return(marker.Component.Specification.EntitySet.MappingSet); }
public IColumn GetMappedColumnFor(ComponentPropertyMarker property) { int rowIndex = currentProperties.FindIndex(p => ReferenceEquals(p, property)); if (rowIndex == -1) { return(null); } return(currentColumnList[rowIndex]); }
public static IColumn MappedColumn(this ComponentPropertyMarker property) { MappingSet ms = property.GetMappingSet(); if (ms == null) { return(null); } return(ms.GetMappedColumnFor(property)); }
private void AddNewColumnPropertyMappingRow(ComponentPropertyMarker marker) { var row = new DataGridViewRow(); row.Tag = marker; gridMappings.AllowUserToAddRows = true; row.CreateCells(gridMappings); row.Cells[NameColumn.Index].Value = marker.RepresentedProperty.Name; gridMappings.Rows.Add(row); gridMappings.AllowUserToAddRows = false; }
public static void SetMappedColumn(this ComponentPropertyMarker property, IColumn column) { if (property == null) { throw new ArgumentNullException("property"); } var set = property.GetMappingSet(); if (set == null) { throw new Exception(string.Format("Could not set Mapped Column for Property {0}: Could not get its MappingSet", property.PropertyName)); } set.ChangeMappingFor(property).To(column); }
private LineWidth GetWidthOfComponentPropertyLine(Graphics g, ComponentPropertyMarker property) { if (!LineWidths.ContainsKey(property)) { LineWidths.Add( property, new LineWidth( g.MeasureString(property.PropertyName, FontItem).Width, g.MeasureString(property.RepresentedProperty.Type, FontType).Width ) ); } return(LineWidths[property]); }
public void RemovePropertyAndMappedColumn(ComponentPropertyMarker property) { int index = properties.IndexOf(property); if (index == -1) { return; } properties.RemoveAt(index); columns.RemoveAt(index); if (MappingSet != null) { MappingSet.InvalidateCache(); } RaisePropertyChanged("Mappings"); }
public ComponentPropertyMappingChanger(MappingSet ms, ComponentPropertyMarker property) { this.ms = ms; this.property = property; }
public ColumnComponentPropertyMapping(ComponentPropertyMarker property, IColumn column) { Property = property; Column = column; }
public ComponentPropertyMappingChanger ChangeMappingFor(ComponentPropertyMarker component) { return new ComponentPropertyMappingChanger(this, component); }
public void AddPropertyAndColumn(ComponentPropertyMarker prop, IColumn col) { if (FromTable == null) { FromTable = col.Parent; } if (ToComponent == null) { ToComponent = prop.Component; } if (col.Parent != FromTable) { throw new ArgumentException("Cannot add columns from multiple tables to a single Mapping object"); } if (prop.Component != ToComponent) { throw new ArgumentException("Cannot add properties from multiple components to a single Mapping object"); } properties.Add(prop); columns.Add(col); if (MappingSet != null) MappingSet.InvalidateCache(); RaisePropertyChanged("Mappings"); }
public IColumn GetMappedColumnFor(ComponentPropertyMarker property) { int rowIndex = currentProperties.FindIndex(p => ReferenceEquals(p, property)); if (rowIndex == -1) return null; return currentColumnList[rowIndex]; }
public void SetMapping(ComponentPropertyMarker property, IColumn column) { int index = properties.IndexOf(property); if (index == -1 && column != null) { AddPropertyAndColumn(property, column); return; } if (column == null) { properties.RemoveAt(index); columns.RemoveAt(index); if (MappingSet != null) MappingSet.InvalidateCache(); RaisePropertyChanged("Mappings"); return; } columns[index] = column; if (MappingSet != null) MappingSet.InvalidateCache(); RaisePropertyChanged("Mappings"); }
public IColumn GetMappedColumnFor(ComponentPropertyMarker property) { if (CacheInvalid) ClearAndRebuildCache(); return componentPropertyColumnCache.GetMappedObject(property); }
private LineWidth GetWidthOfComponentPropertyLine(Graphics g, ComponentPropertyMarker property) { if (!LineWidths.ContainsKey(property)) LineWidths.Add( property, new LineWidth( g.MeasureString(property.PropertyName, FontItem).Width, g.MeasureString(property.RepresentedProperty.Type, FontType).Width ) ); return LineWidths[property]; }
public void RemoveMappingBetween(ComponentPropertyMarker property, IColumn column) { if (column == null) throw new ArgumentNullException("column"); if (property == null) throw new ArgumentNullException("property"); var component = property.Component; var table = column.Parent; var mapping = componentMappings.FirstOrDefault(m => m.ToComponent == component && m.FromTable == table); if (mapping != null) { mapping.SetMapping(property, null); if (mapping.Mappings.Count() == 0) RemoveMapping(mapping); } CacheInvalid = true; }
public ComponentPropertyMappingChanger ChangeMappingFor(ComponentPropertyMarker component) { return(new ComponentPropertyMappingChanger(this, component)); }
public void RemovePropertyAndMappedColumn(ComponentPropertyMarker property) { int index = properties.IndexOf(property); if (index == -1) return; properties.RemoveAt(index); columns.RemoveAt(index); if (MappingSet != null) MappingSet.InvalidateCache(); RaisePropertyChanged("Mappings"); }