質問

Is it possible to tell Fluent NHibernate not to map a property in a SubClassMap which is defined in it's parent's ClassMap? So:

public class ParentMap : ClassMap<Parent>
{
    public ParentMap()
    {
        this.Map(x => x.Id);
        this.HasManyToMany(x => x.Somethings)
            .Table("ParentSomethings")
            .ParentKeyColumn("ParentId")
            .ChildKeyColumn("SomethingId");
        this.DiscriminateSubClassesOn("Foo");
    }
}

public class ChildMap : SubclassMap<Child> // with Child : Parent
{
    this.DiscriminatorValue("Child");
    this.DontMap(x => x.Somethings); // fictional method
}
役に立ちましたか?

解決

If you need to do this, your map are wrong, you need to create a ClassMap to Parent, and don't map this property "something", and create two differents mappings for children, one that contains "something" property and one that does not contain.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top