using System.Collections.Generic;
public static void Main()
DocumentProps p = new DocumentProps();
p.DocumentId = new Guid("8a888e8c-5d85-2eaa-423b-713cfb7b0ddf");
Console.WriteLine(p.DocumentId);
ObjectWithId q = new ObjectWithId();
q.ObjectId = new Guid("43a1b3b4-8219-0c9e-4335-977c6bbfa452");
Console.WriteLine(q.ObjectId);
public class SafePropertyCollection
private Dictionary<string, object> kvps { get; set; }
private void Set(string key, object v)
if(kvps == null) kvps = new Dictionary<string, object>();
private object GetObject(string key)
if(kvps == null) return null;
protected void Set(string key, string v)
protected void Set(string key, Guid v)
protected void Set(string key, int v)
protected string GetString(string key)
return (string)GetObject(key);
protected int GetInt32(string key)
return (int)GetObject(key);
protected Guid GetGuid(string key)
var g = GetObject(key).ToString();
throw new NotImplementedException();
throw new NotImplementedException();
protected void SetObjectPrimaryKey(Guid v)
Set("ObjectPrimaryKey",(object)v);
protected Guid GetObjectPrimaryKey()
var g = GetObject("ObjectPrimaryKey").ToString();
class ObjectWithId : SafePropertyCollection {
get { return base.GetObjectPrimaryKey(); }
set { base.SetObjectPrimaryKey(value); }
class DocumentProps : ObjectWithId
get { return base.ObjectId; }
set { base.ObjectId = value; }
get { return base.GetString("Title"); }
set { base.Set("Title", value); }