本文整理汇总了C#中Configuration类的典型用法代码示例。如果您正苦于以下问题:C# Configuration类的具体用法?C# Configuration怎么用?C# Configuration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Configuration类属于命名空间,在下文中一共展示了Configuration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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");
}
示例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);
});
}
示例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);
}
示例6: BulkLoader
protected BulkLoader(Configuration.Configuration config)
{
_jobs = new JobList();
_jobs.RowsInserted += (s, e) => OnRowsInserted(e);
Config = config;
DefaultSchema = "dbo";
}
示例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 = "Не все поля заполнены!";
}
}
示例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;
}
}
示例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));
}
示例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();
}
}
}
示例11: AddLoquaciousMappings
static Configuration AddLoquaciousMappings(Configuration nhConfiguration)
{
ModelMapper mapper = new ModelMapper();
mapper.AddMappings(typeof(OrderSagaDataLoquacious).Assembly.GetTypes());
nhConfiguration.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());
return nhConfiguration;
}
示例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());
}
示例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());
}
示例14: GetUserInfoById
public UserInfo GetUserInfoById(int userId)
{
Configuration cfg = new Configuration().Configure(path);
ISession session = cfg.BuildSessionFactory().OpenSession();
return session.Get<UserInfo>(userId);
}
示例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;
}