litedb-org / LiteDB

LiteDB - A .NET NoSQL Document Store in a single data file
http://www.litedb.org
MIT License
8.66k stars 1.25k forks source link

GetCollection crashes with custom Id mapping #1384

Open afzalarahim opened 4 years ago

afzalarahim commented 4 years ago

GetCollection api throws exception when the class has two ID properties like 'TempId' and ,Id' and TempId is mapped as Id using Fluent API.

    public class BaseClass
    {
        public long TempId { get; set; }
    }
    public class TestClass : BaseClass
    {
        public long Id { get; set; }

        public string Name { get; set; }
    }

Custom Mapping

                mapper.Entity<TestClass>().Id(x => x.TempId);
afzalarahim commented 4 years ago

Any solution or suggestions?