public int GetOIDOfObject(object obj, SqoTypeInfo ti) { ISqoDataObject dataObje = obj as ISqoDataObject; if (dataObje != null) { return(dataObje.OID); } else//get oid by reflection { var flags = BindingFlags.Instance | BindingFlags.Public; PropertyInfo pi = ti.Type.GetProperty("OID", flags); if (pi == null) { //throw new SiaqodbException("Object of Type:" + ti.ToString() + " does not have property OID, define it first!"); return(this.GetOID(ti, obj)); } else { #if UNITY3D return((int)pi.GetGetMethod().Invoke(obj, null)); #else return((int)pi.GetValue(obj, null)); #endif } } }
public static void CallSetValue(FieldInfo fi, object fieldValue, object obj, Type ti) { ISqoDataObject dataObje = obj as ISqoDataObject; if (dataObje != null) { dataObje.SetValue(fi, fieldValue); } else//set oid by reflection { try { var flags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public; MethodInfo mi = ti.GetMethod("SetValue", flags); if (mi == null) { throw new Exception("Object not have method SetValue, define it first!"); } else { mi.Invoke(obj, new object[] { fi, fieldValue }); } } catch { throw new SiaqodbException("Override GetValue and SetValue methods of SqoDataObject-Silverlight limitation to private fields"); } } }
public void SetOIDToObject(object obj, int oid, SqoTypeInfo ti) { ISqoDataObject dataObje = obj as ISqoDataObject; if (dataObje != null) { dataObje.OID = oid; } else//set oid by reflection { var flags = BindingFlags.Instance | BindingFlags.Public; PropertyInfo pi = ti.Type.GetProperty("OID", flags); if (pi == null) { //throw new SiaqodbException("Object of Type:" + ti.ToString() + " does not have property OID, define it first!"); this.AddObjectOID(ti, obj, oid); } else { #if UNITY3D pi.GetSetMethod().Invoke(obj, new object[] { oid }); #else pi.SetValue(obj, oid, null); #endif } } }
public static object CallGetValue(FieldInfo fi, object obj, Type ti) { ISqoDataObject dataObje = obj as ISqoDataObject; if (dataObje != null) { return(dataObje.GetValue(fi)); } else//set oid by reflection { var flags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public; MethodInfo mi = ti.GetMethod("GetValue", flags); if (mi == null) { throw new Exception("Object not have method GetValue, define it first!"); } else { return(mi.Invoke(obj, new object[] { fi })); } } }
internal void StoreObjectBase(ISqoDataObject obj) { base.StoreObject(obj); }
internal bool DeleteObjectByBase(ISqoDataObject obj, params string[] fieldNames) { return(base.DeleteObjectBy(obj, fieldNames)); }
internal bool DeleteObjectByBase(string fieldName, ISqoDataObject obj) { return(base.DeleteObjectBy(fieldName, obj)); }
internal void DeleteBase(ISqoDataObject obj) { base.Delete(obj); }