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


C# GlobalConfiguration类代码示例

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


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

示例1: InitializeMembershipTable

        public async Task InitializeMembershipTable(GlobalConfiguration config, bool tryInitTableVersion, TraceLogger traceLogger)
        {
            logger = traceLogger;
            deploymentId = config.DeploymentId;

            if (logger.IsVerbose3) logger.Verbose3("SqlMembershipTable.InitializeMembershipTable called.");

            database = RelationalStorageUtilities.CreateGenericStorageInstance(config.AdoInvariant, config.DataConnectionString);

            //This initializes all of Orleans operational queries from the database using a well known view
            //and assumes the database with appropriate defintions exists already.
            queryConstants = await database.InitializeOrleansQueriesAsync();

            // even if I am not the one who created the table, 
            // try to insert an initial table version if it is not already there,
            // so we always have a first table version row, before this silo starts working.
            if(tryInitTableVersion)
            {
                var wasCreated = await InitTableAsync();
                if(wasCreated)
                {
                    logger.Info("Created new table version row.");
                }
            }
        }
开发者ID:sGussPlasmd,项目名称:orleans,代码行数:25,代码来源:SqlMembershipTable.cs

示例2: AzureGossipTableTests

        private AzureTableBasedGossipChannel gossipTable; // This type is internal

        public AzureGossipTableTests()
        {
            logger = LogManager.GetLogger("AzureGossipTableTests", LoggerType.Application);
        
            globalServiceId = Guid.NewGuid();
            deploymentId = "test-" + globalServiceId;

            IPAddress ip;
            if (!IPAddress.TryParse("127.0.0.1", out ip))
            {
                logger.Error(-1, "Could not parse ip address");
                return;
            }
            IPEndPoint ep1 = new IPEndPoint(ip, 21111);
            siloAddress1 = SiloAddress.New(ep1, 0);
            IPEndPoint ep2 = new IPEndPoint(ip, 21112);
            siloAddress2 = SiloAddress.New(ep2, 0);

            logger.Info("DeploymentId={0}", deploymentId);

            GlobalConfiguration config = new GlobalConfiguration
            {
                ServiceId = globalServiceId,
                ClusterId = "0",
                DeploymentId = deploymentId,
                DataConnectionString = TestDefaultConfiguration.DataConnectionString
            };

            gossipTable = new AzureTableBasedGossipChannel();
            var done = gossipTable.Initialize(config.ServiceId, config.DataConnectionString);
            if (!done.Wait(timeout))
            {
                throw new TimeoutException("Could not create/read table.");
            }
        }
开发者ID:jdom,项目名称:orleans,代码行数:37,代码来源:AzureGossipTableTests.cs

示例3: GetMembershipTable

        internal IMembershipTable GetMembershipTable(GlobalConfiguration.LivenessProviderType livenessType, string membershipTableAssembly = null)
        {
            IMembershipTable membershipTable;
            if (livenessType.Equals(GlobalConfiguration.LivenessProviderType.MembershipTableGrain))
            {
                membershipTable =
                    GrainReference.FromGrainId(Constants.SystemMembershipTableId).Cast<IMembershipTableGrain>();
            }
            else if (livenessType.Equals(GlobalConfiguration.LivenessProviderType.SqlServer))
            {
                membershipTable = AssemblyLoader.LoadAndCreateInstance<IMembershipTable>(Constants.ORLEANS_SQL_UTILS_DLL, logger);
            }
            else if (livenessType.Equals(GlobalConfiguration.LivenessProviderType.AzureTable))
            {
                membershipTable = AssemblyLoader.LoadAndCreateInstance<IMembershipTable>(Constants.ORLEANS_AZURE_UTILS_DLL, logger);
            }
            else if (livenessType.Equals(GlobalConfiguration.LivenessProviderType.ZooKeeper))
            {
                membershipTable = AssemblyLoader.LoadAndCreateInstance<IMembershipTable>(Constants.ORLEANS_ZOOKEEPER_UTILS_DLL, logger);
            }
            else if (livenessType.Equals(GlobalConfiguration.LivenessProviderType.Custom))
            {
                membershipTable = AssemblyLoader.LoadAndCreateInstance<IMembershipTable>(membershipTableAssembly, logger);
            }
            else
            {
                throw new NotImplementedException("No membership table provider found for LivenessType=" + livenessType);
            }

            return membershipTable;
        }
开发者ID:sbambach,项目名称:orleans,代码行数:31,代码来源:MembershipFactory.cs

