public void CanMapProperty()
 {
     var mapdoc = new HbmMapping();
     var component = new HbmCompositeElement();
     var mapper = new ComponentElementMapper(typeof(Address), mapdoc, component);
     mapper.Property(typeof(Address).GetProperty("Street"), x => { });
     component.Properties.Should().Have.Count.EqualTo(1);
     component.Properties.First().Name.Should().Be.EqualTo("Street");
 }
 public void CanMapParent()
 {
     var mapdoc = new HbmMapping();
     var component = new HbmCompositeElement();
     var mapper = new ComponentElementMapper(typeof(Address), mapdoc, component);
     mapper.Parent(typeof(Address).GetProperty("Parent"));
     component.Parent.Should().Not.Be.Null();
     component.Parent.name.Should().Be.EqualTo("Parent");
 }
 public void CallPropertyMapper()
 {
     var mapdoc = new HbmMapping();
     var component = new HbmCompositeElement();
     var mapper = new ComponentElementMapper(typeof(Address), mapdoc, component);
     var called = false;
     mapper.Property(typeof (Address).GetProperty("Street"), x => called = true);
     called.Should().Be.True();
 }
示例#4
0
		public ComponentElementMapper(Type componentType, HbmMapping mapDoc, HbmCompositeElement component)
		{
			this.componentType = componentType;
			this.mapDoc = mapDoc;
			this.component = component;
		}
		private void BindCompositeElement(HbmCompositeElement compositeElementMapping, Mapping.Collection model, IDictionary<string, MetaAttribute> inheritedMetas)
		{
			var component = new Component(model);
			model.Element = component;
			BindComponent(compositeElementMapping, component, null, null, model.Role + ".element", true, inheritedMetas);
		}
		public void Component(Action<IComponentElementMapper> mapping)
		{
			var hbm = new HbmCompositeElement {@class = collectionElementType.GetShortClassName(mapDoc)};
			mapping(new ComponentElementMapper(collectionElementType, mapDoc, hbm));
			elementRelationshipAssing(hbm);
		}
		public ComponentElementMapper(System.Type componentType, HbmMapping mapDoc, HbmCompositeElement component)
		{
			_componentType = componentType;
			_mapDoc = mapDoc;
			_component = component;
		}