已答复 Not having duplicates in Azure Tables?

  • 2012年6月26日 23:00
     
     

    If I have one object, 'Student', which will be associated with 2 'Course' objects, I think I need to add the student to azure tables first with a partitionkey of 'Class1_Student1', and then again with 'Class2_Student1'.

    My understanding is that I would then have duplicate student objects, just with different partitionkeys.

    What I would like is to add a Student and point it to multiple classes, where if I ask for that student I get the same object.  Or a way to check before adding if this student exists and if so reuse the existing object.

    What's the best way to accomplish this?  Or does needing this functionality suggest I should be looking towards SQL Azure?

全部回复

  • 2012年6月27日 5:35
     
     已答复

    Hi,

    Azure tables identify unique rows with the combination of Partition key and row key.Hence you can make use of both partition key and row key to identify unique rows as well as there is no need for the duplication of “Student” object.

    Example:

     

    Partition Key

    Row Key

    Mark1

    Mark2

    Student1

    Class1

    ###

    ###

    Student1

    Class2

    @@@

    @@

    Student2

    Class1

    ^^

    ^^

    Please note that the combination of row key and partition key is unique and cannot be duplicated.

     More information please visit:

    http://www.windowsazure.com/en-us/develop/net/how-to-guides/table-services/

    http://blogs.msdn.com/b/jnak/archive/2008/10/28/walkthrough-simple-table-storage.aspx

    ------------------------------------------------------------------------------------------------------------------

    I hope it helps!! If you found this post useful, Please "Mark as answer" or "Vote as Helpful".

    Thanks!

    VIJAY.