public void AddCustomDelegatedWithoutType() { var orm = new Mock <IDomainInspector>(); var mapper = new Mapper(orm.Object); var previousApplierCount = mapper.PatternsAppliers.RootClass.Count; mapper.AddRootClassPattern(mi => true, (mi, cm) => { }); mapper.PatternsAppliers.RootClass.Count.Should().Be(previousApplierCount + 1); }
public void AddSimpleCustomDelegatedWithType() { var orm = new Mock<IDomainInspector>(); var mapper = new Mapper(orm.Object); var previousApplierCount = mapper.PatternsAppliers.RootClass.Count; mapper.AddRootClassPattern(mi => true, cm => { }); mapper.PatternsAppliers.RootClass.Count.Should().Be(previousApplierCount + 1); }
private static HbmMapping GetMapping() { var orm = new ObjectRelationalMapper(); var mapper = new Mapper(orm, new CoolPatternsAppliersHolder(orm)); mapper.AddPropertyPattern(IsLongString, p => p.Length(4001)); orm.Patterns.Poids.Add(IsId); orm.Patterns.PoidStrategies.Add(new AssignedPoidPattern()); var domainClasses = typeof (IEntity).Assembly.GetTypes() .Where(t => t.IsClass && !t.IsAbstract) .Where(t => typeof (IEntity).IsAssignableFrom(t)) .ToArray(); orm.TablePerClass(domainClasses); mapper.AddRootClassPattern(t => true, applier => applier.Lazy(false)); var mapping = mapper.CompileMappingFor(domainClasses); return mapping; }