public void WhenRegisterTypeThenAddToExplicitHolder() { var orm = new ObjectRelationalMapper(); orm.Complex(typeof(MonetaryAmount)); orm.IsComplex(ForClass <MyClass> .Property(x => x.Amount)).Should().Be.True(); }
public void IntegrationWithObjectRelationalMapper() { var orm = new ObjectRelationalMapper(); orm.TablePerClass<MyClass>(); orm.Complex<MyClass>(mc=> mc.Tags); HbmMapping mapping = GetMapping(orm); VerifyMapping(mapping); }
public void IntegrationWithObjectRelationalMapper() { var orm = new ObjectRelationalMapper(); orm.TablePerClass <MyClass>(); orm.Complex <MonetaryAmount>(); HbmMapping mapping = GetMapping(orm); VerifyMapping(mapping); }
public void UsageOfCustomMulticolumnsTypeUsingPatternAppliers() { // In this example you can see how create setup ConfORM to map a multi-column usertype with parameters. var orm = new ObjectRelationalMapper(); orm.TablePerClass <LoveEvent>(); // In this case the custom type is used only for a specific property. orm.Complex <LoveEvent>(loveEvent => loveEvent.AllowedWeekDays); var mapper = new Mapper(orm); // In this case I'm using a PatternApplier (directly with delegates instead a specific class) to define the persistent representation of the bool array mapper.AddPropertyPattern(mi => typeof(bool[]).Equals(mi.GetPropertyOrFieldType()) && mi.Name.Contains("Days"), (mi, pm) => { pm.Type(typeof(MulticolumnsBoolArrayType), new { ArraySize = DaysOfTheWeekColumnsNames.Length }); pm.Columns(DaysOfTheWeekColumnsNames.Select(colName => new Action <IColumnMapper>(cm => cm.Name(mi.Name + colName))).ToArray()); }); var mapping = mapper.CompileMappingFor(new[] { typeof(LoveEvent) }); Console.Write(mapping.AsString()); }
public void UsageOfCustomMulticolumnsTypeForSpecificProperty() { // In this example you can see how create setup ConfORM to map a multi-column usertype with parameters. var orm = new ObjectRelationalMapper(); orm.TablePerClass <LoveEvent>(); // In this case the custom type is used only for a specific property. orm.Complex <LoveEvent>(loveEvent => loveEvent.AllowedWeekDays); var mapper = new Mapper(orm); // In this case I'm using the customizer for the specific property mapper.Customize <LoveEvent>(x => x.Property(le => le.AllowedWeekDays, pm => { pm.Type(typeof(MulticolumnsBoolArrayType), new { ArraySize = DaysOfTheWeekColumnsNames.Length }); pm.Columns(DaysOfTheWeekColumnsNames.Select(colName => new Action <IColumnMapper>(cm => cm.Name(colName))).ToArray()); })); var mapping = mapper.CompileMappingFor(new[] { typeof(LoveEvent) }); Console.Write(mapping.AsString()); }