Storing a Picture

For testing the code we just load a picture from the file system into an image object and assign it to an object of class Picture. Then the picture object is made persistent.

using System.Drawing;

...

Image image = Image.FromFile(@"..\..\..\Building.bmp");

Picture p = new Picture();

p.Name = "Our first testpicture";

p.CreationDate = DateTime.Now.Date;

p.Image = image;

PersistenceManager pm = new PersistenceManager();

pm.BuildDatabase();

pm.MakePersistent(p);

pm.Save();