Exemple #1
0
        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
                }
            }
        }
Exemple #2
0
        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");
                }
            }
        }
Exemple #3
0
        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
                }
            }
        }
Exemple #4
0
        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 }));
                }
            }
        }
Exemple #5
0
 internal void StoreObjectBase(ISqoDataObject obj)
 {
     base.StoreObject(obj);
 }
Exemple #6
0
 internal bool DeleteObjectByBase(ISqoDataObject obj, params string[] fieldNames)
 {
     return(base.DeleteObjectBy(obj, fieldNames));
 }
Exemple #7
0
 internal bool DeleteObjectByBase(string fieldName, ISqoDataObject obj)
 {
     return(base.DeleteObjectBy(fieldName, obj));
 }
Exemple #8
0
 internal void DeleteBase(ISqoDataObject obj)
 {
     base.Delete(obj);
 }