示例#1
0
        public virtual void Init(BemConfiguration config)
        {
            var rootDir = config.Get(cfg => cfg.RootDir, BemConfiguration.Defaults.ROOT_DIR);

            RootDir       = Path.IsPathRooted(rootDir) ? rootDir : HostingEnvironment.MapPath(rootDir);
            DefaultBundle = config.Get(cfg => cfg.DefaultBundle, BemConfiguration.Defaults.DEFAULT_BUNDLE);
        }
示例#2
0
        public static Mapper Create(BemConfiguration config)
        {
            string name = config.Get(cfg => cfg.Mapper, BemConfiguration.Defaults.MAPPER);
            Mapper mapper;

            switch (name)
            {
            case "Single":
                mapper = new Single();
                break;

            case "ByController":
                mapper = new ByController();
                break;

            default:
                var type = Type.GetType(name, true);
                mapper = (Mapper)Activator.CreateInstance(type);
                break;
            }

            mapper.Init(config);
            return(mapper);
        }