FluentNHibernate: 1.3.0.733
NHibernate: 3.3.1.4000
I'm trying to set the column name of the Id column, but it seems to be ignored.
Edit:
Found solution. Property redeclaration (new-modifier) was the problem (see answer).
I'm using AutoMapping with conventions and overrides.
Override:
public class OrderHeadMapping : IAutoMappingOverride<OrderHead>
{
public void Override(AutoMapping<OrderHead> mapping)
{
mapping.Schema("[database].[dbo]");
mapping.Table("OrderHeads");
mapping.Id(x => x.Id, "desiredColumnName")
.Column("desiredColumnName")
.GeneratedBy.UuidString();
...
}
}
This code gets executed, but the column name stays "Id".
I've already exported the mappings to an directory to see what's the outcome:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class xmlns="urn:nhibernate-mapping-2.2" schema="[database].[dbo]" name="OrderHead, Core, Version=1.0.4666.19686, Culture=neutral, PublicKeyToken=null" table="OrderHeads">
<cache usage="read-write" />
<id name="Id" type="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<column name="Id" />
<generator class="assigned" />
</id>
...
</class>
</hibernate-mapping>
I've searched my whole solution for ".Id(" and ".Column(" to ensure it is not accidently reset but none of the results deal with setting/overwriting the id column name. So now I'm a little bit lost.