當前位置: 首頁>>代碼示例>>C#>>正文


C# Configuration.LinqToHqlGeneratorsRegistry方法代碼示例

本文整理匯總了C#中NHibernate.Cfg.Configuration.LinqToHqlGeneratorsRegistry方法的典型用法代碼示例。如果您正苦於以下問題:C# Configuration.LinqToHqlGeneratorsRegistry方法的具體用法?C# Configuration.LinqToHqlGeneratorsRegistry怎麽用?C# Configuration.LinqToHqlGeneratorsRegistry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NHibernate.Cfg.Configuration的用法示例。


在下文中一共展示了Configuration.LinqToHqlGeneratorsRegistry方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Initialize

        public static void Initialize()
        {
            if (configuration != null)
                throw new InvalidOperationException(Resources.YouCanCallConfigurationManagerInitializeOnlyOnce);

            try
            {
                _configMutex.WaitOne();

                configuration = new Configuration();
                configuration.LinqToHqlGeneratorsRegistry<ExtendedLinqtoHqlGeneratorsRegistry>();

                if (PreCustomConfiguration != null)
                    PreCustomConfiguration(configuration);

                configuration = Fluently.Configure(configuration)
                        .Mappings(m =>
                        {
                            m.FluentMappings
                                .Conventions.Setup(s => s.Add(AutoImport.Never()))
                                .AddFromAssembly(AssemblyToConfigure);
                            m.HbmMappings
                                .AddFromAssembly(AssemblyToConfigure);
                        }).BuildConfiguration();

                if (PosCustomConfiguration != null)
                    PosCustomConfiguration(configuration);
            }
            finally
            {
                _configMutex.ReleaseMutex();
            }
        }
開發者ID:tiagomaximo,項目名稱:LiteFx,代碼行數:33,代碼來源:ConfigurationManager.cs

示例2: RegisterHierarchySupport

        public static void RegisterHierarchySupport(Configuration cfg)
        {
            if (!_criterionRegistered)
            {
                lock (LockObject)
                {
                    if (!_criterionRegistered)
                    {
                        RegisterCriterionSupport();
                        _criterionRegistered = true;
                    }
                }
            }

            #region HQL
            // hid.ToString()
            cfg.SqlFunctions.Add("to_string", new SQLFunctionTemplate(NHibernateUtil.String, "?1.ToString()"));            

            // hid.IsDescendantOf(parent) = 1
            cfg.SqlFunctions.Add("hid_IsDescendantOf", new SQLFunctionTemplate(NHibernateUtil.Boolean, "?1.IsDescendantOf(?2) = 1"));

            // hid.GetAncestor(level)
            cfg.SqlFunctions.Add("hid_GetAncestor", new SQLFunctionTemplate(NHibernateUtil.String, "?1.GetAncestor(?2)"));

            // hid.GetDescendant(child1, child2)
            cfg.SqlFunctions.Add("hid_GetDescendant", new SQLFunctionTemplate(NHibernateUtil.String, "?1.GetDescendant(?2, ?3)"));

            // hid.GetLevel()
            cfg.SqlFunctions.Add("hid_GetLevel", new SQLFunctionTemplate(NHibernateUtil.Int32, "?1.GetLevel()"));

            // hid.GetReparentedValue(old, new)
            cfg.SqlFunctions.Add("hid_GetReparentedValue", new SQLFunctionTemplate(NHibernateUtil.String, "?1.GetReparentedValue(?2, ?3)"));            

            // hierarchyid::Parse
            cfg.SqlFunctions.Add("hid_Parse", new SQLFunctionTemplate(NHibernateUtil.String, "hierarchyid::Parse(?1)"));
            #endregion

            cfg.LinqToHqlGeneratorsRegistry<HierarchyHqlGeneratorRegistry>();            
        }        
開發者ID:zoldello,項目名稱:NHibernate.HierarchyId,代碼行數:39,代碼來源:HierarchyIdExtensions.cs

示例3: ExtendConfiguration

 public void ExtendConfiguration(Configuration configuration)
 {
     configuration.LinqToHqlGeneratorsRegistry<MyLinqToHqlGeneratorsRegistry>();
 }
