示例#1
0
        private static IMappingEngine ConfigureMappingEngine()
        {
            var config = new ConfigurationStore(new TypeMapFactory(), MapperRegistry.AllMappers());

            ApplyMap.On(config).AddFromAssemblyOf <ProductMapCreator>().Apply();
            config.AssertConfigurationIsValid();

            return(new MappingEngine(config));

            // Another way, Useful if we want to reuse the
            // static Mapper class' engine or we already have it
            // spread around in our code

            //Mapper.Initialize(cfg =>
            //    ApplyMap.On(cfg).AddFromAssemblyOf<ProductMapCreator>().Apply());

            //return Mapper.Engine;
        }
示例#2
0
 public new void Setup()
 {
     Mapper.Reset();
     Mapper.Initialize(cfg => ApplyMap.On(cfg).AddFromAssemblyOf <ProductMapCreator>().Apply());
     NHibernateSession.InitCurrentSession(Session);
 }