protected virtual CompositeIdentityPart <T> KeyProperty(Member property, string columnName, Action <KeyPropertyPart> customMapping) { var key = new KeyPropertyMapping { Name = property.Name, Type = new TypeReference(property.PropertyType), ContainingEntityType = typeof(T) }; if (customMapping != null) { var part = new KeyPropertyPart(key); customMapping(part); } if (!string.IsNullOrEmpty(columnName)) { key.AddColumn(new ColumnMapping { Name = columnName }); } keyProperties.Add(key); return(this); }
protected virtual CompositeIdentityPart <T> KeyProperty(Member member, string columnName, Action <KeyPropertyPart> customMapping) { var type = member.PropertyType; if (type.IsEnum) { type = typeof(GenericEnumMapper <>).MakeGenericType(type); } var key = new KeyPropertyMapping { ContainingEntityType = typeof(T) }; key.Set(x => x.Name, Layer.Defaults, member.Name); key.Set(x => x.Type, Layer.Defaults, new TypeReference(type)); if (customMapping != null) { var part = new KeyPropertyPart(key); customMapping(part); } if (!string.IsNullOrEmpty(columnName)) { var columnMapping = new ColumnMapping(); columnMapping.Set(x => x.Name, Layer.Defaults, columnName); key.AddColumn(columnMapping); } keys.Add(key); return(this); }
public void WhenKeyPropertyMappingContainsLengthAndCustomColumnLengthAttributeIsRenderedIntoColumnElement() { var keyPropertyMapping = new KeyPropertyMapping(); keyPropertyMapping.Set(propertyMapping => propertyMapping.Length, Layer.Defaults, 2); keyPropertyMapping.AddColumn(new ColumnMapping()); writer.VerifyXml(keyPropertyMapping).DoesntHaveAttribute("length").Element("column").HasAttribute("length", "2"); }
public override void ProcessKeyProperty(KeyPropertyMapping mapping) { var conventions = finder.Find <IKeyPropertyConvention>(); Apply <IKeyPropertyInspector, IKeyPropertyInstance>(conventions, new KeyPropertyInstance(mapping)); }
public override void Visit(KeyPropertyMapping propertyMapping) { var writer = serviceLocator.GetWriter <KeyPropertyMapping>(); var xml = writer.Write(propertyMapping); document.ImportAndAppendChild(xml); }
KeyPropertyPart Map(Member member, string columnName) { var type = member.PropertyType; if (type.IsEnum) { type = typeof(GenericEnumMapper <>).MakeGenericType(type); } var property = new KeyPropertyMapping { Name = member.Name, Type = new TypeReference(type), ContainingEntityType = typeof(T) }; if (!string.IsNullOrEmpty(columnName)) { property.AddColumn(new ColumnMapping { Name = columnName }); } mapping.AddProperty(property); return(new KeyPropertyPart(property)); }
public void ShouldWriteColumns() { var mapping = new KeyPropertyMapping(); mapping.AddColumn(new ColumnMapping()); writer.VerifyXml(mapping) .Element("column").Exists(); }
public void SetUp() { this.mapping = new KeyPropertyMapping(); this.part = new KeyPropertyPart(mapping); }
public override void Visit(KeyPropertyMapping mapping) { mapping.AcceptVisitor(this); }
public KeyPropertyPart(KeyPropertyMapping mapping) { this.mapping = mapping; Access = new AccessStrategyBuilder<KeyPropertyPart>(this, value => mapping.Set(x =>x.Access, Layer.UserSupplied, value)); }
public virtual void Visit(KeyPropertyMapping mapping) { }
public KeyPropertyInspector(KeyPropertyMapping mapping) { this.mapping = mapping; }
public void CreateDsl() { mapping = new KeyPropertyMapping(); inspector = new KeyPropertyInspector(mapping); }
public KeyPropertyPart(KeyPropertyMapping mapping) { this.mapping = mapping; Access = new AccessStrategyBuilder <KeyPropertyPart>(this, value => mapping.Access = value); }
public virtual void ProcessKeyProperty(KeyPropertyMapping mapping) { }
public KeyPropertyPart(KeyPropertyMapping mapping) { this.mapping = mapping; Access = new AccessStrategyBuilder <KeyPropertyPart>(this, value => mapping.Set(x => x.Access, Layer.UserSupplied, value)); }
public KeyPropertyPart(KeyPropertyMapping mapping) { this.mapping = mapping; Access = new AccessStrategyBuilder<KeyPropertyPart>(this, value => mapping.Access = value); }
private static KeyPropertyMapping GetKeyPropertyMapping(Type entityType, string name, Type type) { var keyPropertyMapping = new KeyPropertyMapping {ContainingEntityType = entityType}; keyPropertyMapping.Set(x => x.Name, Layer.Defaults, name); keyPropertyMapping.Set(x => x.Type, Layer.Defaults, new TypeReference(type)); var columnMapping = new ColumnMapping(); columnMapping.Set(x => x.Name, Layer.Defaults, name); keyPropertyMapping.AddColumn(columnMapping); return keyPropertyMapping; }
public KeyPropertyInstance(KeyPropertyMapping mapping) : base(mapping) { this.mapping = mapping; }
public void AddProperty(KeyPropertyMapping property) { properties.Add(property); }
public KeyPropertyPart(KeyPropertyMapping mapping) { this.mapping = mapping; }