Skip to content

Associate entity within a inherited entity #112

@ArneHB

Description

@ArneHB

First off, great work with graphdiff, it really makes a different when developing webpages and working with detached entities.

I've come across a issue which I'm not able to figure how to solve. I've been looking all around on the internet and the documentation I've found without finding any clues on how to solve it. I'm trying to associate a entity that is a property to a entity that is inheriting from another entity. Let me show with code:

Project class:

public class Project
{
    public Guid Id { get; set; }

    public virtual List<Activity> Activities { get; set; }
}

Activity class:

public class Activity
{
    public Guid Id { get; set; }

    public String Name { get; set; }

    public virtual Company Company { get; set; }
}

SurfingActivity class:

public class SurfingActivity : Activity
{
    public String Comment { get; set; }

    public virtual Weather Weather { get; set; }
}

The update context using graphdiff:

public void UpdateActivity(Project project)
{
    this.UpdateGraph(project, map => map
        .OwnedCollection(p => p.Activities, with => with
            .AssociatedEntity(a => a.Company)
        )
    );
}

The last section here sets the association, and I'm not able to set the association to Weather in SurfingActivity. It there any way to solve this with the current structure of code? If it's not supported yet, will it be supported? I can set Id, Name, Company and Comment and it all saves but not weather.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions