Skip to content

Support Fake Relationships #150

Open
ckalan opened this Issue Jul 27, 2012 · 2 comments

3 participants

@ckalan
ckalan commented Jul 27, 2012

I'm an Orchard developer and in Orchard, AutoMapping can add dynamic fake relationships because of the old Fluent API. In the latest version of FluentNhibernate, "References" methods require expressions which prevents creating dynamic relationships.

Say for instance, in Orchard there is a "ContentItemRecord" class , and each module creates a "PartRecord" table. Then Orchard creates dynamic ManyToOne references on ContentItemRecord for each PartRecord mapped by each module.

This may indeed be a requirement for many modular projects. I've added a new "References" method on the ClasslikeMapBase class which gets a propertyName as a string parameters and calls the "ManyToOnePart References(Member member, string columnName)" method using a DummyPropertyInfo instance.

I've achieved migrating Orchard to FluentNHibernate's latest release with this but I'm not sure this is the right place to make this change.

@jagregory
Owner

@ckalan Could you supply a pull request with your changes? What you've done sounds correct, we do something similar to support pseudo-ids.

@firo222
firo222 commented Dec 6, 2012

if someone is interested I found another workaround which does the same

public FooMap()
{
    Map(x => FakeProperty);
}

private int FakeProperty { get; set; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.