当前位置: 首页>>代码示例>>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;未经允许,请勿转载。