Skip to content

Bug: FluentMapper is not working with Abstract Properties #666

@mikependon

Description

@mikependon

Just tried the FluentMapper and found a problem with abstract properties. RepoDb.FluentMapper.Entity().DbType(e => e.CustomerTypeId, DbType.Int32);

Created by @SpaceOgre from #633.

My classes look like this

    public abstract record Customer
    {
        public int Id { get; init; }
        abstract public CustomerType CustomerTypeId { get; }
        public string CustomerNumber { get; init; }
    }

    public record PrivateCustomer : Customer
    {
        public override CustomerType CustomerTypeId => CustomerType.Private;
        public string SocialSecurityNumber { get; init; }
        public string FirstName { get; init; }
        public string LastName { get; init; }
        public string ChangedBy { get; init; }
    }

If I use the Attribute it works, but not the FluentMapper. If I remove abstract and change override to new then the FluentMapper works.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtodoThings to be done in the futureworking-as-expectedThe reported issue is working as expected.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions