JoinMapping IJoinMappingProvider.GetJoinMapping() { var mapping = new JoinMapping(attributes.CloneInner()); mapping.ContainingEntityType = typeof(T); foreach (var property in properties) { mapping.AddProperty(property.GetPropertyMapping()); } foreach (var component in components) { mapping.AddComponent(component.GetComponentMapping()); } foreach (var reference in references) { mapping.AddReference(reference.GetManyToOneMapping()); } foreach (var any in anys) { mapping.AddAny(any.GetAnyMapping()); } return(mapping); }
public void ShouldWriteAny() { var mapping = new JoinMapping(); mapping.AddAny(new AnyMapping()); writer.VerifyXml(mapping) .Element("any").Exists(); }
JoinMapping IJoinMappingProvider.GetJoinMapping() { var mapping = new JoinMapping(attributes.Clone()) { ContainingEntityType = typeof(T) }; if (columns.Count == 0) { var columnMapping = new ColumnMapping(); columnMapping.Set(x => x.Name, Layer.Defaults, typeof(T).Name + "_id"); mapping.Key.AddColumn(Layer.Defaults, columnMapping); } else { foreach (var column in columns) { var columnMapping = new ColumnMapping(); columnMapping.Set(x => x.Name, Layer.Defaults, column); mapping.Key.AddColumn(Layer.UserSupplied, columnMapping); } } foreach (var property in providers.Properties) { mapping.AddProperty(property.GetPropertyMapping()); } foreach (var component in providers.Components) { mapping.AddComponent(component.GetComponentMapping()); } foreach (var reference in providers.References) { mapping.AddReference(reference.GetManyToOneMapping()); } foreach (var any in providers.Anys) { mapping.AddAny(any.GetAnyMapping()); } foreach (var collection in providers.Collections) { mapping.AddCollection(collection.GetCollectionMapping()); } foreach (var storedProcedure in providers.StoredProcedures) { mapping.AddStoredProcedure(storedProcedure.GetStoredProcedureMapping()); } return(mapping); }
JoinMapping IJoinMappingProvider.GetJoinMapping() { var mapping = new JoinMapping(attributes.CloneInner()); mapping.ContainingEntityType = typeof(T); if (columns.Count == 0) { mapping.Key.AddDefaultColumn(new ColumnMapping { Name = typeof(T).Name + "_id" }); } else { foreach (var column in columns) { mapping.Key.AddColumn(new ColumnMapping { Name = column }); } } foreach (var property in properties) { mapping.AddProperty(property.GetPropertyMapping()); } foreach (var component in components) { mapping.AddComponent(component.GetComponentMapping()); } foreach (var reference in references) { mapping.AddReference(reference.GetManyToOneMapping()); } foreach (var any in anys) { mapping.AddAny(any.GetAnyMapping()); } return(mapping); }
public void AnysCollectionHasSameCountAsMapping() { mapping.AddAny(new AnyMapping()); inspector.Anys.Count().ShouldEqual(1); }