-
Notifications
You must be signed in to change notification settings - Fork 686
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
Can't override key colum name in JoinedSubClass Automapping #42
Comments
On it. Shouldn't be too hard to fix |
Well, I don't know why, but given the code provided, I can't even get the derived type to be automapped - the ClassMaping I receive from AutoPersistenceModel is null. Need to revisit tomorrow |
That's really strange - when I created the sample project with the configuration provided, generated sql shows that the problem exists, as described. But in tests I can't reproduce it - at all. |
I spent several hours on this problem yesterday, and thought that I was doing something wrong. It seems that Below is a simplified version of my situation: namespace Domain.Model
{
public abstract class Entity<T>
{
public virtual T Id { get; set; }
}
public class Person : Entity<Guid>
{
}
public class Employee : Person
{
}
public class PersonMappingOverride : IAutoMappingOverride<Person>
{
public void Override(AutoMapping<Person> mapping)
{
mapping.Id(x => x.Id, "PersonID");
mapping.JoinedSubClass<Employee>("EmployeeID");
}
}
} Which generates (I stripped out the fluff): <hibernate-mapping>
<class name="Person">
<id name="Id">
<column name="PersonID" />
<generator class="guid.comb" />
</id>
<joined-subclass name="Employee">
<key>
<column name="Person_id" />
</key>
</joined-subclass>
</class>
</hibernate-mapping> Luckily, our project is setup to use all 3 flavors of mapping, so I can just map them fluently for now. |
yeah, that situation need proper debugging, from what I understand. Somewhere in there joined subclass isn't honored. There's more - FNH doesn't even generate ClassMapping instance in that case, which is really weird |
If I put an override in the subclass, it does honor those properties in the joined-subclass portion of the mapping file. It just won't honor the key column name. |
How's about this bug now? |
I used JoinedSubClassConvention to override key column name, but there is another headache issue that take me days to fix: do not use |
* Deprecate inline subclass methods on AutoMapping Closes #42
With #468 you can do following: public class PersonMappingOverride : IAutoMappingOverride<Person>
{
public void Override(AutoMapping<Employee> mapping)
{
mapping.KeyColumn("EmployeeID");
}
} |
See: https://groups.google.com/forum/#!topic/fluent-nhibernate/xblilnwhGWE/discussion
The text was updated successfully, but these errors were encountered: