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


C# Cfg类代码示例

本文整理汇总了C#中Cfg的典型用法代码示例。如果您正苦于以下问题:C# Cfg类的具体用法?C# Cfg怎么用?C# Cfg使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ReadConfig

        public static bool ReadConfig()
        {
            if (!Directory.Exists(savepath))
                Directory.CreateDirectory(savepath);

            if (!File.Exists(filepath))
            {
                try
                {
                    CreateConfig();
                }
                catch
                {
                    return false;
                }
                return true;
            }

            try
            {
                using (var sr = new StreamReader(filepath))
                {
                    config = JsonConvert.DeserializeObject<Cfg>(sr.ReadToEnd());
                }
            }
            catch (Exception ex)
            {
                Log.ConsoleError(ex.Message);
                return false;
            }
            return true;
        }
开发者ID:Enerdy,项目名称:AutoRank,代码行数:32,代码来源:Config.cs

示例2: Configure

		protected override void Configure(Cfg.Configuration configuration)
		{
			configuration.SetProperty(Cfg.Environment.BatchSize, "10");

			configuration.SetProperty(	Cfg.Environment.SqlExceptionConverter,
										typeof (MSSQLExceptionConverterExample).AssemblyQualifiedName);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:7,代码来源:Fixture.cs

示例3: SetupSqlServerOdbc

		private static void SetupSqlServerOdbc(Cfg.Configuration cfg)
		{
			var connStr = cfg.Properties[Cfg.Environment.ConnectionString];

			using (var conn = new OdbcConnection(connStr.Replace("Database=nhibernateOdbc", "Database=master")))
			{
				conn.Open();

				using (var cmd = conn.CreateCommand())
				{
					cmd.CommandText = "drop database nhibernateOdbc";

					try
					{
						cmd.ExecuteNonQuery();
					}
					catch(Exception e)
					{
						Console.WriteLine(e);
					}

					cmd.CommandText = "create database nhibernateOdbc";
					cmd.ExecuteNonQuery();
				}
			}
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:26,代码来源:TestDatabaseSetup.cs

示例4: Configure

		protected override void Configure(Cfg.Configuration configuration)
		{
			if(Dialect is MsSql2000Dialect)
			{
				configuration.SetProperty(
					Cfg.Environment.SqlExceptionConverter,
					typeof(MSSQLExceptionConverterExample).AssemblyQualifiedName);
			}

			if (Dialect is Oracle8iDialect)
			{
				configuration.SetProperty(
					Cfg.Environment.SqlExceptionConverter,
					typeof(OracleClientExceptionConverterExample).AssemblyQualifiedName);
			}

			if (Dialect is PostgreSQLDialect)
			{
				configuration.SetProperty(
					Cfg.Environment.SqlExceptionConverter,
					typeof(PostgresExceptionConverterExample).AssemblyQualifiedName);
			}

			if (Dialect is FirebirdDialect)
			{
				configuration.SetProperty(
					Cfg.Environment.SqlExceptionConverter,
					typeof(FbExceptionConverterExample).AssemblyQualifiedName);
			}
		}
开发者ID:nhibernate,项目名称:nhibernate-core,代码行数:30,代码来源:SQLExceptionConversionTest.cs

示例5: Configure

		//protected override bool AppliesTo(Dialect.Dialect dialect)
		//{
		//  // this test work only with Field interception (NH-1618)
		//  return FieldInterceptionHelper.IsInstrumented( new Person() );
		//}
		protected override void Configure(Cfg.Configuration configuration)
		{
			configuration.SetProperty(Environment.ProxyFactoryFactoryClass,
										typeof(NHibernate.ByteCode.Castle.ProxyFactoryFactory).AssemblyQualifiedName);
			configuration.SetProperty(Environment.MaxFetchDepth, "2");
			configuration.SetProperty(Environment.UseSecondLevelCache, "false");
		}
开发者ID:juanplopes,项目名称:nhibernate,代码行数:12,代码来源:LazyOneToOneTest.cs

示例6: Configure

		protected override void Configure(Cfg.Configuration configuration)
		{
			configuration.Cache(x =>
								{
									x.Provider<HashtableCacheProvider>();
									x.UseQueryCache = true;
								});
		}
开发者ID:Leftyx,项目名称:nhibernate-core,代码行数:8,代码来源:CachingWithTrasformerTests.cs

示例7: AddMappings

		protected override void AddMappings(Cfg.Configuration configuration)
		{
			// Set some properties that must be set before the mappings are added.
			// (The overridable Configure(cfg) is called AFTER AddMappings(cfg).)
			configuration.SetProperty(Cfg.Environment.PreferPooledValuesLo, _preferLo.ToString().ToLower());

			base.AddMappings(configuration);
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:8,代码来源:DefaultOptimizedSequenceTest.cs

示例8: Configure

		protected override void Configure(Cfg.Configuration configuration)
		{
			configuration.AddProperties(new Dictionary<string, string>
			                            	{
			                            		{
			                            			Cfg.Environment.QueryTranslator,
			                            			typeof (NHibernate.Hql.Classic.ClassicQueryTranslatorFactory).FullName
			                            			}
			                            	}
				);
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:11,代码来源:Fixture.cs

示例9: Configure

		protected override void Configure(Cfg.Configuration configuration)
		{
			var assembly = GetType().Assembly;
			string mappingNamespace = GetType().Namespace;
			foreach (var resource in assembly.GetManifestResourceNames())
			{
				if (resource.StartsWith(mappingNamespace) && resource.EndsWith(".hbm.xml"))
				{
					configuration.AddResource(resource, assembly);
				}
			}
		}
开发者ID:nkmajeti,项目名称:nhibernate,代码行数:12,代码来源:BaseFixture.cs

示例10: getFor

        public static AuditConfiguration getFor(Cfg.Configuration cfg) {
            AuditConfiguration verCfg = null;
            if(cfgs.Keys.Contains(cfg))
                verCfg = cfgs[cfg];
            else{
                verCfg = new AuditConfiguration(cfg);
                cfgs.Add(cfg, verCfg);
                
                cfg.BuildMappings();
            }

            return verCfg;
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:13,代码来源:AuditConfiguration.cs

示例11: Config

        public void Config(IPersistenceUnitCfg puCfg, Cfg.Configuration configuration)
        {
           if(puCfg.Name ==  MockPersistenceUnitCfg.MockPUName )
           {
                
               configuration.SetProperty("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
               configuration.SetProperty("connection.driver_class", "NHibernate.Driver.SqlClientDriver");
               configuration.SetProperty("connection.connection_string", "Server=(local);initial catalog=NHibernateBurrow;Integrated Security=SSPI");
               configuration.SetProperty("dialect", "NHibernate.Dialect.MsSql2005Dialect");

            configuration.SetProperty("adonet.batch_size", testAdoBatchSize.ToString());
         
           }
        }
开发者ID:hazzik,项目名称:NHibernate.Burrow,代码行数:14,代码来源:ConfiguratorFixture.cs

示例12: SetupFirebird

		private static void SetupFirebird(Cfg.Configuration cfg)
		{
			try
			{
				if (File.Exists("NHibernate.fdb"))
					File.Delete("NHibernate.fdb");
			}
			catch (Exception e)
			{
				Console.WriteLine(e);
			}

			FbConnection.CreateDatabase("Database=NHibernate.fdb;ServerType=1");
		}
开发者ID:pontillo,项目名称:PowerNap,代码行数:14,代码来源:TestDatabaseSetup.cs

示例13: Load

 private static void Load()
 {
     if (File.Exists(configName))
     {
         StreamReader sr = new StreamReader(configName);
         cfg = (Cfg)jsonSerializer.Deserialize(sr, typeof(Cfg));
         sr.Close();
     }
     else
     {
         cfg = new Cfg();
         Save();
     }
 }
开发者ID:xopuct,项目名称:notes,代码行数:14,代码来源:ClientConfig.cs

示例14: Configure

		protected override void Configure(Cfg.Configuration configuration)
		{
			foreach (var cls in configuration.ClassMappings)
			{
				foreach (var prop in cls.PropertyIterator)
				{
					foreach (var col in prop.ColumnIterator)
					{
						if (col is Column)
						{
							var column = col as Column;
							if (column.SqlType == "nvarchar(max)")
								column.SqlType = Dialect.GetLongestTypeName(DbType.String);
						}
					}
				}
			}
		}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:18,代码来源:Fixture.cs

示例15: SetupNpgsql

		private static void SetupNpgsql(Cfg.Configuration cfg)
		{
			var connStr = cfg.Properties[Cfg.Environment.ConnectionString];

			using (var conn = new NpgsqlConnection(connStr.Replace("Database=nhibernate", "Database=postgres")))
			{
				conn.Open();

				using (var cmd = conn.CreateCommand())
				{
					cmd.CommandText = "drop database nhibernate";

					try
					{
						cmd.ExecuteNonQuery();
					}
					catch (Exception e)
					{
						Console.WriteLine(e);
					}

					cmd.CommandText = "create database nhibernate";
					cmd.ExecuteNonQuery();
				}
			}

            // Install the GUID generator function that uses the most common "random" algorithm.
            using (var conn = new NpgsqlConnection(connStr))
            {
                conn.Open();

				using (var cmd = conn.CreateCommand())
				{
                    cmd.CommandText =
                        @"CREATE OR REPLACE FUNCTION uuid_generate_v4()
                        RETURNS uuid
                        AS '$libdir/uuid-ossp', 'uuid_generate_v4'
                        VOLATILE STRICT LANGUAGE C;";

					cmd.ExecuteNonQuery();
				}
            }
		}
开发者ID:pontillo,项目名称:PowerNap,代码行数:43,代码来源:TestDatabaseSetup.cs


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