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


C# Configuration.AddInputStream方法代码示例

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


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

示例1: GetConfiguracao

        private static Configuration GetConfiguracao()
        {
            Configuration cfg = new Configuration();
            try
            {
                cfg.Configure().SetProperty("connection.connection_string", Sistema._conexaoBanco);
                /** Classes Mapeadas */

                cfg.AddInputStream(NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize(typeof(Produto)));
                cfg.AddInputStream(NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize(typeof(Cliente)));
                cfg.AddInputStream(NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize(typeof(HistoricoEstoque)));
                cfg.AddInputStream(NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize(typeof(Ingrediente)));
                cfg.AddInputStream(NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize(typeof(IngredienteProduto)));
                cfg.AddInputStream(NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize(typeof(Usuario)));
                cfg.AddInputStream(NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize(typeof(Venda)));
                cfg.AddInputStream(NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize(typeof(VendaProduto)));

            }
            catch (Exception e)
            {
                Console.Write("Código: " + e.Source + " | Mensagem" + e.Message);
                Sistema.logErro("Código: " + e.Source + " | Mensagem" + e.InnerException.Message);
                throw new Exception("Erro geral: " + e.InnerException.Message);
            }
            return cfg;
        }
开发者ID:italoalanw3,项目名称:primeira-experiencia-csharp,代码行数:26,代码来源:ConexaoBD.cs

示例2: OpenSession

 private static void OpenSession()
 {
     Configuration = new Configuration().Configure();
     Configuration.AddAssembly(Assembly.GetExecutingAssembly());
     Configuration.AddInputStream(HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()));
     sessionFactory = Configuration.BuildSessionFactory();
 }
开发者ID:prachwal,项目名称:HibernateProject,代码行数:7,代码来源:NHibernateHelper.cs

示例3: CreateMappingsFromAttributesAndAddToConfiguration

        private static void CreateMappingsFromAttributesAndAddToConfiguration(Configuration cfg)
        {
            HbmSerializer.Default.Validate = true;
            HbmSerializer.Default.HbmDefaultAccess = "field.camelcase";
            using (MemoryStream stream = HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))

            {
                cfg.AddInputStream(stream);
            }
        }
开发者ID:krwhite,项目名称:sync,代码行数:10,代码来源:NHibernateHelper.cs

示例4: Register

 /// <summary>
 /// 使用默认的配置文件注册(默认文件名:hibernate.cfg.xml)
 /// </summary>
 /// <param name="asm">带有映射关系Attribute的程序集</param>
 public void Register(Assembly asm)
 {
     var cfg = new Configuration();
     cfg.Configure();
     HbmSerializer.Default.Validate = true; // Enable validation (optional)
     // Here, we serialize all decorated classes (but you can also do it class by class)
     cfg.AddInputStream(
         HbmSerializer.Default.Serialize(asm));
     // Now you can use this configuration to build your SessionFactory...
     _sessionFactory = cfg.BuildSessionFactory();
 }
开发者ID:john123951,项目名称:sweetfly.net,代码行数:15,代码来源:NSessionFactoryManager.cs

示例5: VulDataBank

        VulDataBank()
        {
            Configuration cfg = new Configuration();
            cfg.Configure();

            HbmSerializer.Default.Validate = true; // Enable validation (optional)
            // alle klassen serializeren van de assembly BadmintonORM
            cfg.AddInputStream(HbmSerializer.Default.Serialize(typeof(ORMLid).Assembly));

            sessionFactory = cfg.BuildSessionFactory();
        }
开发者ID:ahluntang,项目名称:tiwi-computernetwerken4,代码行数:11,代码来源:VulDataBank.cs

示例6: ORMBadmintonDAO

        public ORMBadmintonDAO()
        {
            cfg = new Configuration();
            cfg.Configure();

            HbmSerializer.Default.Validate = true; // Enable validation (optional)
            // alle klassen serializeren
            //cfg.AddInputStream(HbmSerializer.Default.Serialize(System.Reflection.Assembly.GetExecutingAssembly()));
            cfg.AddInputStream(HbmSerializer.Default.Serialize(typeof(ORMLid).Assembly));

            sessionFactory = cfg.BuildSessionFactory();
        }
开发者ID:ahluntang,项目名称:tiwi-computernetwerken4,代码行数:12,代码来源:ORMBadmintonDAO.cs

示例7: AddAttributeMappings

    static void AddAttributeMappings(Configuration nhConfiguration)
    {
        HbmSerializer hbmSerializer = new HbmSerializer
        {
            Validate = true
        };

        using (MemoryStream stream = hbmSerializer.Serialize(typeof(Program).Assembly))
        {
            nhConfiguration.AddInputStream(stream);
        }
    }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:12,代码来源:Program.cs

