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


C# ClientConfiguration类代码示例

本文整理汇总了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());
 }
开发者ID:jskswamy,项目名称:ConsoleMailer,代码行数:7,代码来源:ClientConfigurationTest.cs

示例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());
 }
开发者ID:jskswamy,项目名称:ConsoleMailer,代码行数:7,代码来源:ClientConfigurationTest.cs

示例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));
                }

            }
        }
开发者ID:zloom,项目名称:Orleankka,代码行数:34,代码来源:Program.cs

示例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);
            }
        }
开发者ID:bys-james-shi,项目名称:OpenSource,代码行数:35,代码来源:CNameSample.cs

示例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;
        }
开发者ID:Rejendo,项目名称:orleans,代码行数:34,代码来源:GatewayProviderFactory.cs

示例6: ShouldBeAbleToSaveTheConfigurationToFile

 public void ShouldBeAbleToSaveTheConfigurationToFile()
 {
     ClientConfiguration configuration = new ClientConfiguration();
     configuration.Save(configurationFileName);
     Assert.IsTrue(File.Exists(configurationFileName));
     File.Delete(configurationFileName);
 }
开发者ID:jskswamy,项目名称:ConsoleMailer,代码行数:7,代码来源:ClientConfigurationTest.cs

示例7: AzureQueueDataManagerTests

 public AzureQueueDataManagerTests()
 {
     ClientConfiguration config = new ClientConfiguration();
     config.TraceFilePattern = null;
     TraceLogger.Initialize(config);
     logger = TraceLogger.GetLogger("AzureQueueDataManagerTests", TraceLogger.LoggerType.Application);
 }
开发者ID:stanroze,项目名称:orleans,代码行数:7,代码来源:AzureQueueDataManagerTests.cs

示例8: InitializeGatewayListProvider

 public Task InitializeGatewayListProvider(ClientConfiguration config, TraceLogger traceLogger)
 {
     deploymentId = config.DeploymentId;
     connectionString = config.DataConnectionString;
     maxStaleness = config.GatewayListRefreshPeriod;
     return TaskDone.Done;
 }
开发者ID:stanroze,项目名称:orleans,代码行数:7,代码来源:SqlMembershipTable.cs

示例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);
        }
开发者ID:caomw,项目名称:orleans,代码行数:25,代码来源:GatewaySelectionTest.cs

示例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);
 }
开发者ID:Zyruis11,项目名称:netSharp,代码行数:7,代码来源:Program.cs

示例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");
     }
 }
开发者ID:NingnaD,项目名称:orleans,代码行数:26,代码来源:ProxiedMessageCenter.cs

示例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;
        }
开发者ID:nodoubt223rd,项目名称:simpleoauth.net,代码行数:12,代码来源:client.cs

示例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;

            }           
        }
开发者ID:svenliao,项目名称:scrapy.sscq,代码行数:30,代码来源:OrleansClient.cs

示例14: InitializeAgatha

 private static void InitializeAgatha()
 {
     var config = new ClientConfiguration(typeof(HelloWorldRequest).Assembly, typeof(Ninject.Container))
                      {
                          CacheManagerImplementation = typeof(InvalidatingCacheManager)
                      };
     config.Initialize();
 }
开发者ID:joakes,项目名称:Hello-Agatha,代码行数:8,代码来源:Program.cs

示例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)
 {
 }
开发者ID:stormpath,项目名称:stormpath-dotnet-config,代码行数:9,代码来源:ClientConfiguration.cs


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