示例4: Init

        /// <summary>
        /// Initialize current instance with specific global configuration and logger
        /// </summary>
        /// <param name="config"> Global configuration to initialize with </param>
        /// <param name="logger"> Specific logger to use in current instance </param>
        /// <returns></returns>
        public Task Init(GlobalConfiguration config, Logger logger)
        {
            deploymentId = config.DeploymentId;
            serviceId = config.ServiceId;

            this.logger = logger;

            storage = new DynamoDBStorage(config.DataConnectionStringForReminders, logger);
            logger.Info(ErrorCode.ReminderServiceBase, "Initializing AWS DynamoDB Reminders Table");

            var secondaryIndex = new GlobalSecondaryIndex
            {
                IndexName = SERVICE_ID_INDEX,
                Projection = new Projection { ProjectionType = ProjectionType.ALL },
                KeySchema = new List<KeySchemaElement>
                {
                    new KeySchemaElement { AttributeName = SERVICE_ID_PROPERTY_NAME, KeyType = KeyType.HASH},
                    new KeySchemaElement { AttributeName = GRAIN_HASH_PROPERTY_NAME, KeyType = KeyType.RANGE }
                }
            };

            return storage.InitializeTable(TABLE_NAME_DEFAULT_VALUE,
                new List<KeySchemaElement>
                {
                    new KeySchemaElement { AttributeName = REMINDER_ID_PROPERTY_NAME, KeyType = KeyType.HASH },
                    new KeySchemaElement { AttributeName = GRAIN_HASH_PROPERTY_NAME, KeyType = KeyType.RANGE }
                },
                new List<AttributeDefinition>
                {
                    new AttributeDefinition { AttributeName = REMINDER_ID_PROPERTY_NAME, AttributeType = ScalarAttributeType.S },
                    new AttributeDefinition { AttributeName = GRAIN_HASH_PROPERTY_NAME, AttributeType = ScalarAttributeType.N },
                    new AttributeDefinition { AttributeName = SERVICE_ID_PROPERTY_NAME, AttributeType = ScalarAttributeType.S }
                },
                new List<GlobalSecondaryIndex> { secondaryIndex });
        }
开发者ID:osjimenez,项目名称:orleans,代码行数:41,代码来源:DynamoDBReminderTable.cs

示例5: AnnotationsMetadataReader

        public AnnotationsMetadataReader(GlobalConfiguration globalCfg, PersistentClass pc)
        {
            this.globalCfg = globalCfg;
            this.pc = pc;

            _auditData = new ClassAuditingData();
        }
开发者ID:hazzik,项目名称:nhcontrib-all,代码行数:7,代码来源:AnnotationsMetadataReader.cs

示例6: Reminders_AzureTable_InsertNewRowAndReadBack

        public async Task Reminders_AzureTable_InsertNewRowAndReadBack()
        {
            log.Info(TestContext.TestName);

            string deploymentId = NewDeploymentId();
            IReminderTable table = new AzureBasedReminderTable();
            var config = new GlobalConfiguration()
            {
                ServiceId = ServiceId,
                DeploymentId = deploymentId,
                DataConnectionString = StorageTestConstants.DataConnectionString
            };
            await table.Init(config, log);

            ReminderEntry[] rows = (await GetAllRows(table)).ToArray();
            Assert.AreEqual(0, rows.Count(), "The reminder table (sid={0}, did={1}) was not empty.", ServiceId, deploymentId);

            ReminderEntry expected = NewReminderEntry();
            await table.UpsertRow(expected);
            rows = (await GetAllRows(table)).ToArray();

            Assert.AreEqual(1, rows.Count(), "The reminder table (sid={0}, did={1}) did not contain the correct number of rows (1).", ServiceId, deploymentId);
            ReminderEntry actual = rows[0];
            Assert.AreEqual(expected.GrainRef, actual.GrainRef, "The newly inserted reminder table (sid={0}, did={1}) row did not contain the expected grain reference.", ServiceId, deploymentId);
            Assert.AreEqual(expected.ReminderName, actual.ReminderName, "The newly inserted reminder table (sid={0}, did={1}) row did not have the expected reminder name.", ServiceId, deploymentId);
            Assert.AreEqual(expected.Period, actual.Period, "The newly inserted reminder table (sid={0}, did={1}) row did not have the expected period.", ServiceId, deploymentId);
            // the following assertion fails but i don't know why yet-- the timestamps appear identical in the error message. it's not really a priority to hunt down the reason, however, because i have high confidence it is working well enough for the moment.
            /*Assert.AreEqual(expected.StartAt, actual.StartAt, "The newly inserted reminder table (sid={0}, did={1}) row did not contain the correct start time.", ServiceId, deploymentId);*/
            Assert.IsFalse(string.IsNullOrWhiteSpace(actual.ETag), "The newly inserted reminder table (sid={0}, did={1}) row contains an invalid etag.", ServiceId, deploymentId);
        }
开发者ID:sbambach,项目名称:orleans,代码行数:30,代码来源:ReminderTests_Azure_Standalone.cs