開發者ID:koav,項目名稱:Rhetos,代碼行數:4,代碼來源:CommonConceptsNHibernateConfigurationExtension.cs

示例4: Configure

 public static void Configure()
 {
     NHConguration = new Configuration().Configure();
     NHConguration.CurrentSessionContext<WcfOperationSessionContext>();
     NHConguration.LinqToHqlGeneratorsRegistry<NHibernateLinqToHqlGeneratorsRegistry>();
     sessionFactory = NHConguration.BuildSessionFactory();
 }
開發者ID:dalinhuang,項目名稱:cndreams,代碼行數:7,代碼來源:NHibernateHelper.cs

示例5: FullConfiguration

		public void FullConfiguration()
		{
			var configure = new Configuration();
			configure.SessionFactoryName("SomeName");
			configure.Cache(c =>
												{
													c.UseMinimalPuts = true;
													c.DefaultExpiration = 15;
													c.RegionsPrefix = "xyz";
													c.Provider<HashtableCacheProvider>();
													c.QueryCache<StandardQueryCache>();
												});
			configure.CollectionTypeFactory<DefaultCollectionTypeFactory>();
			configure.HqlQueryTranslator<ClassicQueryTranslatorFactory>();
			configure.LinqToHqlGeneratorsRegistry<DefaultLinqToHqlGeneratorsRegistry>();
			configure.Proxy(p =>
												{
													p.Validation = false;
													p.ProxyFactoryFactory<DefaultProxyFactoryFactory>();
												});
			configure.Mappings(m=>
			                   	{
			                   		m.DefaultCatalog = "MyCatalog";
			                   		m.DefaultSchema = "MySche";
			                   	});
			configure.DataBaseIntegration(db =>
			                              	{
			                              		db.Dialect<MsSql2000Dialect>();
			                              		db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote;
			                              		db.Batcher<SqlClientBatchingBatcherFactory>();
			                              		db.BatchSize = 15;
			                              		db.ConnectionProvider<DebugConnectionProvider>();
			                              		db.Driver<SqlClientDriver>();
			                              		db.ConnectionReleaseMode = ConnectionReleaseMode.AfterTransaction;
			                              		db.IsolationLevel = IsolationLevel.ReadCommitted;
			                              		db.ConnectionString = "The connection string";
			                              		db.AutoCommentSql = true;
			                              		db.ExceptionConverter<SQLStateConverter>();
			                              		db.PrepareCommands = true;
			                              		db.Timeout = 10;
			                              		db.MaximumDepthOfOuterJoinFetching = 11;
			                              		db.HqlToSqlSubstitutions = "true 1, false 0, yes 'Y', no 'N'";
			                              		db.SchemaAction = SchemaAutoAction.Validate;
			                              	});

			Assert.That(configure.Properties[Environment.SessionFactoryName], Is.EqualTo("SomeName"));
			Assert.That(configure.Properties[Environment.CacheProvider],
									Is.EqualTo(typeof(HashtableCacheProvider).AssemblyQualifiedName));
			Assert.That(configure.Properties[Environment.CacheRegionPrefix], Is.EqualTo("xyz"));
			Assert.That(configure.Properties[Environment.QueryCacheFactory],
									Is.EqualTo(typeof(StandardQueryCache).AssemblyQualifiedName));
			Assert.That(configure.Properties[Environment.UseMinimalPuts], Is.EqualTo("true"));
			Assert.That(configure.Properties[Environment.CacheDefaultExpiration], Is.EqualTo("15"));
			Assert.That(configure.Properties[Environment.CollectionTypeFactoryClass],
									Is.EqualTo(typeof(DefaultCollectionTypeFactory).AssemblyQualifiedName));
			Assert.That(configure.Properties[Environment.UseProxyValidator], Is.EqualTo("false"));
			Assert.That(configure.Properties[Environment.ProxyFactoryFactoryClass],
						Is.EqualTo(typeof(DefaultProxyFactoryFactory).AssemblyQualifiedName));
			Assert.That(configure.Properties[Environment.QueryTranslator],
						Is.EqualTo(typeof(ClassicQueryTranslatorFactory).AssemblyQualifiedName));
			Assert.That(configure.Properties[Environment.DefaultCatalog], Is.EqualTo("MyCatalog"));
			Assert.That(configure.Properties[Environment.DefaultSchema], Is.EqualTo("MySche"));
			Assert.That(configure.Properties[Environment.Dialect],
						Is.EqualTo(typeof(MsSql2000Dialect).AssemblyQualifiedName));
			Assert.That(configure.Properties[Environment.Hbm2ddlKeyWords], Is.EqualTo("auto-quote"));
			Assert.That(configure.Properties[Environment.BatchStrategy],
						Is.EqualTo(typeof(SqlClientBatchingBatcherFactory).AssemblyQualifiedName));
			Assert.That(configure.Properties[Environment.BatchSize], Is.EqualTo("15"));
			Assert.That(configure.Properties[Environment.ConnectionProvider],
						Is.EqualTo(typeof(DebugConnectionProvider).AssemblyQualifiedName));
			Assert.That(configure.Properties[Environment.ConnectionDriver],
						Is.EqualTo(typeof(SqlClientDriver).AssemblyQualifiedName));
			Assert.That(configure.Properties[Environment.ReleaseConnections],
									Is.EqualTo(ConnectionReleaseModeParser.ToString(ConnectionReleaseMode.AfterTransaction)));
			Assert.That(configure.Properties[Environment.Isolation], Is.EqualTo("ReadCommitted"));
			Assert.That(configure.Properties[Environment.ConnectionString], Is.EqualTo("The connection string"));
			Assert.That(configure.Properties[Environment.UseSqlComments], Is.EqualTo("true"));
			Assert.That(configure.Properties[Environment.SqlExceptionConverter],
									Is.EqualTo(typeof(SQLStateConverter).AssemblyQualifiedName));
			Assert.That(configure.Properties[Environment.PrepareSql], Is.EqualTo("true"));
			Assert.That(configure.Properties[Environment.CommandTimeout], Is.EqualTo("10"));
			Assert.That(configure.Properties[Environment.MaxFetchDepth], Is.EqualTo("11"));
			Assert.That(configure.Properties[Environment.QuerySubstitutions], Is.EqualTo("true 1, false 0, yes 'Y', no 'N'"));
			Assert.That(configure.Properties[Environment.Hbm2ddlAuto], Is.EqualTo("validate"));
			configure.Properties[Environment.LinqToHqlGeneratorsRegistry].Should().Be(typeof(DefaultLinqToHqlGeneratorsRegistry).AssemblyQualifiedName);
		}
