How do I properly communicate with an SQLite database using OOP?

I have a "master" class, GalleryManager, the loads a List<GalleryImage> and a List<GalleryTag> from an SQLite database. GalleryImage is a simple class with an image ID, a List<GalleryTag> and an ImageSource method that queries the database for the image bytes and converts it before returning it, and GalleryTag is a class with ID and Name properties, with the Name querying the DB to get the tag's name using the ID.

My question is, what would be the best way to modify or even access both? Do I put the modification methods in GalleryManager, or in each class respectively? Things like SetTagName, or SetImageBytes, or similar. Heck, should I even have GetImageBytes in GalleryImage, or should I make a method in GalleryManager with a GalleryImage as an argument?

by kesawulf via /r/csharp

Leave a Reply