Пример #1
0
        public GroupingControlForm(NHibernate.ISessionFactory sessionFactory)
        {
            InitializeComponent();

            this.session = sessionFactory.OpenSession();

            tlvGroupedFiles.CanExpandGetter += x => (((tlvBranch)x).Data is SpectrumSourceGroup && ((tlvBranch)x).Children.Any());
            tlvGroupedFiles.ChildrenGetter  += getChildren;
            tlvGroups.AspectGetter          += x =>
            {
                var nodeTracker      = ((tlvBranch)x);
                var offsetCorrection = 0;
                while (nodeTracker.Parent.Text != null)
                {
                    offsetCorrection++;
                    nodeTracker = nodeTracker.Parent;
                }
                return(((tlvBranch)x).Text + new string(' ', offsetCorrection *7));
            };
            tlvGroups.AutoCompleteEditor = false;

            tlvGroups.ImageGetter += delegate(object x) { return((((tlvBranch)x).Data is SpectrumSourceGroup) ? Properties.Resources.XPfolder_closed : Properties.Resources.file); };

            ApplyDefaultGroups(null, null);
        }
 public void TestFixtureSetUp()
 {
     _configuration = new Configuration();
     _configuration.Configure();
     _configuration.AddAssembly(typeof(User).Assembly);
     _sessionFactory = _configuration.BuildSessionFactory();
 }
Пример #3
0
 public NetworkController(
     NHibernate.ISession session,
     NHibernate.ISessionFactory sessionFactory)
 {
     _session        = session ?? throw new ArgumentNullException(nameof(session));
     _sessionFactory = sessionFactory ?? throw new ArgumentNullException(nameof(sessionFactory));
 }
        public Reminders()
        {
            InitializeComponent();

            if (mySession != null && mySession.IsOpen)
            {
                mySession.Close();
            }
            if (mySessionFactory != null && !mySessionFactory.IsClosed)
            {
                mySessionFactory.Close();
            }
            // Initializing NHibernate
            myConfiguration = new Configuration();
            myConfiguration.Configure();
            mySessionFactory = myConfiguration.BuildSessionFactory();
            mySession        = mySessionFactory.OpenSession();

            //Show TaskNameFromDatabase in ListBox
            using (mySession.BeginTransaction())
            {
                ICriteria    criteria = mySession.CreateCriteria <ToDo>();
                IList <ToDo> list     = criteria.List <ToDo>().Where(a => a.Status == "ToDo" && (DateTime.Now < a.StartDate))
                                        .OrderBy(a => a.StartDate).OrderBy(a => a.EndDate).ToList();
                foreach (var item in list)
                {
                    listView_reminders.Items.Add(item.TaskName);
                    listView_reminders.Items.Add(item.StartDate.ToString("dd/MM/yyyy"));
                    listView_reminders.Items.Add(item.EndDate.ToString("dd/MM/yyyy"));
                }
            }
            ChangeView();
        }
 public NH.ISessionFactory BuildSessionFactory()
 {
     if (this.sessionFactory == null)
     {
         this.semaphore.Acquire();
         if (this.sessionFactory == null)//Reteste.. outra thread pode ter feito o preenchimento do campo antes da liberação do semáfoto.
         {
             try
             {
                 this.sessionFactory = this.BuildSessionFactoryInternal();
             }
             catch (Exception)
             {
                 throw;
             }
             finally
             {
                 this.semaphore.Release();
             }
         }
         else
         {
             this.semaphore.Release();
         }
     }
     return(this.sessionFactory);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SessionFactory"/> class.
        /// </summary>
        /// <param name="configuration">
        /// The configuration.
        /// </param>
        public SessionFactory(IConfiguration configuration)
        {
            configuration.Configure();

            // Ensure mapping files are embedded in assembly
            this.factory = configuration.BuildSessionFactory();
        }
Пример #7
0
            public SessionFactoryImpl()
            {
                var dbConfig = OracleManagedDataClientConfiguration.Oracle10
                               .ConnectionString(csb => csb.FromConnectionStringWithKey("TestNhMcs"))
#if DEBUG
                               .ShowSql()
#endif
                               .FormatSql();

                _sessionFactory = Fluently.Configure()
                                  .Mappings(m =>
                {
                    m.FluentMappings.AddFromAssemblyOf <ProductMapping>();
                })
                                  .Database(dbConfig)
                                  .ExposeConfiguration(cfg =>
                {
                    cfg.SqlFunctions.Add(MultiCulturalStringGet.FunctionName, new MultiCulturalStringGet());
                    cfg.LinqToHqlGeneratorsRegistry <McsLinqToHqlGeneratorsRegistry>();
                    cfg.SetProperty("hbm2ddl.keywords", "auto-quote");
                    cfg.SetProperty("adonet.batch_size", "50");
                    new SchemaUpdate(cfg).Execute(true, true);
                })
                                  .BuildSessionFactory();
            }
Пример #8
0
        private static void BuildSessionFactory(NHibernate.Cfg.Configuration cfg)
        {
            try
            {
                // Use NHibernate.Mapping.Attributes to create information about our entities
                System.IO.MemoryStream stream = new System.IO.MemoryStream();        // Where the information will be written in
                NHibernate.Mapping.Attributes.HbmSerializer.Default.Validate = true; // Enable validation (optional)
                // Ask to NHibernate to use fields instead of properties
                NHibernate.Mapping.Attributes.HbmSerializer.Default.HbmDefaultAccess = "field.camelcase-underscore";
                // Gather information from this assembly (can also be done class by class)
                //System.Console.Out.WriteLine("NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize()...\n");
                NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize(stream, System.Reflection.Assembly.GetExecutingAssembly());
                stream.Position = 0;
                //               StreamReader sr = new StreamReader(stream);

                //            string IbDoc = sr.ReadToEnd();
                cfg.AddInputStream(stream); // Send the Mapping information to NHibernate Configuration
                stream.Close();
                // Create table(s) in the database for our entities
                //   System.Console.Out.WriteLine("new NHibernate.Tool.hbm2ddl.SchemaExport(cfg).Create()...");
                // Build the SessionFactory
                //   System.Console.Out.WriteLine("\n\nsessionFact = cfg.BuildSessionFactory();\n\n");
                SessionFactory = cfg.BuildSessionFactory();
            }
            catch (Exception e)
            {
                throw new Exception("An error occurred while building the NHibernate Session Factory used for internal data storage." + Environment.NewLine +
                                    "Error CNF-370 in " + PROJ_FILE_NAME + ".BuildSessionFactory(): " + e.Message);
            }
        }
        // TODO: Allow for connection string name, connection string, and mappings assembly
        // to be pulled from configuration settings.
        // Perhaps this class can be moved to RyanPenfold.Repository.NHibernate with a custom
        // configuration section that can switch between fluent or classic NHibernate.
        // Perhaps this class can tap in to the hibernate-configuration section
        // Both FluentSessionFactory and SessionFactory should be singletons stored in
        // a container
        // See this page for fluent configuration options
        // http://www.jagregory.com/writings/fluent-nhibernate-configuring-your-application/

        /// <summary>
        /// The initialize session factory.
        /// </summary>
        private static void InitializeSessionFactory()
        {
            sessionFactory =
                Fluently.Configure().Database(
                    MsSqlConfiguration.MsSql2008.ConnectionString(
                        @"Server=localhost;Database=RyanPenfold.SiteFoundation;Trusted_Connection=True;").ShowSql()).Mappings(
                    m => m.FluentMappings.AddFromAssembly(Assembly.Load("RyanPenfold.SiteFoundation.Repository"))).BuildSessionFactory();
        }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SessionFactoryAdapterBase"/> class.
 /// </summary>
 /// <param name="sessionFactory">Session factory.</param>
 /// <param name="allowTransactionNesting">Specifies whether or not transaction-nesting is permitted or not.</param>
 /// <param name="reuseExistingSessionWhereAvailable">Specifies whether or not an existing session will be re-used if it exists.</param>
 protected SessionFactoryAdapterBase(Nh.ISessionFactory sessionFactory,
                                     bool allowTransactionNesting            = false,
                                     bool reuseExistingSessionWhereAvailable = false)
 {
     this.sessionFactory                     = sessionFactory ?? throw new ArgumentNullException(nameof(sessionFactory));
     this.allowTransactionNesting            = allowTransactionNesting;
     this.reuseExistingSessionWhereAvailable = reuseExistingSessionWhereAvailable;
 }
Пример #11
0
        private NHibernate.ISessionFactory getSessionFactory()
        {
            if (sessionFactory == null)
            {
                Configuration configuration = GetConfiguration();
                sessionFactory = configuration.BuildSessionFactory();
            }

            return sessionFactory;
        }
Пример #12
0
 static SessionProvider()
 {
     _sessionFactory = Fluently.Configure()
                       .Database(
         SQLiteConfiguration.Standard
         .UsingFile(NhHelper.Instance.DbFile))
                       .Mappings(x =>
                                 x.FluentMappings.AddFromAssemblyOf <ProjectMap>())
                       .BuildSessionFactory();
 }
Пример #13
0
        /// <summary>
        /// Gets the unit of work.
        /// </summary>
        /// <returns></returns>
        private IUnitOfWork GetUnitOfWork()
        {
            var cfg = new Configuration();

            cfg.Configure();
            cfg.AddAssembly(Assembly.Load("CRM.Dal.Nhibernate"));
            NHibernate.ISessionFactory factory = cfg.BuildSessionFactory();
            ISession session = factory.OpenSession();

            return(new UnitOfWork(session));
        }
Пример #14
0
        public static Configuration AddConfiguration(
            string factoryKey, NHibernateOrg.ISessionFactory sessionFactory, Configuration cfg, string validatorCfgFile)
        {
            Check.Require(
                !SessionFactories.ContainsKey(factoryKey),
                "A session factory has already been configured with the key of " + factoryKey);

            SessionFactories.Add(factoryKey, sessionFactory);

            return(cfg);
        }
Пример #15
0
        public IsobaricMappingForm(NHibernate.ISessionFactory sessionFactory)
        {
            InitializeComponent();

            this.session = sessionFactory.OpenSession();

            acStrings = new AutoCompleteStringCollection();
            acStrings.Add("Reference");
            acStrings.Add("Empty");

            isobaricMappingTables = new Dictionary <QuantitationMethod, DataGridView>();
        }
Пример #16
0
 /// <summary>
 /// Realiza o Build de um ISession
 /// </summary>
 /// <param name="interceptor"></param>
 /// <returns></returns>
 private NH.ISession BuildSession(NH.IInterceptor interceptor)
 {
     NH.ISessionFactory sessionFactory = this.ContextAttribute.SessionFactoryBuilder.BuildSessionFactory();
     NH.ISessionBuilder sessionBuilder = sessionFactory.WithOptions();
     if (interceptor != null)
     {
         sessionBuilder = sessionBuilder.Interceptor(interceptor);
     }
     sessionBuilder = sessionBuilder.FlushMode(this.IsTransactional ? this.ContextAttribute.SessionFactoryBuilder.TransactionFlushMode : this.ContextAttribute.SessionFactoryBuilder.DefaultFlushMode);
     NH.ISession session = sessionBuilder.OpenSession();
     return(session);
 }
        /// <summary>
        ///     Principal método privado, realiza a criação do SessionFactory e este não deve ser criado novamente até que o domínio de aplicação seja finalizado.
        /// </summary>
        /// <returns></returns>
        protected override NH.ISessionFactory BuildSessionFactoryInternal()
        {
            FluentNH.Cfg.Db.IPersistenceConfigurer databaseConfiguration = this.BuildPersistenceConfigurer();

            Func <NH.Cfg.Configuration, NH.Cfg.Configuration> configureWithRawProperties = (config) => {
                if (this.NHibernateRawConfigurationValues != null && this.NHibernateRawConfigurationValues.Count > 0)
                {
                    foreach (var rawConfigurationValue in this.NHibernateRawConfigurationValues)
                    {
                        config.SetProperty(rawConfigurationValue.Key, rawConfigurationValue.Value);
                    }
                }
                return(config);
            };

            FluentNH.Cfg.FluentConfiguration configuration = FluentNH.Cfg.Fluently
                                                             .Configure()
                                                             .Database(databaseConfiguration)
                                                             .Cache(it =>
                                                                    it.UseQueryCache()
                                                                    .ProviderClass <NH.Cache.HashtableCacheProvider>()
                                                                    )
                                                             .Diagnostics(it =>
                                                                          it.Enable(this.EnabledDiagnostics)
                                                                          .OutputToConsole()
                                                                          )
                                                             .ExposeConfiguration(it =>
                                                                                  configureWithRawProperties(
                                                                                      it
                                                                                      .SetProperty("command_timeout", this.CommandTimeout.ToString(CultureInfo.InvariantCulture))
                                                                                      .SetProperty("adonet.batch_size", this.BatchSize.ToString(CultureInfo.InvariantCulture))
                                                                                      )
                                                                                  );

            foreach (string typeName in this.TypeNames)
            {
                Type typeInfo = Type.GetType(typeName);
                if (typeInfo == null)
                {
                    throw new ConfigurationErrorsException(string.Format(CultureInfo.InvariantCulture, "Cannot load the Type '{0}', defined in TypeNames property of FluentNHibernateSessionFactoryBuilder", typeName));
                }
                configuration.Mappings(it =>
                {
                    it.FluentMappings.AddFromAssembly(typeInfo.Assembly);
                    it.HbmMappings.AddFromAssembly(typeInfo.Assembly);
                });
            }

            NH.ISessionFactory sessionFactory = configuration.BuildSessionFactory();

            return(sessionFactory);
        }
Пример #18
0
        public void FixtureSetup()
        {
            this.unityContainer = new UnityContainer();
            IoC.Initialize(
                (x, y) => this.unityContainer.RegisterType(x, y),
                (x, y) => this.unityContainer.RegisterInstance(x, y),
                (x) => { return(unityContainer.Resolve(x)); },
                (x) => { return(unityContainer.ResolveAll(x)); });

            // Context Factory
            NHUnitOfWorkFactory ctxFactory = this.CreateNHContextFactory();

            if (!ctxFactory.DatabaseExists())
            {
                ctxFactory.CreateDatabase();
            }

            ctxFactory.ValidateDatabaseSchema();

            NHibernate.ISessionFactory sessionFactory = ctxFactory.CreateSessionFactory();

            this.unityContainer.RegisterInstance <NHibernate.ISessionFactory>(sessionFactory);
            this.unityContainer.RegisterInstance <IDatabaseManager>(ctxFactory);
            this.unityContainer.RegisterInstance <IUnitOfWorkFactory>(ctxFactory);

            var configuration = IoC.GetInstance <NHibernate.Cfg.Configuration>();

            AuditFlushEntityEventListener.OverrideIn(configuration);
            ValidateEventListener.AppendTo(configuration);
            AuditEventListener.AppendTo(configuration);
            TenantEventListener.AppendTo(configuration);

            var tenantId = Guid.NewGuid();

            ApplicationContext.User =
                new TenantPrincipal(new CoreIdentity("fake", "hexa.auth", "*****@*****.**"), new string[] { }, tenantId);

            this.unityContainer.RegisterType <ISession, ISession>(new InjectionFactory((c) =>
            {
                var session = ctxFactory.CurrentSession;
                var filter  = session.EnableFilter("TenantFilter");
                filter.SetParameter("tenantId", tenantId);
                return(session);
            }));

            // Repositories
            this.unityContainer.RegisterType <IEntityARepository, EntityANHRepository>(new PerResolveLifetimeManager());
            this.unityContainer.RegisterType <IEntityBRepository, EntityBNHRepository>(new PerResolveLifetimeManager());
        }
Пример #19
0
 public void InitializingHibernate()
 {
     if (mySession != null && mySession.IsOpen)
     {
         mySession.Close();
     }
     if (mySessionFactory != null && !mySessionFactory.IsClosed)
     {
         mySessionFactory.Close();
     }
     myConfiguration = new Configuration();
     myConfiguration.Configure();
     mySessionFactory = myConfiguration.BuildSessionFactory();
     mySession        = mySessionFactory.OpenSession();
 }
Пример #20
0
        public void Setup()
        {
            config = new NHibernate.Cfg.Configuration();
            config.Configure("NHibernate.cfg.xml");



            // 附加IInterceptor 给ISession对象
            //interceptor = new TestInterceptor();
            //config.Interceptor = interceptor;
            var cfg = Fluently.Configure(config);

            config         = cfg.Mappings(m => m.FluentMappings.AddFromAssembly(typeof(EZDev.Data.ParameterItem).Assembly)).BuildConfiguration();
            sessionFactory = config.BuildSessionFactory();
            //var session2 = sessionFactory.OpenSession();
            //var session1 = sessionFactory.GetCurrentSession();
        }
Пример #21
0
        public static void Configure()
        {
            var config = new Configuration();

            //configure the connection string
            config.Configure();
            //add our mapping
            var mapper = new ModelMapper();

            mapper.AddMapping <UserMap>();
            mapper.AddMapping <RoleMap>();
            mapper.AddMapping <TagMap>();
            mapper.AddMapping <PostMap>();

            config.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());
            //create session factory
            _sessionFactory = config.BuildSessionFactory();
        }