開發者ID:Ruhollah,項目名稱:nhibernate-core,代碼行數:86,代碼來源:LambdaConfigurationFixture.cs

示例6: Configure

		protected override void Configure(Configuration configuration)
		{
			configuration.LinqToHqlGeneratorsRegistry<MyLinqToHqlGeneratorsRegistry>();
			base.Configure(configuration);
		}
開發者ID:marchlud,項目名稱:nhibernate-core,代碼行數:5,代碼來源:Fixture.cs

示例7: BuildSchema

        protected virtual void BuildSchema(Configuration config, bool blowDbAway, bool showSql, string schemaExportLocation, ISessionEventSubscriber sessionEventSubscriber, Action<Configuration> nhibConfigCallback)
        {

            config.LinqToHqlGeneratorsRegistry<NhibExtensionsRegistry>();
            if (sessionEventSubscriber != null && sessionEventSubscriber.GetType() != typeof(NoOpSessionEventSubscriber))
            {
                config.Interceptor = new SessionEventPublishingInterceptor(sessionEventSubscriber);
            }
            else
            {
                if (showSql) config.Interceptor = new LoggingInterceptor();
            }

            if (nhibConfigCallback != null)
            {
                nhibConfigCallback.Invoke(config);
            }

            if (!blowDbAway) return;
            var schemaExport = new SchemaExport(config);
            if (!string.IsNullOrEmpty(schemaExportLocation))
                schemaExport.SetOutputFile(schemaExportLocation);

            schemaExport.Execute(!string.IsNullOrEmpty(schemaExportLocation), true, false);

        }
開發者ID:benjaminkeeping,項目名稱:agilex.persistence,代碼行數:26,代碼來源:NhibernateConfiguration.cs


注:本文中的NHibernate.Cfg.Configuration.LinqToHqlGeneratorsRegistry方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。