Esempio n. 1
0
        // WorkerRoleMgr.cs
        // Main function to do work
        // this should call any subsequent
        // functions
        public static void DoWork()
        {
            // DFB: Get connection to Azure Storage table
            CloudTableClient cloudTableClient = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString")).CreateCloudTableClient();

            // DFB: create data factory to table
            AzureDataModelFactory dataModelFactory = new AzureDataModelFactory(cloudTableClient);

            // DFB: create data object
            // "AzureWorkerRole" means the worker role did the insert into the table
            AzureDataModel newWorkerRoleData = dataModelFactory.Create("AzureWorkerRole", DateTime.UtcNow);

            // DFB: add data to table
            dataModelFactory.Add(newWorkerRoleData);
        }