• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Configuration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CharaController

    public CharaController(CharaConfiguration chara, Configuration config, GameObject[] objs, bool debug = false)
    {
        _chara = chara;
        _config = config;

        _objs = objs;
        _joints = new ConfigurableJoint[_objs.Length];
        _rigs = new Rigidbody[_objs.Length];
        _init_rot = new Quaternion[_objs.Length];
        _target_rot = new Quaternion[_objs.Length];
        _target_pos = new Vector3[_objs.Length];

        _debug = debug;

        for (int i = 0; i < _objs.Length; ++i) {
            _rigs[i] = _objs[i].GetComponent<Rigidbody>();
            /*
            if (_debug)
                _rigs[i].isKinematic = true;
                */
            _init_rot[i] = _objs[i].transform.localRotation;
            _target_rot[i] = _init_rot[i];

            _joints[i] = _objs[i].GetComponent<ConfigurableJoint>();
        }

        InitializeJoints();
    }
开发者ID:yihengz,项目名称:UnityBiped,代码行数:28,代码来源:CharaController.cs


示例2: should_load_config_from_xml_type_name

 public void should_load_config_from_xml_type_name()
 {
     var config = new Configuration().LoadSection<ApplicationWithXmlTypeName>();
     config.Build.Date.ShouldEqual(DateTime.Parse("11/26/1986"));
     config.Build.DeployTarget.ShouldEqual(Target.CI);
     config.Build.Version.ShouldEqual("1.1.1.1");
 }
开发者ID:mikeobrien,项目名称:SimpleConfig,代码行数:7,代码来源:LoadConfigTests.cs


示例3: SetUp

        public void SetUp()
        {
            disposables = new CompositeDisposable
            {
                VirtualClock.Start()
            };

            clockName = Any.CamelCaseName();
            targetId = Any.Word();
            target = new CommandTarget(targetId);
            store = new InMemoryStore<CommandTarget>(
                _ => _.Id,
                id => new CommandTarget(id))
            {
                target
            };

            configuration = new Configuration()
                .UseInMemoryCommandScheduling()
                .UseDependency<IStore<CommandTarget>>(_ => store)
                .UseDependency<GetClockName>(c => _ => clockName)
                .TraceScheduledCommands();

            scheduler = configuration.CommandScheduler<CommandTarget>();

            Command<CommandTarget>.AuthorizeDefault = (commandTarget, command) => true;

            disposables.Add(ConfigurationContext.Establish(configuration));
            disposables.Add(configuration);
        }
开发者ID:charlesmccarthyirl,项目名称:Its.Cqrs,代码行数:30,代码来源:NonEventSourcedAggregateCommandSchedulingTests.cs


示例4: Conventions

        public Conventions(Configuration configuration)
        {
            Actions.FindBy(x => {
                x.Applies.ToThisAssembly();
                x.IncludeTypesNamed(y => y.EndsWith("Handler"));
            });
            
            Routes
                .HomeIs<GetHandler>(x => x.Execute())
                .IgnoreMethodSuffix("Execute")
                .IgnoreControllerNamesEntirely()
                .IgnoreControllerNamespaceEntirely()
                .ConstrainToHttpMethod(action => action.HandlerType.Name.EndsWith("GetHandler"), "GET");

            Services(x =>
            {
                x.AddService(configuration);
                x.AddService<IDescriptionConvention<BehaviorChain, ModuleDescription>>(configuration.ModuleConvention.Type, configuration.ModuleConvention.Config)
                 .AddService<IDescriptionConvention<BehaviorChain, ResourceDescription>>(configuration.ResourceConvention.Type, configuration.ResourceConvention.Config)
                 .AddService<IDescriptionConvention<BehaviorChain, EndpointDescription>>(configuration.EndpointConvention.Type, configuration.EndpointConvention.Config)
                 .AddService<IDescriptionConvention<PropertyInfo, MemberDescription>>(configuration.MemberConvention.Type, configuration.MemberConvention.Config)
                 .AddService<IDescriptionConvention<System.Type, EnumDescription>>(configuration.EnumConvention.Type, configuration.EnumConvention.Config)
                 .AddService<IDescriptionConvention<FieldInfo, EnumOptionDescription>>(configuration.EnumOptionConvention.Type, configuration.EnumOptionConvention.Config)
                 .AddService<IDescriptionConvention<BehaviorChain, List<StatusCodeDescription>>>(configuration.StatusCodeConvention.Type, configuration.StatusCodeConvention.Config)
                 .AddService<IDescriptionConvention<BehaviorChain, List<HeaderDescription>>>(configuration.HeaderConvention.Type, configuration.HeaderConvention.Config)
                 .AddService<IDescriptionConvention<BehaviorChain, List<MimeTypeDescription>>>(configuration.MimeTypeConvention.Type, configuration.MimeTypeConvention.Config)
                 .AddService<IDescriptionConvention<System.Type, TypeDescription>>(configuration.TypeConvention.Type, configuration.TypeConvention.Config);
            });
        }
