Exemplo n.º 1
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)));
 }
Exemplo n.º 2
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)));
 }
Exemplo n.º 3
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)));
        }