当前位置: 首页>>代码示例>>C#>>正文


C# Configuration.AddXml方法代码示例

本文整理汇总了C#中NHibernate.Cfg.Configuration.AddXml方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.AddXml方法的具体用法?C# Configuration.AddXml怎么用?C# Configuration.AddXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NHibernate.Cfg.Configuration的用法示例。


在下文中一共展示了Configuration.AddXml方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyConfiguration

 /// <summary>
 /// Adds mappings for this model to a NHibernate configuration object.
 /// </summary>
 /// <param name="configuration">A NHibernate configuration object to which to add mappings for this model.</param>
 public static void ApplyConfiguration(Configuration configuration)
 {
     configuration.AddXml(Libro.MappingXml.ToString());
       configuration.AddXml(Resenha.MappingXml.ToString());
       configuration.AddXml(Autor.MappingXml.ToString());
       configuration.AddAssembly(typeof(ConfigurationHelper).Assembly);
 }
开发者ID:Maharba,项目名称:LittleBooks,代码行数:11,代码来源:Libros.cs

示例2: SetupContext

 public void SetupContext()
 {
     // Setup "old" database schema
     _cfg = new Configuration();
     _cfg.Configure();
     _cfg.AddXml(product_xml);
     _cfg.AddXml(category_xml);
     var export = new SchemaExport(_cfg);
     export.Execute(false, true, false, false);
 }
开发者ID:tasluk,项目名称:hibernatingrhinos,代码行数:10,代码来源:UpdateSchema_Fixture.cs

