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 ShouldWriteProperties() { var mapping = new JoinMapping(); mapping.AddProperty(new PropertyMapping()); writer.VerifyXml(mapping) .Element("property").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); }
public void ShouldWriteTheProperties() { var joinMapping = new JoinMapping(); joinMapping.AddProperty(new PropertyMapping()); var propertyDocument = new XmlDocument(); propertyDocument.AppendChild(propertyDocument.CreateElement("property")); var propertyWriter = MockRepository.GenerateMock<IXmlWriter<PropertyMapping>>(); propertyWriter .Expect(x => x.Write(joinMapping.Properties.First())) .Return(propertyDocument); _writer = new XmlJoinWriter(propertyWriter); _writer.VerifyXml(joinMapping) .Element("property").Exists(); }
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 PropertiesCollectionHasSameCountAsMapping() { mapping.AddProperty(new PropertyMapping()); inspector.Properties.Count().ShouldEqual(1); }