Storing Your Data in Graffiti CMS the Easy Way

Customizing the basic installation of Graffiti CMS will probably require the use of additional database fields.  Using the Object Store is the easiest way to acomplish this task. To make use of the object store, follow the instructions in this tip:

Add a reference to Graffiti.Core, make an object, mark the object serializable

[Serializable]
public class MyObject
{
private string _name;
private string _description;

public string Name
{
get { return _name; }
set { _name = value; }
}

public string Description
{
get { return _description; }
set { _description = value; }
}
}

instantiate and call Save..

MyObject obj = new MyObject();

ObjectManager.Save(obj, “MyObjectSettings”);

retrieve it later..

ObjectManager.Get<MyObject>(“MyObjectSettings”);

That’s it!

Leave a Reply

Your email address will not be published. Required fields are marked *