vendredi 18 septembre 2015

SQLite doesn't know about class

I'm currently working on a Windows Forms application, and I would like to use a simple database which doesn't require a backing server or credentials to run, so I chose SQLite. But trying to get this thing to work so far was a nightmare.

Right now, I have a few, simple classes with simple properties, which I'd like to store in the database. I've appended the appropriate labels to everything ([Table("")] for classes, [PrimaryKey, AutoIncrement] for the Id property), but whenever I do Connection.CreateTable(CreateFlags.AutoIncPK) (it won't show the generic parameter, but it's there, I promise), it throws a NotSupportedException, saying "Don't know about MyProject.MyClass". I have also provided an empty, parameterless constructor in each class.

So, how do I make SQLite "know" about my class?

Aucun commentaire:

Enregistrer un commentaire