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


C# Configuration.SetNamingStrategy方法代碼示例

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


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

示例1: main

		public static void main(String[] args)
		{
			try
			{
				Configuration cfg = new Configuration();

				bool script = true;
				// If true then execute db updates, otherwise just generate and display updates
				bool doUpdate = true;
				//String propFile = null;

				for (int i = 0; i < args.Length; i++)
				{
					if (args[i].StartsWith("--"))
					{
						if (args[i].Equals("--quiet"))
						{
							script = false;
						}
						else if (args[i].StartsWith("--properties="))
						{
							throw new NotSupportedException("No properties file for .NET, use app.config instead");
							//propFile = args[i].Substring( 13 );
						}
						else if (args[i].StartsWith("--config="))
						{
							cfg.Configure(args[i].Substring(9));
						}
						else if (args[i].StartsWith("--text"))
						{
							doUpdate = false;
						}
						else if (args[i].StartsWith("--naming="))
						{
							cfg.SetNamingStrategy(
								(INamingStrategy) Activator.CreateInstance(ReflectHelper.ClassForName(args[i].Substring(9)))
								);
						}
					}
					else
					{
						cfg.AddFile(args[i]);
					}
				}

				/* NH: No props file for .NET
				 * if ( propFile != null ) {
					Hashtable props = new Hashtable();
					props.putAll( cfg.Properties );
					props.load( new FileInputStream( propFile ) );
					cfg.SetProperties( props );
				}*/

				new SchemaUpdate(cfg).Execute(script, doUpdate);
			}
			catch (Exception e)
			{
				log.Error("Error running schema update", e);
				Console.WriteLine(e);
			}
		}
開發者ID:pallmall,項目名稱:WCell,代碼行數:61,代碼來源:SchemaUpdate.cs

示例2: Main

		public static void Main(string[] args)
		{
			try
			{
				var cfg = new Configuration();

				//string propFile = null;

				for (int i = 0; i < args.Length; i++)
				{
					if (args[i].StartsWith("--"))
					{
						//if (args[i].StartsWith("--properties="))
						//{
						//  propFile = args[i].Substring(13);
						//}
						//else 
						if (args[i].StartsWith("--config="))
						{
							cfg.Configure(args[i].Substring(9));
						}
						else if (args[i].StartsWith("--naming="))
						{
							cfg.SetNamingStrategy(
								(INamingStrategy)
								Cfg.Environment.BytecodeProvider.ObjectsFactory.CreateInstance(ReflectHelper.ClassForName(args[i].Substring(9))));
						}
					}
					else
					{
						cfg.AddFile(args[i]);
					}
				}
				/* NH: No props file for .NET
				if ( propFile != null ) {
					Properties props = new Properties();
					props.putAll( cfg.getProperties() );
					props.load( new FileInputStream( propFile ) );
					cfg.setProperties( props );
				}
				*/
				new SchemaValidator(cfg).Validate();
			}
			catch (Exception e)
			{
				log.Error("Error running schema update", e);
				Console.WriteLine(e);
			}
		}
開發者ID:renefc3,項目名稱:nhibernate,代碼行數:49,代碼來源:SchemaValidator.cs

示例3: EasyWorshipReader

        public EasyWorshipReader(string easyWorshipSongPath)
        {
            var initialConfiguration = new Configuration();
            initialConfiguration.SetNamingStrategy(new ParadoxNamingStrategy());

            var fluentConfiguration =
                Fluently.Configure(initialConfiguration)
                    .Database(JetDriverConfiguration.Standard.ConnectionString(
                        $"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={easyWorshipSongPath};Extended Properties=\"Paradox 5.x;CharacterSet=65001;\"")
                        .Dialect<JetDialect>()
                        .Driver<OleDbDriver>())
                    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<MainForm>());

            _sessionSource = new SessionSource(fluentConfiguration);
        }
開發者ID:dabide,項目名稱:SongConvert,代碼行數:15,代碼來源:EasyWorshipReader.cs

示例4: BuildConfiguration

        public Configuration BuildConfiguration()
        {
            var mapper = new ConventionModelMapper();

            CollectMappingContributorsAndApply(mapper);

            AR.RaiseOnMapperCreated(mapper, this);

            var mapping = mapper.CompileMappingForAllExplicitlyAddedEntities();
            mapping.autoimport = Source.AutoImport;
            mapping.defaultlazy = Source.Lazy;

            if (Source.Debug) {
                try {
                    File.WriteAllText(
                        Path.Combine(
                            AppDomain.CurrentDomain.BaseDirectory,
                            Name + "mapping.hbm.xml"

                        ), mapping.AsString()
                    );
                } catch { /* just bail out */ }
            }

            AR.RaiseOnHbmMappingCreated(mapping, this);

            var cfg = new Configuration();

            if (Source.NamingStrategyImplementation != null)
                cfg.SetNamingStrategy((INamingStrategy) Activator.CreateInstance(Source.NamingStrategyImplementation));

            foreach(var key in Properties.AllKeys)
            {
                cfg.Properties[key] = Properties[key];
            }

            CollectAllContributorsAndRegister(cfg);

            cfg.AddMapping(mapping);

            AR.RaiseOnConfigurationCreated(cfg, this);

            return cfg;
        }
開發者ID:shosca,項目名稱:ActiveRecord,代碼行數:44,代碼來源:SessionFactoryConfig.cs


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