Inheritance: UnitOfWorkConfigurationBase
        protected override void Context()
        {
            base.Context();

            IDictionary<string, string> properties = new Dictionary<string, string>
             	{
             		{"connection.driver_class", "NHibernate.Driver.SQLite20Driver"},
             		{"dialect", "NHibernate.Dialect.SQLiteDialect"},
             		{"connection.provider", "NHibernate.Connection.DriverConnectionProvider"},
             		{"connection.connection_string", @"Data Source=:memory:;Version=3;New=True;"},
             		{"connection.release_mode", "on_close"}
             	};

            NHibernateConfig config
                = new NHibernateConfig(() =>
                                       	{
                                       		var cfg = new Configuration().Configure()
                                                .SetProperties(properties);
                                            cfg.AddMappingsFromAssembly(typeof(WidgetMap).Assembly);
                                       		return cfg;
                                       	}, _repositoryFactory, _uowStorage);

            UnitOfWork.Configure(config);
            UnitOfWork.Start(() =>
            {
                wasExecuted = true;
            });
        }
Esempio n. 2
0
        public void Start()
        {
            if (log.IsInfoEnabled)
            {
                log.Info(Consts.ENTERED);
            }

            NHibernateSession = NHibernateConfig.GetSession();

            if (log.IsDebugEnabled)
            {
                log.Debug(NHibernateSession);
            }
        }
        protected override void Context()
        {
            base.Context();

            FileStream fs = new FileStream(@".\hibernate.cfg.xml", FileMode.Open, FileAccess.Read);
            NHibernateConfig config = new NHibernateConfig(fs, _repositoryFactory, _uowStorage);
            UnitOfWork.Configure(config);
            fs.Dispose();

            UnitOfWork.Start(() =>
            {
                wasExecuted = true;
            });
        }
        protected override void Context()
        {
            base.Context();

            NHibernateConfig config = new NHibernateConfig(_repositoryFactory, _uowStorage);
            UnitOfWork.Configure(config);
            UnitOfWork.Start(() =>
            {
                Transaction.Begin();
                NHibernateConfig.GenerateSchema();
                Transaction.Commit();
                wasExecuted = true;
            });
        }
        protected override void Context()
        {
            base.Context();

            IDictionary<string, string> properties = new Dictionary<string, string>
             	{
             		{"connection.driver_class", "NHibernate.Driver.SQLite20Driver"},
             		{"dialect", "NHibernate.Dialect.SQLiteDialect"},
             		{"connection.provider", "NHibernate.Connection.DriverConnectionProvider"},
             		{
             			"connection.connection_string",
             			@"Data Source=:memory:;Version=3;New=True;"
             			},
             		{"connection.release_mode", "on_close"},
                {"proxyfactory.factory_class","NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle"}
             	};

            NHibernateConfig config = new NHibernateConfig(properties, _repositoryFactory, _uowStorage, typeof(Foo).Assembly );
            UnitOfWork.Configure(config);
            UnitOfWork.Start(() =>
            {
                wasExecuted = true;
            });
        }
Esempio n. 6
0
        protected override void Context()
        {
            base.Context();

            _config = new NHibernateConfig(_repositoryFactory, _uowStorage);
            UnitOfWork.Configure(_config);
        }
        protected override void Context()
        {
            base.Context();

            NHibernateConfig config = new NHibernateConfig(@".\hibernate.cfg.xml", _repositoryFactory, _uowStorage);
            UnitOfWork.Configure(config);
            UnitOfWork.Start(() =>
            {
                wasExecuted = true;
            });
        }
        protected override void Context()
        {
            base.Context();

            //DepCon.ClearRegistrations();
            fooRepo = new MockFooRepo();
            //DepCon.RegisterInstance<IFooRepository>(fooRepo);
            ObjectFactory.Initialize(
                factory => factory
                    .ForRequestedType<IFooRepository>().TheDefault.IsThis(fooRepo));

            IDictionary<string, string> properties = new Dictionary<string, string>
            {
                {"connection.driver_class", "NHibernate.Driver.SQLite20Driver"},
                {"dialect", "NHibernate.Dialect.SQLiteDialect"},
                {"connection.provider", "NHibernate.Connection.DriverConnectionProvider"},
                {
                    "connection.connection_string",
                    @"Data Source=FooDb.s3db"
                    },
                {"connection.release_mode", "on_close"},
                {"proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle"}
            };

            NHibernateConfig config = new NHibernateConfig(properties, _repositoryFactory, _uowStorage, typeof(Foo).Assembly );
            UnitOfWork.Configure(config);
            UnitOfWork.Start(() =>
            {
                Transaction.Begin();
                Repository<IFooRepository>.Do.Something();
                Transaction.Rollback();
            });
            UnitOfWork.Start(() =>
             		{
                foo = fooRepo.CheckForIt();
             		});
        }