dataobjects-net icon indicating copy to clipboard operation
dataobjects-net copied to clipboard

A generic interface with a primary key generic type parameter used with two different primary key types causes a domain build failure

Open ondrejtucny opened this issue 1 year ago • 2 comments

When the following two entities are declared:

[HierarchyRoot(InheritanceSchema.SingleTable)]
[TableMapping("a_list")]
public sealed class AList : LegacyUserTrackedEntity, ICodebookEntity<short>
{
    [Key(0)]
    [Field]
    [FieldMapping("id_list")]
    public short Id { get; set; }
}

[HierarchyRoot(InheritanceSchema.SingleTable)]
[TableMapping("c_system")]
public sealed class CSystem : LegacyUserTrackedEntity, ICodebookEntity<int>
{
    [Key]
    [Field]
    [FieldMapping("id")]
    public int Id { get; set; }
}

DataObjects throws this error: Implementors of ICodebookEntity interface belong to hierarchies with different key structure: AList & CSystem.

However, the interfaces are ICodebookEntity<short> and ICodebookEntity<int> — two different things.

Using version 7.0.3.

ondrejtucny avatar Aug 11 '23 12:08 ondrejtucny