protected virtual void OnChanged(ScalarProperty property, SSDL.Property.Property oldColumn, SSDL.Property.Property newColumn) { if (Changed != null) { Changed(property, oldColumn, newColumn); } OnCollectionChanged(); }
protected virtual void OnAdded(ScalarProperty property, SSDL.Property.Property column) { if (Added != null) { Added(property, column); } OnCollectionChanged(); }
private void RemoveNotNullCondition(SSDL.Property.Property column) { var columnConditionMapping = Mapping.ConditionsMapping.FirstOrDefault(ccm => ccm.Column == column && ccm.Operator == ConditionOperator.IsNotNull && ccm.Generated); if (columnConditionMapping != null) { Mapping.ConditionsMapping.Remove(columnConditionMapping); } }
private void AddNotNullCondition(SSDL.Property.Property column) { if (!Mapping.ConditionsMapping.Any(ccm => ccm.Column == column && ccm.Operator == ConditionOperator.IsNotNull)) { Mapping.ConditionsMapping.Add(new ColumnConditionMapping { Column = column, Operator = ConditionOperator.IsNotNull, Generated = true }); } }
private void MappingAdded(SSDL.Property.Property column) { var associationMapping = NavigationProperty.Association.Mapping; associationMapping.OnIsCompletelyMappedChanged(); if (NavigationProperty.Cardinality == Cardinality.ZeroToOne && !(associationMapping.MappingInit || associationMapping.ConditionsMapping.Any(ccm => ccm.Column == column && ccm.Operator == ConditionOperator.IsNotNull))) { associationMapping.ConditionsMapping.Add(new ColumnConditionMapping { Column = column, Operator = ConditionOperator.IsNotNull }); } }
public void ChangeMapping(ScalarProperty property, SSDL.Property.Property column) { if (property == null || column == null) { throw new ArgumentNullException(); } Dictionary <SSDL.EntityType.EntityType, SSDL.Property.Property> propertyMapping; if (!(Mapping.ContainsKey(property) && (propertyMapping = Mapping[property]).ContainsKey(column.EntityType))) { throw new InvalidOperationException(); } propertyMapping[column.EntityType] = column; EntityType.Mapping.OnPropertyChanged("IsCompletlyMapped"); }
public void ChangeMapping(ScalarProperty property, SSDL.Property.Property column) { if (property == null || column == null) { throw new ArgumentNullException(); } if (!Mapping.ContainsKey(property)) { throw new InvalidOperationException(); } var oldColumn = Mapping[property]; Mapping[property] = column; OnChanged(property, oldColumn, column); MappingAdded(column); }
public void AddMapping(ScalarProperty property, SSDL.Property.Property column) { if (property == null || column == null) { throw new ArgumentNullException(); } if (Mapping.ContainsKey(property)) { var oldColumn = Mapping[property]; Mapping[property] = column; OnChanged(property, oldColumn, column); } else { Mapping.Add(property, column); OnAdded(property, column); } MappingAdded(column); }
private bool TryToAddSSDLColumnToComplexProperty(ComplexProperty complexProperty, Func <MappingBase> mapping, SSDL.Property.Property column) { var prop = complexProperty.ComplexType.ScalarProperties.FirstOrDefault(p => p.Name == column.Name); if (prop != null) { mapping().AddMapping(prop, column); return(true); } foreach (var complexProp in complexProperty.ComplexType.ComplexProperties) { if (TryToAddSSDLColumnToComplexProperty(complexProp, () => { var complexMapping = mapping().ComplexMapping; if (complexMapping.ContainsKey(complexProp)) { return(complexMapping[complexProp]); } var complexPropMapping = new ComplexPropertyMapping(EntityType, complexProp); complexMapping.Add(complexProp, complexPropMapping); return(complexPropMapping); }, column)) { return(true); } } return(false); }