コード例 #1
0
 /// <summary>
 /// Factory method. Asynchronously loads a <see cref="RoleNVL"/> object.
 /// </summary>
 /// <param name="callback">The completion callback method.</param>
 public static void GetRoleNVL(EventHandler <DataPortalResult <RoleNVL> > callback)
 {
     if (_list == null)
     {
         DataPortal.BeginFetch <RoleNVL>((o, e) =>
         {
             _list = e.Object;
             callback(o, e);
         });
     }
     else
     {
         callback(null, new DataPortalResult <RoleNVL>(_list, null, null));
     }
 }
コード例 #2
0
        /// <summary>
        /// Loads a <see cref="RoleNVL"/> collection from the database or from the cache.
        /// </summary>
        protected void DataPortal_Fetch()
        {
            if (IsCached)
            {
                LoadCachedList();
                return;
            }

            using (var cn = new SqlConnection(Database.DocStoreConnection))
            {
                using (var cmd = new SqlCommand("GetRoleNVL", cn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cn.Open();
                    var args = new DataPortalHookArgs(cmd);
                    OnFetchPre(args);
                    LoadCollection(cmd);
                    OnFetchPost(args);
                }
            }
            _list = this;
        }
コード例 #3
0
 /// <summary>
 /// Used by async loaders to load the cache.
 /// </summary>
 /// <param name="list">The list to cache.</param>
 internal static void SetCache(RoleNVL list)
 {
     _list = list;
 }
コード例 #4
0
 /// <summary>
 /// Clears the in-memory RoleNVL cache so it is reloaded on the next request.
 /// </summary>
 public static void InvalidateCache()
 {
     _list = null;
 }