question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Primary key support for more then one column - i.e. Composite key

See original GitHub issue

public class Image { [PrimaryKey] public int ItemId { get; set; }

    [PrimaryKey]
    public int ImageId { get; set; }

    public string Src { get; set; }

    public int Width { get; set; }

    public int Height { get; set; }

    public byte[] ImageBinary { get; set; }
}

Get the following error:

SQLite.SQLiteException was unhandled by user code HResult=-2146233088 Message=table “Image” has more than one primary key Source=MyPocket StackTrace: at SQLite.SQLite3.Prepare2(IntPtr db, String query) in c:\dev\tfs\MyPocket\MyPocket\SQLite.cs:line 2392 at SQLite.SQLiteCommand.Prepare() in c:\dev\tfs\MyPocket\MyPocket\SQLite.cs:line 1699 at SQLite.SQLiteCommand.ExecuteNonQuery() in c:\dev\tfs\MyPocket\MyPocket\SQLite.cs:line 1573 at SQLite.SQLiteConnection.Execute(String query, Object[] args) in c:\dev\tfs\MyPocket\MyPocket\SQLite.cs:line 467 at SQLite.SQLiteConnection.CreateTable(Type ty) in c:\dev\tfs\MyPocket\MyPocket\SQLite.cs:line 318 at SQLite.SQLiteConnection.CreateTableT in c:\dev\tfs\MyPocket\MyPocket\SQLite.cs:line 288 at MyPocket.Data.SQLitePocketRepository…ctor(String dbPath) in c:\dev\tfs\MyPocket\MyPocket\Data\SQLitePocketRepository.cs:line 24 at MyPocket.View.HomePage.<LoadState>d__0.MoveNext() in c:\dev\tfs\MyPocket\MyPocket\View\HomePage.xaml.cs:line 112 InnerException:

Issue Analytics

  • State:open
  • Created 11 years ago
  • Comments:10

github_iconTop GitHub Comments

3reactions
softlioncommented, Aug 18, 2022

Try my fork

Le jeu. 18 août 2022 à 14:39, Florian Fischer @.***> a écrit :

Is there any chance to have this feature in the next 2 years?

Message ID: @.***>

– Benjamin Mayrargue Vapolia.fr +33682227850 vapolia.fr http://www.vapolia.fr/ Skype/WhatsApp/Slack/Discord/Zoom/Teams/Meets/…

3reactions
SeymourRucommented, May 23, 2021

…well? May be it`s a good time to fix it?

It’s fixed since 3 years in my rewrite there https://github.com/softlion/SQLite.Net-PCL2

Yeah, I`ve seen this, thank you! But still this package is not fixed yet and this is relatively simple feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why use multiple columns as primary keys (composite ...
We create composite primary keys to guarantee the uniqueness column values which compose a single record. It is a constraint which helps ...
Read more >
What is the Composite Primary Key?
Composite primary key combines two or more columns to form a primary key for the table. · To add a composite primary key...
Read more >
Primary key on two columns sql server
A composite primary key is just like a primary key on a single column. All the rules still apply. Doesn't allow null values...
Read more >
Single Identity column and composite key, which to make ...
The base table has a composite key with a clustered index. However I need a single column unique identifier for my framework to...
Read more >
Should I use multiple column primary keys or add a new ...
My current database design makes use of a multiple column primary key to use existing data (that would be unique anyway) instead of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found