That's the question. I've read that the EF7 will support SQLite for Windows Store and Windows Phone but what the deal right now? Are there any other ORMs that support SQLite on Universal Apps?
Asked
Active
Viewed 580 times
1 Answers
1
There is CoolStorage but I don't have any experience with that ORM.
Not an ORM per se, but check out SQLite.Net together with SQLite.Net Extensions. I'm using it right now in a Universal App, and it works good enough for what I need.
Do note there's not yet support for relations in LINQ.
I myself am currently using the Extensions like this:
public class Bar
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Title { get; set; }
[ManyToMany(typeof(FooBar))]
public List<Foo> Foos{ get; set; }
}
public class Foo
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Title { get; set; }
[ManyToMany(typeof(FooBar))]
public List<Bar> Bars{ get; set; }
}
public class FooBar
{
[ForeignKey(typeof(Foo))]
public int FooId{ get; set; }
[ForeignKey(typeof(Bar))]
public int BarId{ get; set; }
}

Benjamin Diele
- 1,177
- 1
- 10
- 26
-
That's very dissapointing, thats what I was after actually, avoid writing sql queries. It seems that this is not possible, well just yet. – Pantelis Jul 22 '14 at 17:44
-
@Pantelis see my edit about CoolStorage. Perhaps you could try that one. – Benjamin Diele Jul 22 '14 at 17:46
-
I've seen it before, but never used it. I don't see anywhere mentioning Windows Store Apps though. This is very old actually, its for Windows Phone 7. – Pantelis Jul 22 '14 at 17:48
-
@Benjamin Diele I am unable to use sqlite.net extentsions in Universal app as it does not install in windows phone project at my end. can you share your solution? – Muhammad Saifullah Jul 22 '14 at 18:58
-
@MuhammadSaifullah I cloned the SQLite.Net repo and added the normal (PCL) version. Afterwards I cloned the SQLite.Net Extensions and added that as well. I don't think cloning the repos is required though, but I found it easier so that I can run through the source code when something goes wrong. If you want an app example let me know. – Benjamin Diele Jul 22 '14 at 19:12
-
I had posted a seprate question for this. can you explain your solution there? here is the link http://stackoverflow.com/questions/24859799/windows-phone-8-1-sqlite-net-foreign-key-relationship – Muhammad Saifullah Jul 22 '14 at 19:22
-
@MuhammadSaifullah Check your question :) – Benjamin Diele Jul 22 '14 at 19:29
-
So, the `SQLite.Net Extensions` needs to be included in both projects. Meaning that your Model also needs to be on both projects? Or do you have a separate project for the model and data access which references the needed libraries (`SQLite for Windows Runtime (Windows 8.1)`, `Microsoft Visual C++ 2013 Runtime Package for Windows` and the Windows Phone equivalents) ? – Pantelis Jul 24 '14 at 08:00
-
My model is in the Shared project. You need to include the extensions for each project, because that's where the code differs (writing to the device and such). Your model uses the library, which handles everything for you :) – Benjamin Diele Jul 24 '14 at 08:50
-
So you aren't using any of the extensions attributes for your model, are you? Is your database simple, with no relationships? I'm mainly concerned because I have a complex database schema. – Pantelis Jul 24 '14 at 15:25
-
@Pantelis I updated my answer. I do use attributes and relations, though my actual schema is not very complex (a couple of N-M, M-M relations) – Benjamin Diele Jul 24 '14 at 19:57
-
I'm still trying to install the extension, but I think I've found it. I still don't get how your model, and by model I mean your entities, those in your edited answer, know about the extensions, since the extensions are only referenced in your WP8.1 project and your entities lie in the shared one. – Pantelis Jul 24 '14 at 21:49
-
Jeez, I'm either too dumb, or this is too complicated. Or maybe you're not explaining it right, I mean there are a bunch of SQLite projects and a number of ways to reference them. Can you please pack a universal sqlite-extensions-ready solution and I'll take it from there. – Pantelis Jul 24 '14 at 22:19
-
Hi @BenjaminDiele, I'm having similar problems ... Could you share a sample project with us? – fabianpimminger Sep 25 '14 at 19:00
-
I think this is officially supported now: https://blogs.windows.com/buildingapps/2016/05/03/data-access-in-universal-windows-platform-uwp-apps/. I'm about to try it now. – Hendra Anggrian Aug 10 '16 at 04:03