You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
External disconnected entity change tracking system to interact with EF-server #8744
I'd want the entire metadata and tracking system in EF to be extracted to an external non-EF dependent assembly, so to allow change-tracking and interaction with the EF-enabled-server from a non-EF client.
There should also be a minimized graph that efficiently serializes only the necessary data, meaning for added entities: the entire entity, delete entities: the id, for modified, only modified properties along with their values.
For example
Server (get):
var query = _DbContext
.Contacts
.Include(c => c.Phones)
.Include(c => c.Addresses)
.Include(c => c.Portfolio)
.ThenInclude(p => p.Notes);
return Ok(await query.ToTrackableGraphAsync()); //or wrap graph elsewhere afterwards
//returns proxy entities that implement an interface including graph metadata
Client:
Each entity in graph is a proxy class that implements an interface that exposes some change tracking and graph stuff or managed via a centralized EF client tool. Each entity should also have a Guid etc. that goes along the wire regardless of its DB id, so we can identify it regardless of its state.
A serializer will construct the proper IGraphChangeData for client/server, or should be a concrete.
var contacts = await efClient.GetAsync<Contact>();
//perform changes add, delete, change in any of the graph
IGraphChangeData data = efClient.GetGraphChanges();
IGraphChangeResult result = await efClient.SaveAsync(data);
efClient.RefreshGraph(contacts, result);
Server (put):
_DbContext.AttachGraph(IGraphChangeData data);
try {
var result = await _DbContext.SaveChangesAsync();
return Ok(result);
@ErikEJ
That's just that!
It looks like that project isn't maintained tho. No support for VS 2017 and this compelling project looks a bit neglected.
Would still be nice having this or a similar repo conducted by MS.
Hi and thanks for the ping! Yes you absolutely can use TE without the T4 templates. The server bits just need two properties on an entity: TrackingState enum and ModifiedProperties string array (for partial updates).
The reason for the T4 templates really is for a) convenience and b) on the client to support change tracking.
Hope this helps!
Happy to be of service! Would be great to make it into the .NET Foundation, but I think they are pretty selective. :))
I am working on a port to .NET Standard 2.0. Have been waiting also on an update to the graph API in EF Core v2, which is needed for the TE API, so I'll sync up with that soon.
Cheers,
Tony
On Jun 6, 2017, at 9:47 PM, Shimmy ***@***.***> wrote:
Thank you very much Tony!!!
Would be a great idea adding your project to .NET foundation and draw more community attention to it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
@tonysneed Yep, it is. I'll make sure it gets done. 😸 Would be interested to hear any other feedback you have while working on this. New APIs, confusing behaviors, etc.
Activity
ErikEJ commentedon Jun 6, 2017
@weitzhandler http://trackableentities.github.io/ (currently not support for EF Core) ?
weitzhandler commentedon Jun 6, 2017
@ErikEJ
That's just that!
It looks like that project isn't maintained tho. No support for VS 2017 and this compelling project looks a bit neglected.
Would still be nice having this or a similar repo conducted by MS.
ErikEJ commentedon Jun 6, 2017
Ping @tonysneed - any comments?
weitzhandler commentedon Jun 6, 2017
@ErikEJ
Have you used it? Sorry for getting away from the discussion, I hope you can help:
tonysneed commentedon Jun 6, 2017
weitzhandler commentedon Jun 6, 2017
@tonysneed wow tx for your quick answer.
EntityBaseandModelBase, which of them?tonysneed commentedon Jun 6, 2017
weitzhandler commentedon Jun 7, 2017
Thank you very much Tony!!!
Would be a great idea adding your project to .NET foundation and draw more community attention to it.
tonysneed commentedon Jun 7, 2017
weitzhandler commentedon Jun 7, 2017
Well here's their checklist. I'm sure you've gone that far you'll go that bit more to make it into the dnf...
Should I close this issue or keep it open for the reference of for some MS ppl to see it?
And BTW, (self-quoting):
Apparently I was utterly wrong...
tonysneed commentedon Jun 7, 2017
ajcvickers commentedon Jun 8, 2017
@tonysneed Curious what APIs you are waiting on?
tonysneed commentedon Jun 8, 2017
@ajcvickers It's #7389 Provide access to referencing entity in TrackGraph. Looks like it's in the 2.0.0 milestone.
ajcvickers commentedon Jun 8, 2017
@tonysneed Yep, it is. I'll make sure it gets done. 😸 Would be interested to hear any other feedback you have while working on this. New APIs, confusing behaviors, etc.
tonysneed commentedon Jun 8, 2017
@ajcvickers Thanks for working on that! I'll be sure to grab the nightlies and start playing. 😄 Happy to provide feedback on the API's!
Provide access to referencing entity in TrackGraph
Provide access to referencing entity in TrackGraph
Provide access to referencing entity in TrackGraph
ajcvickers commentedon Jun 12, 2017
Closing as a dupe of #5536 with a comment there to look at this discussion when implementing.