In order to obtain the Id
of an object you are about to insert you would need to flush the changes to the database. You could do that using the .FlushChanges()
method available through a Telerik Data Access
context. Once you call .FlushChanges()
ids of objects added to the context will be populated. At this point your queries should return the correct result. You could read more on how to handle transactions through a Telerik Data Access
context in this documentation article
Additionally, if you would like to use this functionality to manage associations between your tables you have to know that Telerik Data Access
could manage them automatically for you. To take advantage of this feature you need to enable the .IsManaged
property of the collection navigational property. You could do that through the Visual Designer
by selecting the navigational property and pressing F4
then from the properties windows that should have shown, setting the Is Managed
. For more detailed explanation on this feature please refer to this documentation article
If this is actually not what you need, could you please provide a bit more information on your implementation scenario? Also please provide the entire code snippet that demonstrates this behavior.
Do not hesitate to contact us with any further questions.
OpenAccess ORM is now Telerik Data Access
. For more information on the new names, please, check out the Telerik Product Map