praeclarum / praeclarum/sqlite-net

Class inheritance no longer works without repeating Table attribute

Open
#698 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.5k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

I have this scenario:

[Table("MyTable")]
public class MyType { }

public class DerivedType : MyType
{
    ....
}

Then inserting a DerivedType entity would work before 1.4.118, but in version 1.4.118+ SQLite can't insert anymore saying "No table found: DerivedType".

Declaring the Table attribute again as [Table("MyTable")] on the DerivedType works, but feels weird since it has been declared already.
It seems that the new Orm.GetType doesn't look at Base Types before figuring out all the attributes and metadata.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the new Orm.GetType implementation and reproduce the issue with the MyType and DerivedType classes shown in the report. Verify that inserting DerivedType fails without a repeated Table attribute, and consider the work complete when inherited table metadata is honored during SQLite insertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sqlite
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.