当前位置: 首页>>代码示例>>C#>>正文


C# ISessionFactory类代码示例

本文整理汇总了C#中ISessionFactory的典型用法代码示例。如果您正苦于以下问题:C# ISessionFactory类的具体用法?C# ISessionFactory怎么用?C# ISessionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ISessionFactory类属于命名空间,在下文中一共展示了ISessionFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsDynamicComponentDictionaryGetter

		public static bool IsDynamicComponentDictionaryGetter(MethodInfo method, Expression targetObject, IEnumerable<Expression> arguments, ISessionFactory sessionFactory, out string memberName)
		{
			memberName = null;

			// A dynamic component must be an IDictionary with a string key.

			if (method.Name != "get_Item" || !typeof(IDictionary).IsAssignableFrom(targetObject.Type))
				return false;

			var key = arguments.First() as ConstantExpression;
			if (key == null || key.Type != typeof(string))
				return false;

			// The potential member name
			memberName = (string)key.Value;

			// Need the owning member (the dictionary).
			var member = targetObject as MemberExpression;
			if (member == null)
				return false;

			var metaData = sessionFactory.GetClassMetadata(member.Expression.Type);
			if (metaData == null)
				return false;

			// IDictionary can be mapped as collection or component - is it mapped as a component?
			var propertyType = metaData.GetPropertyType(member.Member.Name);
			return (propertyType != null && propertyType.IsComponentType);
		}
开发者ID:snbbgyth,项目名称:WorkFlowEngine,代码行数:29,代码来源:VisitorUtil.cs

示例2: VartotojaiController

 public VartotojaiController(IAuthenticationProvider authenticationProvider, ISessionFactory sessionFactory, [LoggedIn] UserInformation loggedInUser, HashAlgorithm hashAlgorithm)
 {
     _authenticationProvider = authenticationProvider;
     _sessionFactory = sessionFactory;
     _loggedInUser = loggedInUser;
     _hashAlgorithm = hashAlgorithm;
 }
开发者ID:zaLTys,项目名称:osfi,代码行数:7,代码来源:VartotojaiController.cs

示例3: ActionTransactionHelper

 public ActionTransactionHelper(
     ISessionFactory sessionFactory,
     ICurrentSessionContextAdapter currentSessionContextAdapter)
 {
     _sessionFactory = sessionFactory;
     _currentSessionContextAdapter = currentSessionContextAdapter;
 }
开发者ID:kanayabhattad,项目名称:EventKarma,代码行数:7,代码来源:ActionTransactionHelper.cs

示例4: UseNHibernate

        public static void UseNHibernate(this AppConfigurator configurator, ISessionFactory sessionFactory)
        {
            var runtime = configurator.AppRuntime;

            runtime.Container.Register<IDomainDbSession>(_ => new NhDomainDbSession(sessionFactory.OpenSession()));
            runtime.Container.Register<IDomainRepository>(_ => new NhDomainRepository(_.Resolve<IDomainDbSession>(), _.Resolve<IRelayWorker>()));
        }
开发者ID:mouhong,项目名称:Taro,代码行数:7,代码来源:NHibernateConfiguration.cs

示例5: Update

		public static void Update(ISessionFactory sessionFactory)
		{
			var factory = (ISessionFactoryImplementor) sessionFactory;
			var dialect = factory.Dialect;
			var connectionHelper = new SuppliedConnectionProviderConnectionHelper(factory.ConnectionProvider);
			factory.Dialect.Keywords.AddAll(GetReservedWords(dialect, connectionHelper));
		}
开发者ID:jaundice,项目名称:nhibernate-core,代码行数:7,代码来源:SchemaMetadataUpdater.cs

示例6: Init

 private static void Init()
 {
     nhConfiguration = new Configuration();
     //nhConfiguration.Configure("NhibernateUtils/NHibernate.cfg.xml");
     nhConfiguration.AddAssembly("Activos");
     sessionFactory = nhConfiguration.BuildSessionFactory();
 }
开发者ID:kelvin088,项目名称:Activos,代码行数:7,代码来源:NHConnection.cs

示例7: DestroySagaPersisterContext

 public void DestroySagaPersisterContext()
 {
     SagaPersister = null;
     SessionFactory.Dispose();
     SessionFactory = null;
     DeleteFile();
 }
开发者ID:jhicks,项目名称:NServiceBus.Db4o,代码行数:7,代码来源:Db4oSagaPersisterTestFixture.cs

示例8: Open

        public ISession Open()
        {
            if(_sessionFactory == null)
                _sessionFactory = configureSessionFactory();

            return _sessionFactory.OpenSession();
        }
开发者ID:joeyshipley,项目名称:TestingPractices,代码行数:7,代码来源:SessionProvider.cs

示例9: ExampleFactoryManager

		public ExampleFactoryManager(string configSectionName = "ExampleDatabaseConnectionSettings")
		{
			var configuration = Fluently.Configure();
			configuration.InitializeFromConfigMsSql(configSectionName);
			configuration.AddMappingsFromAssemblyOf<UserMap>();
			_instance = configuration.BuildSessionFactory();
		}
开发者ID:fr4gles,项目名称:Simplify,代码行数:7,代码来源:ExampleFactoryManager.cs

示例10: TestClassSetup

 public static void TestClassSetup(TestContext context)
 {
     _configuration = new Configuration();
     _configuration.Configure();
     _configuration.AddAssembly(typeof(Draft).Assembly);
     _sessionFactory = _configuration.BuildSessionFactory();
 }
开发者ID:Snidd,项目名称:RotisserieDraft,代码行数:7,代码来源:TestMemberRepository.cs

