本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
示例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;
}