示例8: PostProcessConfiguration

        protected override void PostProcessConfiguration(Configuration config)
        {
            base.PostProcessConfiguration(config);

            MemoryStream stream = new MemoryStream();
            HbmSerializer.Default.Validate = true;
            foreach (string modelAssemblyName in ModelAssemblyName)
            {
                Assembly assembly = Assembly.Load(modelAssemblyName);
                HbmSerializer.Default.Serialize(stream, assembly);
                stream.Position = 0;
                config.AddInputStream(stream);
            }
        }
开发者ID:ellennet,项目名称:Estelle,代码行数:14,代码来源:MyLocalSessionFactoryObject.cs

示例9: LiveSqliteSchema

 static LiveSqliteSchema()
 {
     var config = new Configuration();
     config.SetProperty(Environment.Dialect, "NHibernate.Dialect.SQLiteDialect");
     config.AddInputStream(HbmSerializer.Default.Serialize(Assembly.Load("tanzer.lotto.core")));
     Dialect dialect = Dialect.GetDialect(config.Properties);
     // pause at critical moments; row COUNT; rollback journal; isolation level
     // @sa http://www.sqlite.org/pragma.html
     script = "PRAGMA synchronous=FALSE;PRAGMA count_changes=FALSE;PRAGMA journal_mode=FALSE;PRAGMA read_uncommitted=TRUE;";
     script += String.Join(";", config.GenerateDropSchemaScript(dialect));
     script += ";";
     script += String.Join(";", config.GenerateSchemaCreationScript(dialect));
     script += ";";
 }
开发者ID:bjornebjornson,项目名称:LottoNh2,代码行数:14,代码来源:LiveSqliteSchema.cs

示例10: init

		public void init(String dbPath, bool create)
		{
			IDictionary<String, String> settings = new Dictionary<String, String>();
			settings.Add("dialect", "NHibernate.Dialect.SQLiteDialect");
			settings.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
			settings.Add("connection.driver_class", "NHibernate.Driver.SQLite20Driver");
			settings.Add("connection.connection_string", "Data Source=" + dbPath + ";Version=3");
			settings.Add("hbm2ddl.auto", create ? "create" : "update");

			try
			{
				cf = new Configuration();
				cf.Properties = settings;

				NHibernate.Mapping.Attributes.HbmSerializer.Default.Validate = true;
				using (FileStream fs = File.Create(@"f:\temp\nhibernate.xml"))
				{
					System.IO.MemoryStream stream1 = new System.IO.MemoryStream();
					NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize(
						stream1, System.Reflection.Assembly.GetExecutingAssembly());
					stream1.Position = 0;
					stream1.WriteTo(fs);
					stream1.Close();
				}
				System.IO.MemoryStream stream = new System.IO.MemoryStream();
				NHibernate.Mapping.Attributes.HbmSerializer.Default.Serialize(
					stream, System.Reflection.Assembly.GetExecutingAssembly());
				stream.Position = 0;
				cf.AddInputStream(stream);

				sessionFactory = cf.BuildSessionFactory();
			}
			catch (System.Exception ex)
			{
				String err = ex.StackTrace;
				Console.WriteLine(ex.Message);
				Console.WriteLine(err);
				if (ex.InnerException != null)
				{
					Console.WriteLine(ex.InnerException.Message);
					Console.WriteLine(ex.InnerException.StackTrace);
				}
				throw;
			}
		}
开发者ID:wangfeilong321,项目名称:PDMS_ExportModel,代码行数:45,代码来源:Util.cs

示例11: Open

    public void Open()
    {
      _database = new DatabaseManager();
      _database.Recreate();

      IDictionary<string, string> properties = SqlHelper.Provider.CreateNhibernateProperties();
      properties["connection.provider"] = "NHibernate.Connection.DriverConnectionProvider";
      properties["connection.connection_string"] = _database.Connection.ConnectionString;
      properties["connection.release_mode"] = "on_close";
      properties["proxyfactory.factory_class"] = "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle";

      Configuration configuration = new Configuration();
      configuration.AddProperties(properties);
      HbmSerializer.Default.Validate = true;
      MemoryStream stream = HbmSerializer.Default.Serialize(typeof(NorthwindEmployee).Assembly);
      stream.Position = 0;
      configuration.AddInputStream(stream);
      stream.Close();

      _sessionFactory = configuration.BuildSessionFactory();
    }
开发者ID:machine,项目名称:machine.uow,代码行数:21,代码来源:DatabaseAndNhSessionFactory.cs