开发者ID:mikeobrien,项目名称:FubuMVC.Swank,代码行数:29,代码来源:Conventions.cs


示例5: MySQLDatabase

 /// <summary>
 /// Constructor which takes the connection string name
 /// </summary>
 /// <param name="connectionStringName"></param>
 public MySQLDatabase(string connectionStringName)
 {
     var configuration = new Configuration()
         .AddJsonFile("config.json");
     string connectionString = configuration[connectionStringName];
     _connection = new MySqlConnection(connectionString);
 }
开发者ID:SameerOmar,项目名称:bondii.identity.mysql,代码行数:11,代码来源:MySQLDatabase.cs


示例6: BulkLoader

 protected BulkLoader(Configuration.Configuration config)
 {
     _jobs = new JobList();
     _jobs.RowsInserted += (s, e) => OnRowsInserted(e);
     Config = config;
     DefaultSchema = "dbo";
 }
开发者ID:JXPrime,项目名称:soddi,代码行数:7,代码来源:BulkLoader.cs


示例7: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            var cfg = new Configuration();
            cfg.Configure();
            cfg.AddAssembly(typeof(Domain.User).Assembly);

            var sessions = cfg.BuildSessionFactory();
            var sess = sessions.OpenSession();
            var new_user = new Domain.User

            {
                Name = textBox1.Text,
                Surname = textBox2.Text,
                Patronymic = textBox3.Text,
                Role_id = 1,
                Login = textBox4.Text,
                Pass = textBox5.Text
            };
            if (new_user.Name.Length > 0 && new_user.Surname.Length > 0 && new_user.Patronymic.Length > 0 && new_user.Login.Length > 0 && new_user.Pass.Length > 0)
            {
                sess.Save(new_user);
                sess.Flush();
                this.Hide();
            }
            else
            {
                label6.Text = "Не все поля заполнены!";
            }
        }
开发者ID:alenkacs,项目名称:library_system,代码行数:29,代码来源:RegistrationForm.cs


示例8: OnStart

        public override bool OnStart()
        {
            try
            {
                // Increase disk quota for mbrace filesystem cache.
                string customTempLocalResourcePath = RoleEnvironment.GetLocalResource("LocalMBraceCache").RootPath;
                string storageConnectionString = CloudConfigurationManager.GetSetting("MBrace.StorageConnectionString");
                string serviceBusConnectionString = CloudConfigurationManager.GetSetting("MBrace.ServiceBusConnectionString");

                bool result = base.OnStart();

                _config = new Configuration(storageConnectionString, serviceBusConnectionString);
                _svc =
                    RoleEnvironment.IsEmulated ?
                    new WorkerService(_config, String.Format("computeEmulator-{0}", Guid.NewGuid().ToString("N").Substring(0, 30))) :
                    new WorkerService(_config, workerId: Environment.MachineName);

                _svc.WorkingDirectory = customTempLocalResourcePath;
                _svc.LogFile = "logs.txt";
                _svc.MaxConcurrentWorkItems = Environment.ProcessorCount * 8;
                
                Environment.SetEnvironmentVariable("TMP", customTempLocalResourcePath, EnvironmentVariableTarget.Process);
                Environment.SetEnvironmentVariable("TEMP", customTempLocalResourcePath, EnvironmentVariableTarget.Process);

                RoleEnvironment.Changed += RoleEnvironment_Changed;

                return result;
            }
            catch (Exception ex)
            {
                Trace.TraceError("MBrace.Azure.WorkerRole OnStart unhandled exception: {0}", ex);
                throw;
            }
        }
开发者ID:plmaheu,项目名称:MBrace.StarterKit,代码行数:34,代码来源:WorkerRole.cs


