Beispiel #1
0
 /// <summary>
 /// Fetches User object from in-memory cache or remote server or database.
 /// </summary>
 public static User FetchById(string value, funapi.LockType lock_type = funapi.LockType.kWriteLock)
 {
     funapi.Object obj = funapi.Object.FetchByKey("User", "Id", value, lock_type);
     if (obj == null)
     {
         return(null);
     }
     return((User)obj.GetWrapperObject(typeof(User)));
 }
Beispiel #2
0
 /// <summary>
 /// Fetches User object from in-memory cache or remote server or database.
 /// </summary>
 public static User Fetch(System.Guid object_id, funapi.LockType lock_type = funapi.LockType.kWriteLock)
 {
     funapi.Object obj = funapi.Object.FetchById("User", object_id, lock_type);
     if (obj == null)
     {
         return(null);
     }
     return((User)obj.GetWrapperObject(typeof(User)));
 }
Beispiel #3
0
        /// <summary>
        /// Makes the object accessible in the current event.
        /// </summary>
        public bool Refresh(funapi.LockType lock_type)
        {
            if (IsFresh() && object_.LockType >= lock_type)
            {
                return(true);
            }

            funapi.Object obj = funapi.Object.FetchById("User", Id, lock_type);
            if (obj == null)
            {
                return(false);
            }

            object_ = obj;
            return(true);
        }
Beispiel #4
0
        /// <summary>
        /// Creates User object.
        /// </summary>
        public static User Create(string id)
        {
            if (FetchById(id) != null)
            {
                return(null);
            }

            Dictionary <string, object> key_params = null;

            key_params       = new Dictionary <string, object>();
            key_params["Id"] = id;
            funapi.Object obj = funapi.Object.Create("User", key_params);
            if (obj == null)
            {
                // key string length error, etc.
                return(null);
            }
            return((User)obj.GetWrapperObject(typeof(User)));
        }