Skip to content

Not working with generic or abstract entity #282

@manohardelhi

Description

@manohardelhi
   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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions