public void ShouldWriteParent() { var mapping = new CompositeElementMapping(); mapping.Set(x => x.Parent, Layer.Defaults, new ParentMapping()); writer.VerifyXml(mapping) .Element("parent").Exists(); }
public void ShouldWriteParentAsFirstElement() { var mapping = new CompositeElementMapping(); mapping.Set(x => x.Parent, Layer.Defaults, new ParentMapping()); mapping.AddProperty(new PropertyMapping()); writer.VerifyXml(mapping) .Element("parent").IsFirst() .Element("property").Exists(); }
void PopulateMapping(CompositeElementMapping mapping) { mapping.ContainingEntityType = entity; mapping.Set(x => x.Class, Layer.Defaults, new TypeReference(typeof(T))); foreach (var property in properties) { mapping.AddProperty(property.GetPropertyMapping()); } foreach (var reference in references) { mapping.AddReference(reference.GetManyToOneMapping()); } foreach (var component in components) { mapping.AddCompositeElement(component.GetCompositeElementMapping()); } }