Creating entity and related entity

Dec 13, 2010 at 9:02 PM

Hi,

According to the odata spec, http://www.odata.org/developers/protocols/operations#CreatingnewEntries a client should be able to create multiple related entities in a single post. In our scenario we have a user entity that has a one to one relationship with a userdetail entity, i.e. the user entity has a navigation propery called UserDetail. The user entity is principal and the userdetail entity is dependent in the relationship(i.e. the id property of the user entity is also the id property of the userdetail entity). In a JSON formatted post we're able to create the user entity and user detail entity by seneding the following JSON data:

{"FirstName":"Max","LastName":"Eriksson","Email":"max1292277426000@bello.se","UserDetail":{"Password":"qazxsw"},"RoleId":100}

The server the correclyt creates the user AND userdetail entity. How can we get the same result using the objective-c library?

BR, Max 

Dec 17, 2010 at 11:55 PM

Are you asking how to do this using the Objective-C library? You first need to create your entities locally on the client in an ObjectContext, then call saveChanges.