Example #1
0
        public void AddAutoMappingAddsAnyAutoMappedMappingsToCfgWhenMerged()
        {
            mapping.MergeMappings();
            mapping.AutoMappings.Add(AutoMap.Source(new StubTypeSource(typeof(Record))));
            mapping.Apply(cfg);

            cfg.ClassMappings.Count.ShouldBeGreaterThan(0);
            cfg.ClassMappings.ShouldContain(c => c.MappedClass == typeof(Record));
        }
        public void AddFromAssemblyAddsAnyClassMapMappingsToCfgWhenMerged()
        {
            mapping.MergeMappings();
            mapping.FluentMappings.AddFromAssembly(typeof(Record).Assembly);
            mapping.Apply(cfg);

            cfg.ClassMappings.Count.ShouldBeGreaterThan(0);
            cfg.ClassMappings.ShouldContain(c => c.MappedClass == typeof(Record));
        }
        private void ConfigureMapping(string sessionAlias, MappingConfiguration mappingConfiguration)
        {
            hbmMappingRegisterer.Apply(sessionAlias, mappingConfiguration.HbmMappings);

            foreach (IAutoPersistenceModelProvider autoPersistenceModelProvider in autoPersistenceModelProviders)
            {
                AutoPersistenceModel autoPersistenceModel = autoPersistenceModelProvider.GetAutoPersistenceModel(assemblyProvider, sessionAlias);
                autoPersistenceModel.Conventions.Setup(conventionFinder => conventionApplier.Apply(sessionAlias, conventionFinder));
                mappingConfiguration.AutoMappings.Add(autoPersistenceModel);
            }
            mappingConfiguration.MergeMappings();
        }