Răspuns Setting metadata properties to entities

  • 2 martie 2009 12:49
     
     

    I am trying to create an entity in SDS of 'Employee' knid. Followig is the statement. When i am executing this, it is throwing an error saying that "Invalid Entity definition.  The metadata property 'Kind' is unknown".

    @"<Book xmlns:s='http://schemas.microsoft.com/sitka/2008/03/'
                             xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
                             xmlns:x='http://www.w3.org/2001/XMLSchema' >
                         <s:Id>1</s:Id>
                         <s:Kind>Employee</s:Kind>  
                         <title xsi:type='x:string'>Microsoft</title>
                     </Book>";

    I understand that this meatadata property is needed to apply joins accross entities which are stored in the same container. Please let me know if i am missing anything

    • Mutat de Steve Marx 2 martie 2009 18:09 (Moved from Windows Azure to SQL Data Services (SDS) - Getting Started)
    •  

Toate mesajele

  • 3 martie 2009 07:24
     
     
    Hi Vijay,

    I have modified this xml for  'Employee' kind and cheked with sds explorer.  In this way you can assign kind while creating entity in SDS.


    @"<Employee xmlns:s='http://schemas.microsoft.com/sitka/2008/03/'

    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'

    xmlns:x='http://www.w3.org/2001/XMLSchema' >

    <s:Id>1</s:Id>

    <title xsi:type='x:string'>Microsoft</title>

    </Employee>"

  • 3 martie 2009 17:35
     
     Răspuns

    The root tag name provides the Kind metadata property values. Here is another example, when using SDS Explorer, the default XML for entity looks as follows:

    <s:Entity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:x="http://www.w3.org/2001/XMLSchema"
                 xmlns:s="http://schemas.microsoft.com/sitka/2008/03/">
       <s:Id>SomeGUID</s:Id>
    </s:Entity>

    In this case, "Entity" is the default kind. If you change this to some other kind ("myKind" in the following example), note the namespace prefix is not added.

    <myKind xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                 xmlns:x="http://www.w3.org/2001/XMLSchema"
                 xmlns:s="http://schemas.microsoft.com/sitka/2008/03/">
       <s:Id>59e491d8-ddf6-41cd-9b97-370a9ca5bdb9</s:Id>
    </myKind>


    Mohan.Vanmane at Microsoft.com