示例7: Init

 public async Task Init(GlobalConfiguration config, TraceLogger logger)
 {
     serviceId = config.ServiceId.ToString();
     deploymentId = config.DeploymentId;
     database = RelationalStorageUtilities.CreateGenericStorageInstance(config.AdoInvariantForReminders,
         config.DataConnectionStringForReminders);
     queryConstants = await database.InitializeOrleansQueriesAsync();
 }
开发者ID:JackWangCUMT,项目名称:orleans,代码行数:8,代码来源:SqlReminderTable.cs

示例8: GrainDirectoryHandoffManager

 internal GrainDirectoryHandoffManager(LocalGrainDirectory localDirectory, GlobalConfiguration config)
 {
     logger = TraceLogger.GetLogger(this.GetType().FullName);
     this.localDirectory = localDirectory;
     directoryPartitionsMap = new Dictionary<SiloAddress, GrainDirectoryPartition>();
     silosHoldingMyPartition = new List<SiloAddress>();
     lastPromise = new Dictionary<SiloAddress, Task>();
 }
开发者ID:sbambach,项目名称:orleans,代码行数:8,代码来源:GrainDirectoryHandoffManager.cs

示例9: SqlReminderTable

 public SqlReminderTable(GlobalConfiguration config)
 {
     serviceId = config.ServiceId.ToString();
     deploymentId = config.DeploymentId;
     
     //TODO: Orleans does not yet provide the type of database used (to, e.g., to load dlls), so SQL Server is assumed.
     database = RelationalStorageUtilities.CreateGenericStorageInstance(WellKnownRelationalInvariants.SqlServer, config.DataConnectionString);
 }
开发者ID:taoliseki,项目名称:orleans,代码行数:8,代码来源:SqlReminderTable.cs

示例10: GlobalSingleInstanceActivationMaintainer

        internal GlobalSingleInstanceActivationMaintainer(LocalGrainDirectory router, Logger logger, GlobalConfiguration config)
        {
            this.router = router;
            this.logger = logger;
            this.period = config.GlobalSingleInstanceRetryInterval;
            logger.Verbose("GSIP:M GlobalSingleInstanceActivationMaintainer Started, Period = {0}", period);

        }
开发者ID:osjimenez,项目名称:orleans,代码行数:8,代码来源:GlobalSingleInstanceActivationMaintainer.cs

示例11: DeploymentLoadPublisher

 public DeploymentLoadPublisher(Silo silo, GlobalConfiguration config)
     : base(Constants.DeploymentLoadPublisherSystemTargetId, silo.SiloAddress)
 {
     this.silo = silo;
     statisticsRefreshTime = config.DeploymentLoadPublisherRefreshTime;
     periodicStats = new ConcurrentDictionary<SiloAddress, SiloRuntimeStatistics>();
     siloStatisticsChangeListeners = new List<ISiloStatisticsChangeListener>();
 }
开发者ID:jdom,项目名称:orleans,代码行数:8,代码来源:DeploymentLoadPublisher.cs

示例12: FileBasedProjectConfiguration

        public FileBasedProjectConfiguration(FileSystem fileSystem, GlobalConfiguration globalConfiguration, NuConventions conventions)
            : base(fileSystem, GetFile(fileSystem, conventions))
        {
            _globalConfiguration = globalConfiguration;
            _conventions = conventions;

            OnMissing = GetGlobalConfigurationValue;
        }
开发者ID:wbinford,项目名称:nu,代码行数:8,代码来源:FileBasedProjectConfiguration.cs

示例13: Initialize

 internal static void Initialize(GlobalConfiguration config = null)
 {
     InitializeStrategies();
     var strategy = config == null
         ? GlobalConfiguration.DEFAULT_MULTICLUSTER_REGISTRATION_STRATEGY
         : config.DefaultMultiClusterRegistrationStrategy;
     defaultStrategy = GetStrategy(strategy);
 }
开发者ID:PaulNorth,项目名称:orleans,代码行数:8,代码来源:MultiClusterRegistrationStrategy.cs

示例14: Initialize

        internal static void Initialize(GlobalConfiguration config)
        {
            InitializeStrategies();

            if (config.HasMultiClusterNetwork && config.UseGlobalSingleInstanceByDefault)
                defaultStrategy = GlobalSingleInstanceRegistration.Singleton;
            else
                defaultStrategy = ClusterLocalRegistration.Singleton;    
        }
开发者ID:osjimenez,项目名称:orleans,代码行数:9,代码来源:MultiClusterRegistrationStrategy.cs

示例15: Init

 private void Init()
 {
     Globals = new GlobalConfiguration();
     Defaults = new NodeConfiguration();
     Overrides = new Dictionary<string, NodeConfiguration>();
     overrideXml = new Dictionary<string, string>();
     SourceFile = "";
     IsRunningAsUnitTest = false;
 }
开发者ID:sbambach,项目名称:orleans,代码行数:9,代码来源:ClusterConfiguration.cs


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