protected virtual CompositeIdentityPart <T> KeyReference(Member member, IEnumerable <string> columnNames, Action <KeyManyToOnePart> customMapping) { onMemberMapped(member); var key = new KeyManyToOneMapping { ContainingEntityType = typeof(T) }; key.Set(x => x.Name, Layer.Defaults, member.Name); key.Set(x => x.Class, Layer.Defaults, new TypeReference(member.PropertyType)); foreach (var column in columnNames) { var columnMapping = new ColumnMapping(); columnMapping.Set(x => x.Name, Layer.Defaults, column); key.AddColumn(columnMapping); } var keyPart = new KeyManyToOnePart(key); if (customMapping != null) { customMapping(keyPart); } keys.Add(key); return(this); }
protected virtual CompositeIdentityPart <T> KeyReference(Member property, IEnumerable <string> columnNames, Action <KeyManyToOnePart> customMapping) { var key = new KeyManyToOneMapping { Name = property.Name, Class = new TypeReference(property.PropertyType), ContainingEntityType = typeof(T) }; foreach (var column in columnNames) { key.AddColumn(new ColumnMapping { Name = column }); } var keyPart = new KeyManyToOnePart(key); if (customMapping != null) { customMapping(keyPart); } keys.Add(key); return(this); }
public static void ForeignKey(this KeyManyToOneMapping keyManyToOneMapping, string foreignKeyName) { if (!keyManyToOneMapping.IsSpecified("ForeignKey")) { keyManyToOneMapping.Set <string>(c => c.ForeignKey, 1, foreignKeyName); } }
public override void Visit(KeyManyToOneMapping mapping) { var writer = serviceLocator.GetWriter <KeyManyToOneMapping>(); var xml = writer.Write(mapping); document.ImportAndAppendChild(xml); }
public override void ProcessKeyManyToOne(KeyManyToOneMapping mapping) { var conventions = finder.Find <IKeyManyToOneConvention>(); Apply <IKeyManyToOneInspector, IKeyManyToOneInstance>(conventions, new KeyManyToOneInstance(mapping)); }
public void ShouldWriteColumns() { var mapping = new KeyManyToOneMapping(); mapping.AddColumn(new ColumnMapping()); writer.VerifyXml(mapping) .Element("column").Exists(); }
public void ShouldWriteColumns() { var mapping = new KeyManyToOneMapping(); mapping.AddColumn(new ColumnMapping()); writer.VerifyXml(mapping) .Element("column").Exists(); }
KeyManyToOnePart Reference(Member property, IEnumerable <string> columnNames) { var reference = new KeyManyToOneMapping { Name = property.Name, Class = new TypeReference(property.PropertyType), ContainingEntityType = typeof(T) }; foreach (var column in columnNames) { reference.AddColumn(new ColumnMapping { Name = column }); } var keyPart = new KeyManyToOnePart(reference); mapping.AddReference(reference); return(new KeyManyToOnePart(reference)); }
public virtual void ProcessKeyManyToOne(KeyManyToOneMapping mapping) { }
public KeyManyToOneInspector(KeyManyToOneMapping mapping) { this.mapping = mapping; mappedProperties.AutoMap(); mappedProperties.Map(x => x.LazyLoad, x => x.Lazy); }
public override void Visit(KeyManyToOneMapping mapping) { mapping.AcceptVisitor(this); }
public void AddReference(KeyManyToOneMapping manyToOne) { manyToOnes.Add(manyToOne); }
public void SetUp() { this.mapping = new KeyManyToOneMapping(); this.keyPart = new KeyManyToOnePart(mapping); }
public KeyManyToOneInstance(KeyManyToOneMapping mapping) : base(mapping) { this.mapping = mapping; }
public virtual void ProcessKeyManyToOne(KeyManyToOneMapping mapping) { }
public KeyManyToOnePart(KeyManyToOneMapping mapping) { this.mapping = mapping; Access = new AccessStrategyBuilder<KeyManyToOnePart>(this, value => mapping.Set(x => x.Access, Layer.UserSupplied, value)); NotFound = new NotFoundExpression<KeyManyToOnePart>(this, value => mapping.Set(x => x.NotFound, Layer.UserSupplied, value)); }
public KeyManyToOnePart(KeyManyToOneMapping mapping) { this.mapping = mapping; Access = new AccessStrategyBuilder<KeyManyToOnePart>(this, value => mapping.Access = value); NotFound = new NotFoundExpression<KeyManyToOnePart>(this, value => mapping.NotFound = value); }
public KeyManyToOnePart(KeyManyToOneMapping mapping) { this.mapping = mapping; Access = new AccessStrategyBuilder <KeyManyToOnePart>(this, value => mapping.Set(x => x.Access, Layer.UserSupplied, value)); NotFound = new NotFoundExpression <KeyManyToOnePart>(this, value => mapping.Set(x => x.NotFound, Layer.UserSupplied, value)); }
public void SetUp() { this.mapping = new KeyManyToOneMapping(); this.keyPart = new KeyManyToOnePart(mapping); }
public virtual void Visit(KeyManyToOneMapping mapping) { }
public KeyManyToOnePart(KeyManyToOneMapping mapping) { this.mapping = mapping; Access = new AccessStrategyBuilder <KeyManyToOnePart>(this, value => mapping.Access = value); NotFound = new NotFoundExpression <KeyManyToOnePart>(this, value => mapping.NotFound = value); }
public override void Visit(KeyManyToOneMapping mapping) { mapping.AcceptVisitor(this); }
public KeyManyToOneInstance(KeyManyToOneMapping mapping) : base(mapping) { this.mapping = mapping; }
public void CreateDsl() { mapping = new KeyManyToOneMapping(); inspector = new KeyManyToOneInspector(mapping); }
public void CreateDsl() { mapping = new KeyManyToOneMapping(); inspector = new KeyManyToOneInspector(mapping); }
public virtual void Visit(KeyManyToOneMapping mapping) { }
public KeyManyToOneInspector(KeyManyToOneMapping mapping) { this.mapping = mapping; mappedProperties.Map(x => x.LazyLoad, x => x.Lazy); }