/// <summary>
        /// Gets the specified entity from the information store.
        /// The first call to this function caches the result in the HTTP context (if available);
        /// subsequent calls during the same HTTP context will retrieve the item from the context
        /// instead of the database.
        /// </summary>
        public static UserRegistration_Module Get(
            int moduleId
            )
        {
            UserRegistration_Module item = null;
            string cacheKey = GetCacheKey(
                moduleId
                );
            HttpContext context = HttpContext.Current;

            if (null != context) //may be null in a non-web environment (e.g., unit tests).
            {                    //try the cache of the current HTTP request.
                item = context.Items[cacheKey] as UserRegistration_Module;
            }
            if (null == item)
            {
                item = Find(
                    moduleId,
                    null,
                    null).First;

                if (null != context)
                { //cache the item.
                    context.Items[cacheKey] = item;
                }
            }

            return(item);
        }
        /// <summary>Saves the entity to the information store.</summary>
        private static int Save_(UserRegistration_Module entity)
        {
            int retval = 0;

            entity.OnPreSave();

            using (SqlCommand cmd = entity.GetSaveCommand(true))
            {
                using (cmd.Connection)
                {
                    cmd.Connection.Open();
                    cmd.ExecuteNonQuery();
                }
                entity._isNew = false;


                //Note: it is _not_ necessary to call RemoveFromContextCache()
                //during Save, because the object being saved is the same object
                //referenced by the context cache--hence, it is up-to-date.

                retval = (int)cmd.Parameters["@RETVAL"].Value;
            }

            entity.OnPostSave();

            return(retval);
        }
        public static UserRegistration_ModuleCollection GetTypedList(SqlDataReader r)
        {
            UserRegistration_ModuleCollection items = new UserRegistration_ModuleCollection();
            UserRegistration_Module           item  = null;

            while (r.Read())
            {
                item          = new UserRegistration_Module();
                item.ModuleId = r.GetInt32(r.GetOrdinal("ModuleId"));
                item.ConfirmationPageNavigationId = r.GetInt32(r.GetOrdinal("ConfirmationPageNavigationId"));
                item.NotifyEmailAddress           = r[r.GetOrdinal("NotifyEmailAddress")] as string;
                item._isNew = false;
                items.Add(item);
            }
            return(items);
        }