/// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public FakeFrameworkContext()
 {
     var fakeMapperList = new List<Lazy<AbstractMappingEngine, TypeMapperMetadata>>();
     TypeMappers = new MappingEngineCollection(fakeMapperList);
     CurrentLanguage = Thread.CurrentThread.CurrentCulture;
     TextManager = LocalizationConfig.SetupDefault();
     ScopedFinalizer = new NestedLifetimeFinalizer();
     TaskManager = new ApplicationTaskManager(Enumerable.Empty<Lazy<AbstractTask, TaskMetadata>>());
     ApplicationCache = new HttpRuntimeApplicationCache();
     ScopedCache = new ThreadStaticScopedCache();
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public FakeFrameworkContext()
        {
            var fakeMapperList = new List <Lazy <AbstractMappingEngine, TypeMapperMetadata> >();

            TypeMappers      = new MappingEngineCollection(fakeMapperList);
            CurrentLanguage  = Thread.CurrentThread.CurrentCulture;
            TextManager      = LocalizationConfig.SetupDefault();
            ScopedFinalizer  = new NestedLifetimeFinalizer();
            TaskManager      = new ApplicationTaskManager(Enumerable.Empty <Lazy <AbstractTask, TaskMetadata> >());
            ApplicationCache = new HttpRuntimeApplicationCache();
            ScopedCache      = new ThreadStaticScopedCache();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public FakeFrameworkContext(ISerializer serializer = null)
 {
     serializer = serializer ?? new ServiceStackSerialiser();
     var fakeMapperList = new List<Lazy<AbstractMappingEngine, TypeMapperMetadata>>();
     TypeMappers = new MappingEngineCollection(fakeMapperList);
     CurrentLanguage = Thread.CurrentThread.CurrentCulture;
     TextManager = LocalizationConfig.SetupDefault();
     ScopedFinalizer = new NestedLifetimeFinalizer();
     TaskManager = new ApplicationTaskManager(Enumerable.Empty<Lazy<AbstractTask, TaskMetadata>>());
     ApplicationCache = new HttpRuntimeApplicationCache();
     ScopedCache = new DictionaryScopedCache();
     Caches = new DefaultFrameworkCaches(new DictionaryCacheProvider(), new RuntimeCacheProvider());
     Serialization = new SerializationService(serializer);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public FakeFrameworkContext(ISerializer serializer = null)
        {
            serializer = serializer ?? new ServiceStackSerialiser();
            var fakeMapperList = new List <Lazy <AbstractMappingEngine, TypeMapperMetadata> >();

            TypeMappers      = new MappingEngineCollection(fakeMapperList);
            CurrentLanguage  = Thread.CurrentThread.CurrentCulture;
            TextManager      = LocalizationConfig.SetupDefault();
            ScopedFinalizer  = new NestedLifetimeFinalizer();
            TaskManager      = new ApplicationTaskManager(Enumerable.Empty <Lazy <AbstractTask, TaskMetadata> >());
            ApplicationCache = new HttpRuntimeApplicationCache();
            ScopedCache      = new DictionaryScopedCache();
            Caches           = new DefaultFrameworkCaches(new DictionaryCacheProvider(), new RuntimeCacheProvider());
            Serialization    = new SerializationService(serializer);
        }
        private IFrameworkContext GetFrameworkContext()
        {
            TextManager textManager = LocalizationConfig.SetupDefault();
            MappingEngineCollection typeMappers = GetTypeMappers();

            AbstractScopedCache scopedCache = new DictionaryScopedCache();
            AbstractApplicationCache applicationCache = new HttpRuntimeApplicationCache();
            AbstractFinalizer finalizer = new NestedLifetimeFinalizer();
            var taskMgr = new ApplicationTaskManager(Enumerable.Empty<Lazy<AbstractTask, TaskMetadata>>());
            IFrameworkContext frameworkContext = new DefaultFrameworkContext(textManager, typeMappers, scopedCache,
                                                                             applicationCache, finalizer, taskMgr);

            return frameworkContext;
        }