示例3: TestAccount

 public static Boolean TestAccount(DatabaseAccountToken token, Boolean testMapping = false)
 {
     try
     {
         Configuration configuration = new Configuration();
         configuration.SetProperty(NHibernate.Cfg.Environment.ConnectionString, token.ConnectionString);
         configuration.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, String.Format("NHibernate.Driver.{0}", token.DatabaseDriver));
         configuration.SetProperty(NHibernate.Cfg.Environment.Dialect, String.Format("NHibernate.Dialect.{0}", token.DatabaseDialect));
         if (testMapping)
         {
             configuration.AddXml(token.Mapping);
             using (ISessionFactory sessionFactory = configuration.BuildSessionFactory())
             {
                 using (ISession session = sessionFactory.OpenSession())
                 {
                     return session.IsConnected;
                 }
             }
         }
         else
         {
             using (ISessionFactory sessionFactory = configuration.BuildSessionFactory())
             {
                 using (ISession session = sessionFactory.OpenSession())
                 {
                     return session.IsConnected;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         return false;
     }
 }
开发者ID:espressomorte,项目名称:Supakull,代码行数:35,代码来源:ClientNHibernateSessionFactory.cs

示例4: Configure

		protected override void Configure(Configuration configuration)
		{
			if (Dialect.Functions.ContainsKey("year"))
			{
				using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NHibernate.Test.Component.Basic.User.hbm.xml"))
				{
					using (StreamReader reader = new StreamReader(stream))
					{
						string mapping = reader.ReadToEnd();

						IList args = new ArrayList();
						args.Add("dob");
						// We don't have a session factory yet... is there some way to get one sooner?
						string replacement = Dialect.Functions["year"].Render(args, null).ToString().Replace("\"", "&quot;");
						mapping = mapping.Replace("year(dob)", replacement);

						configuration.AddXml(mapping);
						configuration.SetProperty(Cfg.Environment.GenerateStatistics, "true");
					}
				}
			}
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:22,代码来源:ComponentTest.cs

示例5: Add

        public void Add(DatabaseAccountToken configFile)
        {
            try
            {
                if (sesionFactoryDictionary.ContainsKey(configFile.TokenId))
                {
                    return;
                }
                else
                {
                    Configuration configuration = new Configuration();
                    configuration.SetProperty(NHibernate.Cfg.Environment.ConnectionString, configFile.ConnectionString);
                    configuration.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, String.Format("NHibernate.Driver.{0}", configFile.DatabaseDriver));
                    configuration.SetProperty(NHibernate.Cfg.Environment.Dialect, String.Format("NHibernate.Dialect.{0}", configFile.DatabaseDialect));
                    configuration.AddXml(configFile.Mapping);

                    sesionFactoryDictionary.Add(configFile.TokenId, configuration.BuildSessionFactory());
                }
            }
            catch (Exception ex)
            {
                log.Error("Can't create sessionFactory", ex);
            }
        }
开发者ID:espressomorte,项目名称:Supakull,代码行数:24,代码来源:ClientNHibernateSessionFactory.cs

示例6: ApplyConfiguration

 /// <summary>
 /// Adds mappings for this model to a NHibernate configuration object.
 /// </summary>
 /// <param name="configuration">A NHibernate configuration object to which to add mappings for this model.</param>
 public static void ApplyConfiguration(Configuration configuration)
 {
     configuration.AddXml(ModelMappingXml.ToString());
       configuration.AddAssembly(typeof(ConfigurationHelper).Assembly);
 }
开发者ID:brendankowitz,项目名称:Samples,代码行数:9,代码来源:SampleApp.cs

示例7: NestedWithinGeneric

		public void NestedWithinGeneric()
		{
			var configuration = new Configuration().Configure();
			configuration.AddXml(string.Format(mappingTemplate, typeof(A<int>).FullName, typeof(A<int>.B).FullName));
		}
开发者ID:hoangduc007,项目名称:nhibernate-core,代码行数:5,代码来源:AddMappingTest.cs

示例8: ApplyConfiguration

 /// <summary>
 /// Adds mappings for this model to a NHibernate configuration object.
 /// </summary>
 /// <param name="configuration">A NHibernate configuration object to which to add mappings for this model.</param>
 public static void ApplyConfiguration(Configuration configuration)
 {
   configuration.AddXml(ModelMappingXml.ToString());
   configuration.AddXml(Grouping.MappingXml.ToString());
   configuration.AddXml(Staff.MappingXml.ToString());
   configuration.AddXml(GroupingType.MappingXml.ToString());
   configuration.AddXml(Project.MappingXml.ToString());
   configuration.AddXml(ProjectIssueSeverity.MappingXml.ToString());
   configuration.AddXml(ProjectNotificationInstance.MappingXml.ToString());
   configuration.AddXml(ProjectTask.MappingXml.ToString());
   configuration.AddXml(ProjectTaskNotification.MappingXml.ToString());
   configuration.AddXml(ProjectTaskType.MappingXml.ToString());
   configuration.AddXml(ProjectType.MappingXml.ToString());
   configuration.AddXml(ProjectUpdate.MappingXml.ToString());
   configuration.AddXml(ProjectUpdateType.MappingXml.ToString());
   configuration.AddXml(RequestForWork.MappingXml.ToString());
   configuration.AddXml(ProjectNote.MappingXml.ToString());
   configuration.AddXml(ProjectIssue.MappingXml.ToString());
   configuration.AddXml(ProjectDocument.MappingXml.ToString());
   configuration.AddAssembly(typeof(ConfigurationHelper).Assembly);
 }
开发者ID:aardvarkss,项目名称:vs,代码行数:25,代码来源:DataModel.cs

示例9: RealEntities_Test

 public void RealEntities_Test()
 {
     var cfg = new Configuration();
     cfg.AddProperties(new Dictionary<string, string> {
         {Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider"},
         {Environment.Dialect, "NHibernate.Dialect.SQLiteDialect"},
         {Environment.ConnectionDriver, "NHibernate.Driver.SQLite20Driver"},
         {Environment.ConnectionString, "Data Source=test.db;Version=3;New=True;"},
     });
     cfg.AddXml(one_xml);
     cfg.AddXml(two_xml);
     cfg.AddXml(three_xml);
     new SchemaExport(cfg).Create(true, true);
     using (var factory = cfg.BuildSessionFactory()) {
         using (var session = factory.OpenSession()) {
             var three = new Three();
             session.Save(three);
             var two = new Two { Three = three };
             session.Save(two);
             session.Save(new One { Two = two });
             session.Flush();
         }
         using (var session = factory.OpenSession()) {
             var one = session.CreateCriteria(typeof (One)).List<One>()[0];
             Assert.IsFalse(NHibernateUtilEx.IsInitialized(() => one.Two));
             Assert.IsFalse(NHibernateUtilEx.IsInitialized(() => one.Two.Three));
             var t = one.Two.Three;
             Assert.IsTrue(NHibernateUtilEx.IsInitialized(() => one.Two));
             Assert.IsFalse(NHibernateUtilEx.IsInitialized(() => one.Two.Three));
         }
     }
 }
开发者ID:ruanzx,项目名称:mausch,代码行数:32,代码来源:ProxyTests.cs


注:本文中的NHibernate.Cfg.Configuration.AddXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。