How does one reload an Entity in a Microsoft.OData

2019-08-26 18:52发布

问题:

EF/EFCore:

When working with a DbContext, one can ready pull up the entry and ask EF or EFCore to Reload it from source using the following syntax:

dc.Entry(entity).Reload();

or

await dc.Entry(entity).ReloadAsync();

Above, dc is an instance of a class derived from DbContext and with DbSet<> properties. Entity is an instance managed by dc and belonging to a DbSet.

OData:

I tried to do something similar with the EntityDescriptor in the OData client but there doesn't seem to be an equivalent direct or extension method that does this. Is there a workaround? Or does this look right but with the wrong method?

dc.GetEntityDescriptor(entity).Reload();

or

await dc.GetEntityDescriptor(entity).ReloadAsync();

Can anyone help please?

标签: rest odata