Presentation is loading. Please wait.

Presentation is loading. Please wait.

Niranjan Nilakantan Development Lead Microsoft Corporation Pablo Castro Software Architect Microsoft Corporation ES07.

Similar presentations


Presentation on theme: "Niranjan Nilakantan Development Lead Microsoft Corporation Pablo Castro Software Architect Microsoft Corporation ES07."— Presentation transcript:

1 Niranjan Nilakantan Development Lead Microsoft Corporation Pablo Castro Software Architect Microsoft Corporation ES07

2

3

4

5

6

7 Partition Key Document Row Key Version Property 3 ChangedOn Property 4 Description Examples DocV1.08/2/2007Committed version Examples DocV2.0.19/28/2007 Alices working version FAQ DocV1.05/2/2007Committed version FAQ DocV1.0.17/6/2007 Alices working version FAQ DocV1.0.28/1/2007 Sallys working version Partition 1 Partition 2

8

9 Partition Key Document Row Key Version Property 3 ChangedOn Property 4 Description Examples DocV1.08/2/2007Committed version Examples DocV2.0.19/28/2007 Alices working version FAQ DocV1.05/2/2007Committed version FAQ DocV1.0.17/6/2007 Alices working version FAQ DocV1.0.28/1/2007 Sallys working version Partition 1 Partition 2

10

11

12 Name – PK Updates Channels Name – PK Updates Channels Users Channel – PK PostedDate – RK Text Rating Channel – PK PostedDate – RK Text Rating Messages Name – PK Author CreatedDate Name – PK Author CreatedDate Channels

13

14 [DataServiceKey("PartitionKey", "RowKey")] public class Message { // ChannelName public string PartitionKey { get; set; } // PostedDate public string RowKey { get; set; } // User defined properties public string Text { get; set; } public int Rating { get; set; } }

15 Message message = new Message { PartitionKey = "Channel9", // ChannelName RowKey = DateTime.UtcNow.ToString(), // PostedDate Text = "Hello PDC", Rating = 3 }; serviceUri = new Uri("http://.table.core.windows.net"); var context = new DataServiceContext(serviceUri); context.AddObject("Messages", message); DataServiceContext response = context.SaveChanges();

16 POST Channel9 Oct-29 Hello PDC 3

17 [DataServiceKey("TableName")] public class TableStorageTable { public string TableName { get; set; } } TableStorageTable table = new TableStorageTable("Messages"); context.AddObject("Tables", table); DataServiceResponse response = context.SaveChanges(); // Service Uri is DataServiceContext context = new DataServiceContext(serviceUri);

18 serviceUri = new Uri("http://.table.core.windows.net"); DataServiceContext context = new DataServiceContext(serviceUri); var messages = from message in context.CreateQuery ("Messages") where message.Rating == 3 select message; foreach (Message message in messages) { } GET /Messages?$filter= Rating eq 3

19 Message message = (from message in context.CreateQuery ("Messages") where message.PartitionKey == "Channel9" && message.RowKey == "Oct-29" select message).FirstOrDefault(); message.Text = "Hi there"; context.UpdateObject(message); DataServiceResponse response = context.SaveChanges(); PUT /Messages(Channel9, Oct-29) Hi there

20 // Get the Message object for ("Channel9", "Oct-29") context.DeleteObject(message); DataServiceResponse response = context.SaveChanges(); DELETE Oct-29)

21

22

23

24

25 Client A ClientB 5 : Ch9, Jan-1, 3 1 : Ch9, Jan-2, 2 2: Ch9, Jan-2, 5 9 : Ch9, Jan-3, 6 If-Match: 1 Ch9, Jan-2, 5 If-Match: 1 Ch9, Jan-2, 4 VersionRating 1: Ch9, Jan-2, 4 1: Ch9, Jan-2, 5 Error: 412 2: Ch9, Jan-2, 5

26 serviceUri = new Uri("http://.table.core.windows.net"); DataServiceContext context = new DataServiceContext(serviceUri); var allMessages = context.CreateQuery ("Messages"); foreach (Message message in allMessages.Take(100)) { Console.WriteLine(message.Name); } GET /Messages?$top=100

27 GET /Messages?$filter=...&$top=100 &NextPartitionKey=Channel9 &NextRowKey=Date101 GET /Messages?$filter=...&$top=100 x-ms-continuation-NextPartitionKey: Channel9 x-ms-continuation-NextRowKey: Date101 x-ms-continuation-NextPartitionKey: Channel9 x-ms-continuation-NextRowKey: Date101 Messages Ch9, Date1, Ch9, Date2, Ch9, … Ch9,Date100, Ch9,Date101, Ch9, … 100

28

29

30 1. Dequeue DelCh12. Delete Ch1 from Channels3. Delete from Messages4. Delete queue entry Messages Channels Queue Worker Del Ch1 2 2 Delete channelDelete messages worker Front end Front End Del Ch5 Del Ch11 Ch1, Msg1 Ch1, Msg2 Ch1, Msg3 Ch2, Msg1 Ch2, Msg2 Ch3, Msg1 Ch1,… Ch2,… Del Ch1

31 1. Dequeue DelCh1 and start delete2. Fails after deleting Ch1 and Msg13. DelCh1 is visible again4. Dequeue DelCh1 again5. Repeat delete operations Messages Channels Queue Worker 1 Del Ch1 2 2 Delete channelDelete messages worker Front end Front End Del Ch5 Del Ch11 Ch1, Msg1 Ch1, Msg2 Ch1, Msg3 Ch2, Msg1 Ch2, Msg2 Ch3, Msg1 Ch1,… Ch2,… Worker2 Del Ch1 Del Ch1h

32

33

34

35 Please fill out your evaluation for this session at: This session will be available as a recording at:

36

37 © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

38


Download ppt "Niranjan Nilakantan Development Lead Microsoft Corporation Pablo Castro Software Architect Microsoft Corporation ES07."

Similar presentations


Ads by Google