本文整理汇总了C#中NHibernate.Cfg.Configuration.AddDocument方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.AddDocument方法的具体用法?C# Configuration.AddDocument怎么用?C# Configuration.AddDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Cfg.Configuration
的用法示例。
在下文中一共展示了Configuration.AddDocument方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddMappings
protected override void AddMappings(Configuration configuration)
{
var xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><hibernate-mapping xmlns=\"urn:nhibernate-mapping-2.2\" namespace=\"NHibernate.Test.VersionTest.Db\" assembly=\"NHibernate.Test\"><class name=\"ProductWithVersionAndLazyProperty\"><id name=\"Id\" generator=\"assigned\"/><version name=\"Version\" generated=\"always\" unsaved-value=\"null\" type=\"BinaryBlob\" access=\"nosetter.camelcase-underscore\"><column name=\"version\" not-null=\"false\" sql-type=\"timestamp\" /></version><property name=\"Summary\" lazy=\"true\"/></class></hibernate-mapping>";
var doc = new XmlDocument();
doc.LoadXml(xml);
configuration.AddDocument(doc);
base.AddMappings(configuration);
configuration.SetProperty(NHibernate.Cfg.Environment.Hbm2ddlAuto, SchemaAutoAction.Recreate.ToString());
configuration.SetProperty(NHibernate.Cfg.Environment.FormatSql, Boolean.TrueString);
configuration.SetProperty(NHibernate.Cfg.Environment.ShowSql, Boolean.TrueString);
}
示例2: AddDocument
public void AddDocument()
{
string hbm = @"<?xml version='1.0' ?>
<hibernate-mapping xmlns='urn:nhibernate-mapping-2.0'>
<class name='NHibernate.DomainModel.A, NHibernate.DomainModel'>
<id name='Id' column='somecolumn'>
<generator class='native' />
</id>
</class>
</hibernate-mapping>";
Configuration cfg = new Configuration();
XmlDocument doc = new XmlDocument();
doc.LoadXml( hbm );
cfg.AddDocument( doc );
}
示例3: Configure
public virtual void Configure(Configuration cfg)
{
EnsureMappingsBuilt();
foreach (var mapping in compiledMappings)
{
var serializer = new MappingXmlSerializer();
XmlDocument document = serializer.Serialize(mapping);
if (cfg.GetClassMapping(mapping.Classes.First().Type) == null)
cfg.AddDocument(document);
}
}
示例4: Configure
public void Configure(Configuration cfg)
{
var rootMapping = BuildHibernateMapping();
ApplyVisitors(rootMapping);
var serializer = new MappingXmlSerializer();
XmlDocument document = serializer.Serialize(rootMapping);
cfg.AddDocument(document);
}