public HbmMapping GenerateMappings() { var domainEntities = GetDomainEntities().ToArray(); var relationalMapper = new ObjectRelationalMapper(); relationalMapper.TablePerClassHierarchy(domainEntities); relationalMapper.Patterns.PoidStrategies.Add(new HighLowPoidPattern()); var patternsAppliers = new CoolPatternsAppliersHolder(relationalMapper); patternsAppliers.Merge(new ClassPluralizedTableApplier(new EnglishInflector())); patternsAppliers.Merge(new UseNoLazyForNoProxablePack()); var mapper = new Mapper(relationalMapper, patternsAppliers); var mapping = mapper.CompileMappingFor(domainEntities); Debug.WriteLine(Serialize(mapping)); return mapping; }
protected override HbmMapping GetMapping() { var orm = new ObjectRelationalMapper(); orm.Patterns.PoidStrategies.Add(new GuidPoidPattern()); var patternsAppliers = new CoolPatternsAppliersHolder(orm); patternsAppliers.Merge(new ManyToOneColumnNamingApplier()); patternsAppliers.Merge(new OneToManyKeyColumnNamingApplier(orm)); var mapper = new Mapper(orm, patternsAppliers); var entities = new List<Type>(); DomainDefinition(orm); Customize(mapper); entities.AddRange(DomainTypes); return mapper.CompileMappingFor(entities); }
public CoolDomainMapper() { orm = new ObjectRelationalMapper(); // Remove one of not required patterns orm.Patterns.ManyToOneRelations.Remove( orm.Patterns.ManyToOneRelations.Single(p => p.GetType() == typeof (OneToOneUnidirectionalToManyToOnePattern))); orm.Patterns.PoidStrategies.Add(new NativePoidPattern()); var patternsAppliers = new CoolPatternsAppliersHolder(orm); patternsAppliers.Merge(new DatePropertyByNameApplier()).Merge(new MsSQL2008DateTimeApplier()); mapper = new Mapper(orm, patternsAppliers); }