Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Introducing Windows Azure- P19: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 userTableService.Insert user as User Listing2-26. Recursively Loop the Embedded Entity Object to Insert a Relational Data Set to Cloud Storage Tables 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 CloudTableServiceFactory cloudTableFactory new CloudTableServiceFactory cloudTableFactory.FactoryCloudTableService dependency .Insert dependency dependency dependency.GetDependencyEntity success true catch return success To delete a set of relational data entities from cloud table storage a parent entity object is responsible for passing the partition key that is the RowKey of the child record. The list of dependency entities is the one we built up when constructing each entity instance . The highlighted lines from Listing 2-27 show how to accomplish this task. Listing2-27. Recursively Loop the Embedded Entity Object to Delete a Relational Data Set virtual public bool Delete ICloudEntity entity bool success false foreach ICloudEntity entityType in entity.DependencyType ICloudEntity dependency QueryDependencyEntity entityType entity as TableStorageEntity .RowKey 63 CHAPTER 2 ACCESS CLOUD TABLE STORAGE if null dependency cloudTableFactory.FactoryCloudTableService dependency .Delete dependency try dataTableContext.AttachTo dataTableContext.TableName entity dataTableContext.DeleteObject entity dataTableContext.SaveChanges success true catch return success The implementation for the Update method is relatively simple as shown in Listing 2-28. It is just a combination call to the Delete and Insert methods based upon the strategy updating cloud storage data in buckets. Listing 2-28. Updating Relational Entities in Buckets virtual public bool Update ICloudEntity entity bool success false try if Delete entity success Insert entity catch return .