Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement missing APIs from ChangeTacker/Entry #2295

Closed
rowanmiller opened this issue May 29, 2015 · 3 comments
Closed

Implement missing APIs from ChangeTacker/Entry #2295

rowanmiller opened this issue May 29, 2015 · 3 comments
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@rowanmiller
Copy link
Contributor

We do not have all APIs that we historically had available:

  • GetModifiedProperties
  • Reload
  • etc.
@NullVoxPopuli
Copy link

👍 I think I need Reload, too

@shobman
Copy link

shobman commented May 14, 2016

+1 for Reload

@ajcvickers ajcvickers self-assigned this Jul 8, 2016
ajcvickers added a commit that referenced this issue Aug 19, 2016
Likewise for members, navigations, references, collections.

Issues #2295 and #2245

The issue here is that it is quite common to want to do something for all property entries for a given entity. In the question asked by the customer this was to get the modified state. This was always possible but required two steps:
- Use metadata APIs to find all the Properties
- Loop/query over this metadata getting entries

So Rowan's code looked liked this:
```C#
var entry = context.Entry(myEntity);
var propertyNames = entry.Metadata.GetProperties().Select(p => p.Name);
var modifiedEntries = propertyNames.Select(p => entry.Property(p)).Where(e => e.IsModified);
```

With these new APIs the metadata and entry steps are combined for you so you would now write this:
```C#
var modifiedEntries = context.Entry(myEntity).Properties.Where(e => e.IsModified);
```
ajcvickers added a commit that referenced this issue Aug 22, 2016
Likewise for members, navigations, references, collections.

Issues #2295 and #2245

The issue here is that it is quite common to want to do something for all property entries for a given entity. In the question asked by the customer this was to get the modified state. This was always possible but required two steps:
- Use metadata APIs to find all the Properties
- Loop/query over this metadata getting entries

So Rowan's code looked liked this:
```C#
var entry = context.Entry(myEntity);
var propertyNames = entry.Metadata.GetProperties().Select(p => p.Name);
var modifiedEntries = propertyNames.Select(p => entry.Property(p)).Where(e => e.IsModified);
```

With these new APIs the metadata and entry steps are combined for you so you would now write this:
```C#
var modifiedEntries = context.Entry(myEntity).Properties.Where(e => e.IsModified);
```
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Aug 22, 2016
@ajcvickers ajcvickers modified the milestones: 1.1.0, Backlog Aug 22, 2016
@ajcvickers
Copy link
Contributor

GetModifiedProperties issue resolved with commit above. Reload is being tracked by #1203

@ajcvickers ajcvickers modified the milestones: 1.1.0-preview1, 1.1.0 Oct 15, 2022
@ajcvickers ajcvickers removed their assignment Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

No branches or pull requests

4 participants