Retrieving ID from a new entry in RIA services

I saw a lot of articles about getting the ID of the new created record using other databases and frameworks. I am creating a code entry in a Silverlight RIA Services application. I execute the Add method and then do SubmitChanges in the DomainContext, but I do not see the identifier. It appears as 0. How do I get a new identifier? Thank.

+3
source share
1 answer

try it

private void OnProfileCreateCallback(SubmitOperation submitOperation)
        {
          submitOperation.ChangeSet.AddedEntities.First().GetIdentity()
        ....
        }

OnProfileCreateCallback is a callback method used in the context of .submitchanges (...)

You can put custom logic if you have multiple entries as part of the add.

+2
source

All Articles