/// <summary>
 /// Get the list of contact reasons
 /// </summary>
 /// <param name="getFromCache"></param>
 /// <returns></returns>
 public static List<ContactReason> GetContactReasons(bool getFromCache)
 {
     return (List<ContactReason>)GetFromCache("ContactReasons", getFromCache, delegate
     {
         using (var context = new MvcDemoEntities())
         {
             return context.ContactReasons.OrderBy(c => c.ContactReasonText).ToList();
         }
     });
 }
 /// <summary>
 /// Get the list of contact reasons
 /// </summary>
 /// <param name="getFromCache"></param>
 /// <returns></returns>
 public static List<UserRole> GetUserRoles(bool getFromCache)
 {
     return (List<UserRole>)GetFromCache("UserRoles", getFromCache, delegate
     {
         using (var context = new MvcDemoEntities())
         {
             return context.UserRoles.OrderBy(ur => ur.UserRoleName).ToList();
         }
     });
 }
        internal Repository(MvcDemoEntities context)
        {
            Context   = context;
            ObjectSet = Context.CreateObjectSet <T>();

            // Build full name of entity set for current entity type
            EntitySetName = string.Format("{0}.{1}", context.DefaultContainerName, ObjectSet.EntitySet.Name);
            // Get name of the entity's key property
            PrimaryKeyName = ObjectSet.EntitySet.ElementType.KeyMembers.First().Name;
        }