示例11: Setup

        public void Setup()
        {
            Configure.ConfigurationSource = new DefaultConfigurationSource();

            NHibernateSettingRetriever.AppSettings = () => new NameValueCollection
                                                               {
                                                                   {"NServiceBus/Persistence/NHibernate/dialect", dialect}
                                                               };

            NHibernateSettingRetriever.ConnectionStrings = () => new ConnectionStringSettingsCollection
                                                                     {
                                                                         new ConnectionStringSettings("NServiceBus/Persistence/NHibernate/Timeout", connectionString)
                                                                     };

            ConfigureNHibernate.Init();

            Configure.With(Enumerable.Empty<Type>())
                .DefineEndpointName("Foo")
                .DefaultBuilder()
                .UseNHibernateTimeoutPersister();

            persister = Configure.Instance.Builder.Build<TimeoutStorage>();
            sessionFactory = persister.SessionFactory;

            new Installer.Installer().Install(WindowsIdentity.GetCurrent().Name);
        }
开发者ID:ranji,项目名称:NServiceBus,代码行数:26,代码来源:InMemoryDBFixture.cs

示例12: CreateSessionFactory

        private static void CreateSessionFactory()
        {
            // FluentNHibernate.Search Configuration
            Configuration fnhscfg = FluentSearch.Configure()
                .DefaultAnalyzer().Standard()
                .DirectoryProvider().RAMDirectory()
                .IndexingStrategy().Event()
                .Listeners(ListenerConfiguration.Default)
                .MappingClass<SearchMap>()
                .BuildConfiguration();

            // FluentNHibernate Configuration
            Configuration fnhcfg = Fluently.Configure(fnhscfg)
                    .Database(SQLiteConfiguration.Standard.InMemory()
                    .Dialect<SQLiteDialect>()
                    .ConnectionString(ConnectionString)
                    .ProxyFactoryFactory<ProxyFactoryFactory>())
                .Mappings(m => m.FluentMappings.AddFromAssemblyOf<AuthorMap>())
                .ExposeConfiguration(cfg =>
                                         {
                                             cfg.SetListeners(ListenerType.PostInsert, new[] { new FullTextIndexEventListener() });
                                             cfg.SetListeners(ListenerType.PostUpdate, new[] { new FullTextIndexEventListener() });
                                             cfg.SetListeners(ListenerType.PostDelete, new[] { new FullTextIndexEventListener() });

                                             cfg.SetListener(ListenerType.PostCollectionRecreate, new FullTextIndexCollectionEventListener());
                                             cfg.SetListener(ListenerType.PostCollectionRemove, new FullTextIndexCollectionEventListener());
                                             cfg.SetListener(ListenerType.PostCollectionUpdate, new FullTextIndexCollectionEventListener());
                                         })
                .BuildConfiguration();

            _cfg = fnhcfg;
            _sessionFactory = _cfg.BuildSessionFactory();
        }
开发者ID:jaredmahan,项目名称:Fluent-NHibernate-Search,代码行数:33,代码来源:SessionFactory.cs

示例13: Initialize

		/// <summary>
		/// Called by the framework to initialize the persistent store.
		/// </summary>
		public void Initialize()
		{
			Platform.Log(LogLevel.Info, "Initializing NHibernate subsystem...");

			// create the hibernate configuration
			_cfg = new Configuration();

			// this will automatically read from the app.config
			_cfg.Configure();

			Platform.Log(LogLevel.Debug, "NHibernate connection string: {0}", this.ConnectionString);

			// add each assembly to the hibernate configuration
			// this tells NHibernate to look for .hbm.xml embedded resources in these assemblies
			// TODO: we should only scan plugins that are tied to this PersistentStore, but there is currently no way to know this
			var orderer = new AssembliesHbmOrderer(Platform.PluginManager.Plugins);
			orderer.AddToConfiguration(_cfg);

			// setup default caching strategies for all classes/collections that don't have one explicitly
			// specified in the mapping files
			CreateDefaultCacheStrategies();

			// create the session factory
			_sessionFactory = _cfg.BuildSessionFactory();

			Platform.Log(LogLevel.Info, "NHibernate initialization complete.");
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:30,代码来源:PersistentStore.cs

示例14: Init

		private static void Init()
		{
			var config = new Configuration();
			config.Configure();
			config.AddAssembly(Assembly.GetCallingAssembly());
			_sessionFactory = config.BuildSessionFactory();
		}
开发者ID:AdamPrendergast,项目名称:Squarker_ASP.NET_MVC,代码行数:7,代码来源:DatabaseManager.cs

示例15: OpenSession

        public static ISession OpenSession()
        {
            if (sessionFactory == null)
            {
                System.Collections.Specialized.NameValueCollection sets = System.Configuration.ConfigurationManager.AppSettings;

                //获取连接字符串
                string server = Utilities.GetConfigValue("server");
                string pwd = VTMS.Common.Utilities.Base64Dencrypt(Utilities.GetConfigValue("DBPassword"));
                string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
                connectionString = string.Format(connectionString, server, pwd);

                try
                {
                    Configuration cfg = new Configuration().Configure();
                    cfg.Proxy(p => p.ProxyFactoryFactory<NHibernate.Bytecode.DefaultProxyFactoryFactory>());
                    cfg.DataBaseIntegration(db =>
                    {
                        db.ConnectionString = connectionString;
                    });

                    sessionFactory = cfg.BuildSessionFactory();
                }
                catch (Exception e)
                {
                    VTMS.Common.MessageUtil.ShowError("无法登陆服务器,请检查服务器IP设置是否正确,错误信息为:" + e.Message);
                }
            }
            return sessionFactory.OpenSession();
        }
开发者ID:jilichao,项目名称:vtms,代码行数:30,代码来源:SessionFactory.cs


注:本文中的ISessionFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。