GraphDiff Aggregate Mappings

When I built GraphDiff it was to solve a simple issue that I see many in the .NET community are facing. Over a multi-tiered environment I needed to transfer aggregate roots from one layer to another and determine what had changed. The proposed solution has proven successful in my projects and the projects of many others.

We are now at 2000-3000 downloads on nuget and I am excited to see where we can take this project (if I can once again find time to spend on it)

I have started on a POC today to allow for attribute style mappings on models, which will also include an API for registering default configuration mappings for an entity on app start / bootstrapping (like a fluent api)

This will allow you to define your DDD Aggregate Roots in code and have EF adhere to this configuration.

For an idea of the latest POC see the example below:

public class Car  
    public int Id { get; set; }
    public string Title { get; set; }

    public ICollection<Wheel> Wheels { get; set; }

    public ICollection<Driver> Drivers { get; set; }
// Save it

// Load it
// This will add the correct includes so that the whole aggregate is retrieved in one operation
var graph = context  

No configuration is needed as it is read off the attributes. This is just a proof of concept right now but will allow for Aggregates to be clearly defined in your app either by attributes or a fluent api.

This should cover many scenarios by default, but will also allow mapping overrides should the need arise where the full aggregate is not to be updated/retrieved.

Let me know what you think, and thanks for using GraphDiff.

comments powered by Disqus