public virtual void Init()
        {
            _databaseFilePath = Path.GetTempFileName();
            _sessionFactory   = DataUtility.CreateSessionFactory(_databaseFilePath, DatabaseTypes.ToArray());
            _session          = _sessionFactory.OpenSession();
            _clock            = new StubClock();

            var builder = new ContainerBuilder();

            //builder.RegisterModule(new ImplicitCollectionSupportModule());
            builder.RegisterInstance(new StubLocator(_session)).As <ISessionLocator>();
            builder.RegisterInstance(_clock).As <IClock>();
            builder.RegisterGeneric(typeof(Repository <>)).As(typeof(IRepository <>));
            Register(builder);
            _container = builder.Build();
        }
示例#2
0
        public virtual void Init()
        {
            _databaseFilePath = Path.GetTempFileName();
            _sessionFactory   = DataUtility.CreateSessionFactory(_databaseFilePath, DatabaseTypes.ToArray());
            _session          = _sessionFactory.OpenSession();
            _transaction      = _session.BeginTransaction(IsolationLevel.ReadCommitted);

            _clock = new StubClock();

            var builder = new ContainerBuilder();

            //builder.RegisterModule(new ImplicitCollectionSupportModule());
            builder.RegisterInstance(new StubLocator(_session)).As <ISessionLocator>();
            builder.RegisterInstance(_clock).As <IClock>();
            builder.RegisterGeneric(typeof(Repository <>)).As(typeof(IRepository <>));
            builder.RegisterInstance(new ShellSettings {
                Name = ShellSettings.DefaultName, DataProvider = "SqlCe"
            });
            Register(builder);
            _container = builder.Build();
        }
        public virtual void Init()
        {
            _databaseFilePath = Path.GetTempFileName();
            _sessionFactory   = DataUtility.CreateSessionFactory(_databaseFilePath, DatabaseTypes.ToArray());
            _session          = _sessionFactory.OpenSession();
            _clock            = new StubClock();

            var builder = new ContainerBuilder();

            //builder.RegisterModule(new ImplicitCollectionSupportModule());
            builder.RegisterType <InfosetHandler>().As <IContentHandler>();
            builder.RegisterInstance(new StubLocator(_session)).As <ISessionLocator>();
            builder.RegisterInstance(_clock).As <IClock>();
            builder.RegisterGeneric(typeof(Repository <>)).As(typeof(IRepository <>)).InstancePerLifetimeScope();
            builder.RegisterInstance(_shellSettings = new ShellSettings {
                Name = ShellSettings.DefaultName, DataProvider = "SqlCe"
            });
            builder.RegisterType <TestTransactionManager>().As <ITransactionManager>().InstancePerLifetimeScope();
            builder.Register(context => _sessionFactory.OpenSession()).As <ISession>().InstancePerLifetimeScope();

            Register(builder);
            _container = builder.Build();
        }