NHibernate: set id for interface mapping

I am trying to write a (fluent) mapping to an interface

public interface IOrderDiscount : IDomainObject<long>

      

Where

public interface IDomainObject<IdT> : IDomainObject
{
   IdT Id { get; }
}

      

so (and all other conceivable options for access strategies)

Id(d => d.Id, "DiscountId")
    .GeneratedBy.HiLo("9")
    .WithUnsavedValue(0)
    .Access.AsReadOnlyPropertyThroughCamelCaseField();

      

but all i get are options

Could not find field 'id' in class 'IOrderDiscount'

My base class implements this as

public virtual IdT Id { get; protected set; }

      

but the event using the backing field doesn't change anything.

So, I am left to wonder how I can get this to work ...
Anyone with an idea?

+2


source to share


1 answer


Replace the column name with the custom column name:



Id(d => d.Id)
    .Column("DiscountId")
    .GeneratedBy.HiLo("9")
    .WithUnsavedValue(0)
    .Access.AsReadOnlyPropertyThroughCamelCaseField();

      

0


source







All Articles