示例9: FileLogWriter

 public FileLogWriter(Configuration.MonitorConfiguration conf)
 {
     this.filePath = conf.LogFilePath;
     this.logFileSize = conf.LogFileSize <= 0 ? DefaultLogFileSize : conf.LogFileSize;
     this.maxLogRetention = conf.MaxLogRetention <= 0 ? DefaultLogRetention : conf.MaxLogRetention;
     Directory.CreateDirectory(Path.GetDirectoryName(this.filePath));
 }
开发者ID:biapar,项目名称:enhanced-monitoring-service,代码行数:7,代码来源:FileLogWriter.cs


示例10: CreateStuff

        private static void CreateStuff(Configuration cfg)
        {
            using (ISessionFactory sessionFactory = cfg.BuildSessionFactory())
            using (ISession session = sessionFactory.OpenSession())
            using (ITransaction transaction = session.BeginTransaction())
            {
                try
                {
                    var tempUser = new User { Username = "temp" };
                    session.Save(tempUser);

                    transaction.Commit();
                }
                catch (Exception e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(e.Message);
                    Console.ResetColor();
                    transaction.Rollback();
                }
                finally
                {
                    session.Close();
                }
            }
        }
开发者ID:Rooster212,项目名称:NHibernateTest,代码行数:26,代码来源:Program.cs


示例11: AddLoquaciousMappings

 static Configuration AddLoquaciousMappings(Configuration nhConfiguration)
 {
     ModelMapper mapper = new ModelMapper();
     mapper.AddMappings(typeof(OrderSagaDataLoquacious).Assembly.GetTypes());
     nhConfiguration.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());
     return nhConfiguration;
 }
开发者ID:odelljl,项目名称:docs.particular.net,代码行数:7,代码来源:Program.cs


示例12: ConfigurationSetCultureExtensionLeavesOriginallyUnmodified

 public void ConfigurationSetCultureExtensionLeavesOriginallyUnmodified()
 {
     var original = new Configuration();
     var modified = original.SetCulture("de-at");
     Assert.AreNotSame(original, modified);
     Assert.AreNotEqual(original.Services.Count(), modified.Services.Count());
 }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:7,代码来源:BasicConfiguration.cs


示例13: ConfigurationWithExtensionLeavesOriginallyUnmodified

 public void ConfigurationWithExtensionLeavesOriginallyUnmodified()
 {
     var original = new Configuration();
     var modified = original.WithCss();
     Assert.AreNotSame(original, modified);
     Assert.AreNotEqual(original.Services.Count(), modified.Services.Count());
 }
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:7,代码来源:BasicConfiguration.cs


示例14: GetUserInfoById

        public UserInfo GetUserInfoById(int userId)
        {
            Configuration cfg = new Configuration().Configure(path);

            ISession session = cfg.BuildSessionFactory().OpenSession();
            return session.Get<UserInfo>(userId);
        }
开发者ID:RandomBoy,项目名称:NHibernate,代码行数:7,代码来源:UserInfoBLL.cs


示例15: Grabber

        public Grabber(CheatEngineReader table, MemoryReader reader)
        {
            Config = new Configuration(this);

            //TEMPORARY configuration!
            Config.SamplesBeforeTrigger = 750;
            Config.SamplesAfterTrigger = 750;
            Config.SampleWaitTime = 10000;//ms, 1ms here

            Config.Trigger_Simple_Channel = 0; // gear
            Config.Trigger_Simple_Condition = TriggerCondition.IN_RANGE; // Rising up
            Config.Trigger_Simple_ValueType = MemoryChannelType.INT32;
            Config.Trigger_Simple_Value = new byte[4] { 3, 0, 0, 0 }; // INT32 (5)
            Config.Trigger_Simple_Value2 = new byte[4] { 5, 0, 0, 0 }; // INT32 (5)
            Config.Trigger_Simple = true;

            Channels = new Channels(this,table);
            Waveform = new Waveform(this);
            Trigger = new Triggering(this);

            this.Reader = reader;

            _mGrabberTiming = new MicroStopwatch();

            TritonBase.PreExit += Stop;
        }
开发者ID:nlhans,项目名称:MemoryVision,代码行数:26,代码来源:Grabber.cs


示例16: Uninstall

 public bool Uninstall(Configuration.Config c)
 {
     c.Plugins.remove_plugin(this);
     c.Pipeline.RewriteDefaults -= Pipeline_RewriteDefaults;
     c.Pipeline.PostAuthorizeRequestStart -= Pipeline_PostAuthorizeRequestStart;
     return true;
 }