示例12: ConfigureByCode

        static Configuration ConfigureByCode()
        {
            Configuration cfg = new Configuration();
            cfg.Properties[Environment.ConnectionProvider] =
              "NHibernate.Connection.DriverConnectionProvider";
            cfg.Properties[Environment.Dialect] =
              "NHibernate.Dialect.MsSql2000Dialect";
            cfg.Properties[Environment.ConnectionDriver] =
              "NHibernate.Driver.SqlClientDriver";
            cfg.Properties[Environment.ConnectionString] =
              "Data Source=.\\SQLEXPRESS;Initial Catalog=HelloNHibernate;Integrated Security=SSPI";
            cfg.AddAssembly(Assembly.GetCallingAssembly());

            HbmSerializer.Default.Validate = true;
            using (MemoryStream stream =
              HbmSerializer.Default.Serialize(
                Assembly.GetExecutingAssembly()))
                cfg.AddInputStream(stream);

            return cfg;
        }
开发者ID:krwhite,项目名称:sync,代码行数:21,代码来源:ProgramWithAttributes.cs

示例13: GetConfiguration

 public static Configuration GetConfiguration(String path, SrmSettings settings)
 {
     Configuration configuration = new Configuration()
         .SetProperty("dialect", typeof(NHibernate.Dialect.SQLiteDialect).AssemblyQualifiedName) // Not L10N
         .SetProperty("connection.connection_string", new SQLiteConnectionStringBuilder // Not L10N
         {
             DataSource = path
         }.ToString())
         .SetProperty("connection.driver_class", typeof(NHibernate.Driver.SQLite20Driver).AssemblyQualifiedName); // Not L10N
     Assembly assembly = typeof(SessionFactoryFactory).Assembly;
     configuration.SetProperty("connection.provider", typeof(NHibernate.Connection.DriverConnectionProvider).AssemblyQualifiedName); // Not L10N
     configuration.AddInputStream(assembly.GetManifestResourceStream(typeof(SessionFactoryFactory).Namespace + ".mapping.xml")); // Not L10N
     if (settings != null)
         AddRatioColumns(configuration, settings);
     AddAnnotations(configuration, settings, AnnotationDef.AnnotationTarget.protein, typeof(DbProtein));
     AddAnnotations(configuration, settings, AnnotationDef.AnnotationTarget.peptide, typeof(DbPeptide));
     AddAnnotations(configuration, settings, AnnotationDef.AnnotationTarget.precursor, typeof(DbPrecursor));
     AddAnnotations(configuration, settings, AnnotationDef.AnnotationTarget.transition, typeof(DbTransition));
     AddAnnotations(configuration, settings, AnnotationDef.AnnotationTarget.replicate, typeof(DbProteinResult));
     AddAnnotations(configuration, settings, AnnotationDef.AnnotationTarget.precursor_result, typeof(DbPrecursorResult));
     AddAnnotations(configuration, settings, AnnotationDef.AnnotationTarget.transition_result, typeof(DbTransitionResult));
     return configuration;
 }
开发者ID:lgatto,项目名称:proteowizard,代码行数:23,代码来源:SessionFactoryFactory.cs

示例14: BuildConfigFromClasses

        static Configuration BuildConfigFromClasses()
        {
            NHibernate.Cfg.Environment.UseReflectionOptimizer = false;
            Configuration cfg = new Configuration()
                .Configure()
                .AddFile("ItemQueries.hbm.xml");

            // Use NHibernate.Mapping.Attributes to create mapping information about our entities
            #if DEBUG
            HbmSerializer.Default.Validate = true; // Enable validation (optional)
            HbmSerializer.Default.Serialize(
                typeof(User).Assembly, "Mapping.hbm.xml");
            #endif
            using (System.IO.MemoryStream stream =
                        HbmSerializer.Default.Serialize(
                            typeof(User).Assembly))
                cfg.AddInputStream(stream); // Send the mapping information to NHibernate configuration

            return cfg;
        }
开发者ID:krwhite,项目名称:sync,代码行数:20,代码来源:NHibernateHelper.cs

示例15: DoNothing

 public void DoNothing()
 {
     ConfigurableResourceLoader loader = new ConfigurableResourceLoader();
     Configuration c = new Configuration();
     String resourceName =
         "assembly://Spring.Data.NHibernate21.Integration.Tests/Spring.Data.NHibernate/TestObject.hbm.xml";
     c.AddInputStream(loader.GetResource(resourceName).InputStream);
     ISessionFactory sf = c.BuildSessionFactory();
 }
开发者ID:fgq841103,项目名称:spring-net,代码行数:9,代码来源:HibernateTxScopeTransactionManagerTests.cs


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