Select specific fields of mapped object
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start at the connection.Query calls shown in cases 1–3 and compare them with CreateTable. Check whether selecting Text, Id, or Id and Real can be mapped and serialized into string, int, or MySubObject. Done means documenting the supported approach or clearly recording that partial mapped-object selection is unsupported.
Written by the indexing model from the issue text.
Description
Question:
Is it currently possible to select only specific fields (1, many) of the mapped object and get them serialized? I can't find any documentation or examples of this.
Example:
Database structure:
CREATE TABLE MyObjects (
Id INTEGER PRIMARY KEY,
Text TEXT,
Real REAL,
);
Code structure:
interface IMySubObject
{
int Id {get; }
double Real {get; }
}
class MyObject : IMySubObject
{
[PrimaryKey, AutoIncremented]
public int Id {get; set;}
public string Text {get; set;}
public double Real {get; set;}
}
class MySubObject : IMySubObject
{
public int Id {get; set;}
public double Real {get; set;}
}
Setup:
connection.CreateTable<MyObject >();
Queries:
case 1:
var query = "SELECT Text FROM MyObjects WHERE Id = 10";
connection.Query<string>(query);
case 2:
var query = "SELECT Id FROM MyObjects WHERE Text LIKE '%text%'";
connection.Query<int>(query,);
case 3:
var query = "SELECT Id, Real FROM MyObjects WHERE Text LIKE '%text%'";
connection.Query<MySubObject >(query,);
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from praeclarum/sqlite-net
-
Feature Up for Grabs
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
praeclarum/sqlite-net#609 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
praeclarum/sqlite-net#1308 · 6 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
praeclarum/sqlite-net#1307 · 23 comments · 7 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
praeclarum/sqlite-net#1300 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
praeclarum/sqlite-net#1299 · 6 comments ·
All issues in praeclarum/sqlite-net
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100