开发者ID:stukalin,项目名称:ImageResizer,代码行数:7,代码来源:CloudFrontPlugin.cs


示例17: SetUp

        public void SetUp()
        {
            eventStoreDbTest = new EventStoreDbTest();
            clockName = Any.CamelCaseName();

            Clock.Reset();

            disposables = new CompositeDisposable
            {
                Disposable.Create(() => eventStoreDbTest.TearDown()),
                Disposable.Create(Clock.Reset)
            };

            var bus = new FakeEventBus();
            orderRepository = new SqlEventSourcedRepository<Order>(bus);
            accountRepository = new SqlEventSourcedRepository<CustomerAccount>(bus);

            var configuration = new Configuration();
            configuration.UseEventBus(bus)
                         .UseDependency<IEventSourcedRepository<Order>>(t => orderRepository)
                         .UseDependency<IEventSourcedRepository<CustomerAccount>>(t => accountRepository);

            ConfigureScheduler(configuration);

            disposables.Add(ConfigurationContext.Establish(configuration));

            Console.WriteLine(new { clockName });

            clockTrigger = configuration.Container.Resolve<ISchedulerClockTrigger>();
            clockRepository = configuration.Container.Resolve<ISchedulerClockRepository>();
            clockRepository.CreateClock(clockName, Clock.Now());
        }
开发者ID:gitter-badger,项目名称:Its.Cqrs,代码行数:32,代码来源:SqlCommandSchedulerTests.cs


示例18: Install

 public IPlugin Install(Configuration.Config c)
 {
     this.c = c;
     c.Plugins.add_plugin(this);
     c.Pipeline.PreHandleImage += Pipeline_PreHandleImage;
     return this;
 }
开发者ID:stukalin,项目名称:ImageResizer,代码行数:7,代码来源:ClientCache.cs


示例19: RoleEnvironment_Changed

        void RoleEnvironment_Changed(object sender, RoleEnvironmentChangedEventArgs e)
        {
            try
            {
                foreach (var item in e.Changes.OfType<RoleEnvironmentTopologyChange>())
                {
                    if (item.RoleName == RoleEnvironment.CurrentRoleInstance.Role.Name)
                    {
                        // take any action needed on instance count modification; gracefully shrink etc
                    }
                }

                foreach (var item in e.Changes.OfType<RoleEnvironmentConfigurationSettingChange>())
                {
                    if (item.ConfigurationSettingName == "MBrace.ServiceBusConnectionString"
                        || item.ConfigurationSettingName == "MBrace.StorageConnectionString")
                    {
                        string storageConnectionString = CloudConfigurationManager.GetSetting("MBrace.StorageConnectionString");
                        string serviceBusConnectionString = CloudConfigurationManager.GetSetting("MBrace.ServiceBusConnectionString");
                        _config = new Configuration(storageConnectionString, serviceBusConnectionString);
                        _svc.Stop();
                        _svc.Configuration = _config;
                        _svc.Start();
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("MBrace.Azure.WorkerRole RoleEnvironment_Changed unhandled exception: {0}", ex);
                throw;
            }
        }
开发者ID:plmaheu,项目名称:MBrace.StarterKit,代码行数:32,代码来源:WorkerRole.cs


示例20: SetUp

        public void SetUp()
        {
            Clock.Reset();

            disposables = new CompositeDisposable
            {
                Disposable.Create(Clock.Reset)
            };

            schedule = GetScheduleDelegate();

            commandsScheduled = new ConcurrentBag<IScheduledCommand>();
            commandsDelivered = new ConcurrentBag<IScheduledCommand>();

            var configuration = new Configuration()
                .TraceScheduledCommands() // trace to console
                .TraceScheduledCommands(
                    onScheduling: _ => { },
                    onScheduled: c => commandsScheduled.Add(c),
                    onDelivering: _ => { },
                    onDelivered: c => commandsDelivered.Add(c));

            Configure(configuration, d => disposables.Add(d));

            disposables.Add(ConfigurationContext.Establish(configuration));
        }
开发者ID:commonsensesoftware,项目名称:Its.Cqrs,代码行数:26,代码来源:CommandSchedulerIdempotencyTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ConfigurationBuilder类代码示例发布时间:2022-05-24
下一篇:
C# ConfigurableBootstrapper类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap