コード例 #1
0
        public static UserOpenAuthProvider GetByID(int UserOpenAuthProviderID, IEnumerable <string> includeList = null)
        {
            UserOpenAuthProvider obj = null;
            string key = cacheKeyPrefix + UserOpenAuthProviderID + GetCacheIncludeText(includeList);

            UserOpenAuthProvider tmpClass = null;

            if (Cache.IsEnabled)
            {
                if (Cache.IsEmptyCacheItem(key))
                {
                    return(null);
                }
                tmpClass = Cache[key] as UserOpenAuthProvider;
            }

            if (tmpClass != null)
            {
                obj = tmpClass;
            }
            else
            {
                using (Entities entity = new Entities())
                {
                    IQueryable <UserOpenAuthProvider> itemQuery = AddIncludes(entity.UserOpenAuthProvider, includeList);
                    obj = itemQuery.FirstOrDefault(n => n.UserOpenAuthProviderID == UserOpenAuthProviderID);
                }
                Cache.Store(key, obj);
            }

            return(obj);
        }
コード例 #2
0
 public UserOpenAuthProvider(UserOpenAuthProvider objectToCopy)
 {
     ProviderID             = objectToCopy.ProviderID;
     ProviderName           = objectToCopy.ProviderName;
     UserID                 = objectToCopy.UserID;
     UserOpenAuthProviderID = objectToCopy.UserOpenAuthProviderID;
 }