Пример #22
0
            /// <summary>
            /// Конструктор, инициализирует объект <see cref="NHibernateConfiguration"/> класса
            /// </summary>
            public NHibernateConfiguration(string connectionString)
            {
                var hibernateConfig = Fluently.Configure().Mappings(m => m.FluentMappings.AddFromAssemblyOf <MessageMap>())
                                      .Database(MySQLConfiguration.Standard.Dialect <MySQL5Dialect>().ConnectionString(connectionString).ShowSql()).BuildConfiguration();

                var settings = GetSettings();

                if (!settings.TablesExist)
                {
                    var exporter = new SchemaExport(hibernateConfig);
                    exporter.Execute(true, true, false);

                    settings.TablesExist = true;
                    CreateOrUpdateSettings(settings);
                }

                _sessionFactory = hibernateConfig.BuildSessionFactory();
            }
Пример #23
0
        /// <summary>
        /// initializes the session for database
        /// </summary>
        private static void Init()
        {
            try
            {
                NHibernate.Cfg.Configuration config = new NHibernate.Cfg.Configuration();



                //string path = HttpContext.Current.Server.MapPath("~/hibernateconfigfile");
                //config.Configure(path);

                Assembly assem=Assembly.GetExecutingAssembly();

                config.AddAssembly(Assembly.GetExecutingAssembly());//adds all the embedded resources .hbm.xml
                sFactory = config.BuildSessionFactory();
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
Пример #24
0
        /// <summary>
        /// initializes the session for database
        /// </summary>
        private static void Init()
        {
            try
            {
                NHibernate.Cfg.Configuration config = new NHibernate.Cfg.Configuration();



                //string path = HttpContext.Current.Server.MapPath("~/hibernateconfigfile");
                //config.Configure(path);

                Assembly assem = Assembly.GetExecutingAssembly();

                config.AddAssembly(Assembly.GetExecutingAssembly());//adds all the embedded resources .hbm.xml
                sFactory = config.BuildSessionFactory();
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
Пример #25
0
        public void reminder()
        {
            DateTime date         = DateTime.Now;
            DateTime date_plusOne = date.AddDays(1);

            if (mySession != null && mySession.IsOpen)
            {
                mySession.Close();
            }
            if (mySessionFactory != null && !mySessionFactory.IsClosed)
            {
                mySessionFactory.Close();
            }
            // Initializing NHibernate
            myConfiguration = new Configuration();
            myConfiguration.Configure();
            mySessionFactory = myConfiguration.BuildSessionFactory();
            mySession        = mySessionFactory.OpenSession();
            int i = 0;

            //I'm checking if there are any new tasks tomorrow
            using (mySession.BeginTransaction())
            {
                ICriteria    criteria = mySession.CreateCriteria <ToDo>();
                IList <ToDo> list     = criteria.List <ToDo>().Where(a => a.Status == "ToDo" && (date
                                                                                                 <= a.StartDate && date_plusOne >= a.StartDate)).ToList();
                i = 0;
                foreach (var item in list)
                {
                    i++;
                }
            }
            if (i > 0)
            {
                Alert alert = new Alert();
                alert.showAlert("Jutro masz nowe zadania do zrobienia !");
            }

            button_TodoList.Text = "Rzeczy \ndo zrobienia";
        }
Пример #26
0
        /// <summary>
        /// Build NHibernate session. The connection with the database.
        /// </summary>
        /// <param name="company">the tenancy company with that all queryes in the system will
        /// be eexecuted with this company.</param>
        /// <param name="connectionString">The connection string that want to be used.</param>
        public void BuildSession(Guid company, String connectionString)
        {
            try
            {
                this.Company = company;

                var configuration = Fluently
                                    .Configure()
                                    //.Database(MySQLConfiguration.Standard.ConnectionString(connectionString).ShowSql())
                                    .Database(MsSqlConfiguration.MsSql2008.ConnectionString(connectionString).ShowSql())
                                    //SQLiteConfiguration.Standard.UsingFile("Teste.db"))
                                    //MySQLConfiguration.Standard.ConnectionString(connectionString))
                                    .Mappings(x => x.FluentMappings.AddFromAssemblyOf <AddressMap>()
                                              .Conventions
                                              .AddFromAssemblyOf <TableNameConvention>())
                                    .ExposeConfiguration(cfg =>
                {
                    cfg.SetProperty(NHibernate.Cfg.Environment.ShowSql, true.ToString());
                    cfg.SetProperty(NHibernate.Cfg.Environment.Hbm2ddlAuto, "update");
                    cfg.SetProperty(NHibernate.Cfg.Environment.UseProxyValidator, false.ToString());
                }
                                                         )
                                    .BuildConfiguration();

                BuildEnversConfiguration(configuration);

                _sessionFactory = configuration.BuildSessionFactory();

                var schemaUpdate = new SchemaUpdate(configuration);
                schemaUpdate.Execute(true, true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #27
0
        /// <summary>
        /// Build NHibernate session. The connection with the database. 
        /// </summary>
        /// <param name="company">the tenancy company with that all queryes in the system will 
        /// be eexecuted with this company.</param>
        /// <param name="connectionString">The connection string that want to be used.</param>
        public void BuildSession(Guid company, String connectionString)
        {
            try
            {
                this.Company = company;

                var configuration = Fluently
                    .Configure()
                    //.Database(MySQLConfiguration.Standard.ConnectionString(connectionString).ShowSql())
                    .Database(MsSqlConfiguration.MsSql2008.ConnectionString(connectionString).ShowSql())
                    //SQLiteConfiguration.Standard.UsingFile("Teste.db"))
                    //MySQLConfiguration.Standard.ConnectionString(connectionString))
                    .Mappings(x => x.FluentMappings.AddFromAssemblyOf<AddressMap>()
                        .Conventions
                            .AddFromAssemblyOf<TableNameConvention>())
                    .ExposeConfiguration(cfg =>
                        {
                            cfg.SetProperty(NHibernate.Cfg.Environment.ShowSql, true.ToString());
                            cfg.SetProperty(NHibernate.Cfg.Environment.Hbm2ddlAuto, "update");
                            cfg.SetProperty(NHibernate.Cfg.Environment.UseProxyValidator, false.ToString());
                        }
                    )
                    .BuildConfiguration();

                BuildEnversConfiguration(configuration);

                _sessionFactory = configuration.BuildSessionFactory();

                var schemaUpdate = new SchemaUpdate(configuration);
                schemaUpdate.Execute(true, true);
            }
            catch (Exception)
            {
                throw;
            }
        }
 public DiningTableRepository(IRestaurantSessionFactory sessionFactory)
 {
     _sessionFactory = sessionFactory.CreateSessionFactory();
 }
Пример #29
0
 public HireRepository(IEquipRentSessionFactory sessionFactory)
 {
     _sessionFactory = sessionFactory.CreateSessionFactory();
 }
Пример #30
0
 public UnitOfWork(NHibernate.ISessionFactory sessionFactory)
 {
     this.sessionFactory = sessionFactory;
 }
 public StudentController(NHibernate.ISessionFactory sessionFactory)
 {
     // TODO: Complete member initialization
     this.sessionFactory = sessionFactory;
     studentDao = new StudentDao(sessionFactory);
 }
Пример #32
0
 public NHibernateSessionProvider(ISessionFactory sessionFactory)
 {
     this.sessionFactory = sessionFactory;
 }
Пример #33
0
 public NHTransactionFactory(NH.ISessionFactory sessionFactory)
 {
     _sessionFactory = sessionFactory;
 }
Пример #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SessionFactoryAdapter"/> class.
 /// </summary>
 /// <param name="sessionFactory">Session factory.</param>
 /// <param name="allowTransactionNesting">Specifies whether or not transaction-nesting is permitted or not.</param>
 /// <param name="reuseExistingSessionWhereAvailable">Specifies whether or not an existing session will be re-used if it exists.</param>
 public SessionFactoryAdapter(Nh.ISessionFactory sessionFactory,
                              bool allowTransactionNesting            = false,
                              bool reuseExistingSessionWhereAvailable = false) : base(sessionFactory, allowTransactionNesting, reuseExistingSessionWhereAvailable)
 {
 }
Пример #35
0
 public SessionFactory()
 {
     var configuration = GetConfiguration();
     sessionFactory = configuration.BuildSessionFactory();
 }
Пример #36
0
 /// <summary>
 /// Creates a new instance of NhUnitOfWork.
 /// </summary>
 /// <param name="sessionFactory"></param>
 public UnitOfWork(CoreNhibernate.ISessionFactory sessionFactory)
 {
     _sessionFactory = sessionFactory;
 }
Пример #37
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="subject">File serialiser</param>
 public Repository(
     NHibernate.ISessionFactory subject)
 {
     this.c_sessionFactory = subject;
 }
 public NHibernateSessionProvider(ISessionFactory sessionFactory)
 {
     this.sessionFactory = sessionFactory;
 }
 public TeacherController(NHibernate.ISessionFactory sessionFactory)
 {
     // TODO: Complete member initialization
     this.sessionFactory = sessionFactory;
 }
Пример #40
0
 public ProductRepository(NHibernate.ISessionFactory northwind)
 {
     _northwind = northwind;
 }
Пример #41
0
 public UnitOfWork(NHibernate.ISessionFactory sessionFactory)
 {
     _sessionFactory = sessionFactory;
     Session = _sessionFactory.OpenSession();
     _transaction = Session.BeginTransaction();
 }