henkmollema / Dommel

CRUD operations with Dapper made simple.
MIT License
634 stars 100 forks source link

Not working with generic or abstract entity #282

Closed manohardelhi closed 10 months ago

manohardelhi commented 2 years ago
    public abstract class BaseEntity<TId>
    {
        public BaseEntity(TId id)
        {
            Id = id;
        }

        public TId Id { get; set; }
    }

    public abstract class PeopleBaseEntity : BaseEntity<string>
    {
        public PeopleBaseEntity():base(string.Empty)
        {

        }

        public string? Name { get; set; }

        public string? Gender { get; set; }
    }

    [Table("people_mans")]
    public class Man : PeopleBaseEntity
    {
        public int Age { get; set; }
    }

var connection = new MySqlConnection(connectionstring);
var people = connection.Select<Man>(x=> x.Name == "Manohar");
Console.WriteLine(JsonSerializer.Serialize(people));

*Genrated SQL : select from people_mans where (PeopleBaseEntities.Name = @p1)**

henkmollema commented 1 year ago

Does setting DommelMapper.IncludeTableNameInColumnName = false at application startup help?

csalexsander commented 1 year ago

Does setting DommelMapper.IncludeTableNameInColumnName = false at application startup help?

This property is not present in version 3.0.0 of the Dommel package.

Looking at the changes, it was made in 2022, but the last version of Dommel was published on NuGet on 12/21/2021