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

Support Fake Relationships #150

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

Support Fake Relationships #150

ckalan opened this issue Jul 27, 2012 · 2 comments

Comments

@ckalan
Copy link

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
Copy link
Collaborator

@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
Copy link
Contributor

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants