Beispiel #1
0
        /// <summary>
        /// Get object T given the UID.
        /// </summary>
        /// <returns>The object T.</returns>
        /// <param name="UID">UID.</param>
        public virtual async Task <T> GetAsync(int UID)
        {
            T obj;

            if ((obj = _idMap.Find(UID)) != null)
            {
                return(obj);
            }

            SQLiteConnection db = await ConnectToTableAsync <T>();

            return(await Task.Run(() =>
            {
                obj = db.Get <T>(UID);
                _idMap.Add(obj.UID, obj);
                db.Close();

                return obj;
            }));
        }