Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Introducing Windows Azure- P17:The cloud platform is getting more and more attractive to the computing world. Today, service-oriented architecture (SOA) and aspect-oriented programming (AOP) techniques are widely used in enterprise solutions. A question an IT management team or a software development team may ask is, what is the next trend going to be? Cloud computing seems to be the right answer. | CHAPTER 2 ACCESS CLOUD TABLE STORAGE namespace CloudTableStorageService WebRole.CloudTableStorageDataService using Microsoft.Samples.ServiceHosting.StorageClient using CloudTableStorageService WebRole.CloudTableStorageDataContext using CloudTableStorageService WebRole.CloudTableStrorageDataEntity abstract public class DataTableService ICloudTableStorageService protected StorageAccountInfo account null protected TableContext dataTableContext null protected CloudTableServiceFactory cloudTableFactory new CloudTableServiceFactory public DataTableService Get the settings from the Service Configuration file account StorageAccountInfo.GetDefaultTableStorageAccountFromConfiguration cloudTableFactory new CloudTableServiceFactory public TableContext TableContext return dataTableContext virtual public bool Insert ICloudEntity entity bool success false ICloudEntity dependency null try dataTableContext.AddObject dataTableContext.TableName entity dataTableContext.SaveChanges dependency entity.GetDependencyEntity while null dependency cloudTableFactory new CloudTableServiceFactory cloudTableFactory.FactoryCloudTableService dependency .Insert dependency dependency dependency.GetDependencyEntity success true catch return success virtual public bool Update ICloudEntity entity 53 CHAPTER 2 ACCESS CLOUD TABLE STORAGE bool success false if null entity dataTableContext.MergeOption MergeOption.PreserveChanges dataTableContext.AttachTo dataTableContext.TableName entity dataTableContext.UpdateObject entity dataTableContext.SaveChanges success true return success virtual public bool Delete ICloudEntity entity bool success false if null entity foreach ICloudEntity entityType in entity.DependencyType ICloudEntity dependency QueryDependencyEntity entityType entity as TableStorageEntity .RowKey if null dependency cloudTableFactory.FactoryCloudTableService dependency .Delete dependency try dataTableContext.AttachTo dataTableContext.TableName entity dataTableContext.DeleteObject entity .