本文整理汇总了C#中ClientConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# ClientConfiguration类的具体用法?C# ClientConfiguration怎么用?C# ClientConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClientConfiguration类属于命名空间,在下文中一共展示了ClientConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldBeInvalidIfUserNameIsNull
public void ShouldBeInvalidIfUserNameIsNull()
{
ClientConfiguration configuration = new ClientConfiguration() { Password = "password", Host = "smtp.google.com", Port = 445, Ssl = true };
ErrorList errors = configuration.Validate();
Assert.AreEqual(1, errors.Count);
Assert.AreEqual("UserName can't be blank", errors[0].ToString());
}
示例2: ShouldBeInvalidIfHostIsNull
public void ShouldBeInvalidIfHostIsNull()
{
ClientConfiguration configuration = new ClientConfiguration() { UserName = "user", Password = "password", Port = 445, Ssl = true };
ErrorList errors = configuration.Validate();
Assert.AreEqual(1, errors.Count);
Assert.AreEqual("Host can't be blank", errors[0].ToString());
}
示例3: Main
static void Main(string[] args)
{
Console.WriteLine("Start");
var config = new ClientConfiguration()
.LoadFromEmbeddedResource(typeof(Program), "Client.xml");
var system = ActorSystem.Configure()
.Client()
.From(config)
.Register(typeof(ActorWithReminder).Assembly)
.Done();
Console.WriteLine("Started");
while (true)
{
Console.WriteLine("Press c key to check reminder or r to register");
var k = Console.ReadKey();
if (k.KeyChar == 'c')
{
system.ActorOf<ActorWithReminder>("Any").Ask<bool>(new CheckReminder())
.ContinueWith(p => Console.WriteLine("Reminder check result: {0}", p.Result));
}
if (k.KeyChar == 'r')
{
system.ActorOf<ActorWithReminder>("Any").Tell(new InitReminder())
.ContinueWith(p => Console.WriteLine("Reminder init result: {0}", p.Status));
}
}
}
示例4: SetRootDomains
public static void SetRootDomains()
{
const string accessId = "<your access id>";
const string accessKey = "<your access key>";
const string endpoint = "<valid host name>";
try
{
var conf = new ClientConfiguration();
var domainList = conf.RootDomainList;
foreach (var domain in domainList)
{
Console.WriteLine(domain);
}
Console.WriteLine("\nafter modifed: ");
var domains = new List<string> {".alibaba-inc.com", ".aliyuncs.gd"};
conf.RootDomainList = domains;
foreach (string domain in conf.RootDomainList)
{
Console.WriteLine(domain);
}
var client = new OssClient(new Uri(endpoint), accessId, accessKey, conf);
}
catch (OssException ex)
{
Console.WriteLine("Failed with error code: {0}; Error info: {1}. \nRequestID:{2}\tHostID:{3}",
ex.ErrorCode, ex.Message, ex.RequestId, ex.HostId);
}
catch (Exception ex)
{
Console.WriteLine("Failed with error info: {0}", ex.Message);
}
}
示例5: CreateGatewayListProvider
internal static async Task<IGatewayListProvider> CreateGatewayListProvider(ClientConfiguration cfg)
{
IGatewayListProvider listProvider = null;
ClientConfiguration.GatewayProviderType gatewayProviderToUse = cfg.GatewayProviderToUse;
switch (gatewayProviderToUse)
{
case ClientConfiguration.GatewayProviderType.AzureTable:
listProvider = AssemblyLoader.LoadAndCreateInstance<IGatewayListProvider>(Constants.ORLEANS_AZURE_UTILS_DLL, logger);
break;
case ClientConfiguration.GatewayProviderType.SqlServer:
listProvider = AssemblyLoader.LoadAndCreateInstance<IGatewayListProvider>(Constants.ORLEANS_SQL_UTILS_DLL, logger);
break;
case ClientConfiguration.GatewayProviderType.Custom:
listProvider = AssemblyLoader.LoadAndCreateInstance<IGatewayListProvider>(cfg.CustomGatewayProviderAssemblyName, logger);
break;
case ClientConfiguration.GatewayProviderType.ZooKeeper:
listProvider = AssemblyLoader.LoadAndCreateInstance<IGatewayListProvider>(Constants.ORLEANS_ZOOKEEPER_UTILS_DLL, logger);
break;
case ClientConfiguration.GatewayProviderType.Config:
listProvider = new StaticGatewayListProvider();
break;
default:
throw new NotImplementedException(gatewayProviderToUse.ToString());
}
await listProvider.InitializeGatewayListProvider(cfg, LogManager.GetLogger(listProvider.GetType().Name));
return listProvider;
}
示例6: ShouldBeAbleToSaveTheConfigurationToFile
public void ShouldBeAbleToSaveTheConfigurationToFile()
{
ClientConfiguration configuration = new ClientConfiguration();
configuration.Save(configurationFileName);
Assert.IsTrue(File.Exists(configurationFileName));
File.Delete(configurationFileName);
}
示例7: AzureQueueDataManagerTests
public AzureQueueDataManagerTests()
{
ClientConfiguration config = new ClientConfiguration();
config.TraceFilePattern = null;
TraceLogger.Initialize(config);
logger = TraceLogger.GetLogger("AzureQueueDataManagerTests", TraceLogger.LoggerType.Application);
}
示例8: InitializeGatewayListProvider
public Task InitializeGatewayListProvider(ClientConfiguration config, TraceLogger traceLogger)
{
deploymentId = config.DeploymentId;
connectionString = config.DataConnectionString;
maxStaleness = config.GatewayListRefreshPeriod;
return TaskDone.Done;
}
示例9: GatewaySelection_ClientInit_EmptyList
public void GatewaySelection_ClientInit_EmptyList()
{
var cfg = new ClientConfiguration();
cfg.Gateways = null;
bool failed = false;
try
{
GrainClient.Initialize(cfg);
}
catch (Exception exc)
{
output.WriteLine(exc.ToString());
failed = true;
}
Assert.IsTrue(failed, "GatewaySelection_EmptyList failed as GatewayManager did not throw on empty Gateway list.");
// Note: This part of the test case requires a silo local to be running in order to work successfully.
//var listProvider = new TestListProvider(gatewayAddressUris);
//cfg.Gateways = listProvider.GetGateways().Select(uri =>
//{
// return new IPEndPoint(IPAddress.Parse(uri.Host), uri.Port);
//}).ToList();
//Client.Initialize(cfg);
}
示例10: GetClientEndpoint
private void GetClientEndpoint()
{
var clientFactory = new ClientFactory();
var clientConfig = new ClientConfiguration();
clientConfig.MaxSessions = 10;
client = clientFactory.MakeNew(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 3000), clientConfig);
}
示例11: ProxiedMessageCenter
public ProxiedMessageCenter(ClientConfiguration config, IPAddress localAddress, int gen, GrainId clientId, IGatewayListProvider gatewayListProvider)
{
lockable = new object();
MyAddress = SiloAddress.New(new IPEndPoint(localAddress, 0), gen);
ClientId = clientId;
Running = false;
MessagingConfiguration = config;
GatewayManager = new GatewayManager(config, gatewayListProvider);
PendingInboundMessages = new RuntimeQueue<Message>();
gatewayConnections = new Dictionary<Uri, GatewayConnection>();
numMessages = 0;
grainBuckets = new WeakReference[config.ClientSenderBuckets];
logger = TraceLogger.GetLogger("Messaging.ProxiedMessageCenter", TraceLogger.LoggerType.Runtime);
if (logger.IsVerbose) logger.Verbose("Proxy grain client constructed");
IntValueStatistic.FindOrCreate(StatisticNames.CLIENT_CONNECTED_GATEWAY_COUNT, () =>
{
lock (gatewayConnections)
{
return gatewayConnections.Values.Count(conn => conn.IsLive);
}
});
if (StatisticsCollector.CollectQueueStats)
{
queueTracking = new QueueTrackingStatistic("ClientReceiver");
}
}
示例12: OAuth2Client
/// <summary>
/// Initializes a new instance of <c>OAuth2Client</c>.
/// </summary>
/// <param name="configuration">The configuration.</param>
/// <exception cref="ArgumentNullException"><paramref name="configuration"/> was <see langword="null"/>.</exception>
public OAuth2Client(ClientConfiguration configuration)
{
if (null == configuration)
throw new ArgumentNullException("configuration");
this.Configuration = configuration;
}
示例13: Connect
public async Task<bool> Connect()
{
SpiderLogger.Info("------------------启动 Orleans Client.------------------");
try
{
if (!Orleans.GrainClient.IsInitialized)
{
ClientConfiguration config = new ClientConfiguration();
config.GatewayProvider = ClientConfiguration.GatewayProviderType.Config;
IPEndPoint ip=new IPEndPoint(IPAddress.Parse("127.0.0.1"),30000);
config.Gateways.Add(ip);
config.StatisticsMetricsTableWriteInterval = TimeSpan.FromSeconds(30);
config.StatisticsLogWriteInterval = TimeSpan.FromSeconds(300);
config.StatisticsWriteLogStatisticsToTable = false;
config.StatisticsPerfCountersWriteInterval = TimeSpan.FromSeconds(30);
Orleans.GrainClient.Initialize(config);
}
IServices server = GrainClient.GrainFactory.GetGrain<IServices>(Guid.NewGuid());
return await server.ConnectToServer(Dns.GetHostName());
}
catch (Exception ex)
{
SpiderLogger.Error("启动 Orleans Client 失败." + ex.Message+"\r\n");
SpiderLogger.Error(ex.StackTrace);
return false;
}
}
示例14: InitializeAgatha
private static void InitializeAgatha()
{
var config = new ClientConfiguration(typeof(HelloWorldRequest).Assembly, typeof(Ninject.Container))
{
CacheManagerImplementation = typeof(InvalidatingCacheManager)
};
config.Initialize();
}
示例15: ClientConfiguration
public ClientConfiguration(ClientConfiguration existing)
: this(apiKey: existing?.ApiKey,
cacheManager: existing?.CacheManager,
baseUrl: existing?.BaseUrl,
connectionTimeout: existing?.ConnectionTimeout,
authenticationScheme: existing?.AuthenticationScheme,
proxy: existing?.Proxy)
{
}