Beispiel #1
0
 private SimpleObjectContextStorage GetSimpleObjectContextStorage()
 {
     HttpContext context = HttpContext.Current;
     SimpleObjectContextStorage storage = context.Items[HttpContextObjectContextStorageKey] as SimpleObjectContextStorage;
     if (storage == null)
     {
         storage = new SimpleObjectContextStorage();
         context.Items[HttpContextObjectContextStorageKey] = storage;
     }
     return storage;
 }
        public BaseTestRequiringRepositoryAccess()
        {
            try
            {
                _storage = new SimpleObjectContextStorage();
                TestInitializer.Initialize(_container, _storage);
            }
            catch (Exception)
            {

                throw;
            }
        }
Beispiel #3
0
        public static void Initialize(IWindsorContainer container, SimpleObjectContextStorage storage)
        {
            if (_isInitialize)
                return;

            ServiceLocatorInitializer.Init(container);

            try
            {
                ObjectContextInitializer.Instance().InitializeObjectContextOnce(() =>
                {
                    //ObjectContextBuilder<ObjectContext> builder = new ObjectContextBuilder<ObjectContext>("DSI", new[] { "ETS.ClientPortal.Infrastructure.Data" }, true, true);
                    //ObjectContextManager.Current = builder.BuildObjectContext();
                    ObjectContextManager.InitStorage(storage);
                    ObjectContextManager.Init(new[] { AppDomain.CurrentDomain.BaseDirectory + "//ETS.ClientPortal.Infrastructure.Data" });
                });
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                throw;
            }
            _isInitialize = true;
        }