Exemple #1
0
        public void Dispose()
        {
            AppPathMappingContext context = null;

            if (AppPathMappingContextCache.Instance.TryGetValue(this.sourcePathName, out context))
            {
                AppPathMappingContextCache.Instance.Remove(this.sourcePathName);
            }
        }
Exemple #2
0
        public static string GetMappedPathName(string srcPathName)
        {
            AppPathMappingContext context = null;
            string result = srcPathName;

            if (AppPathMappingContextCache.Instance.TryGetValue(srcPathName, out context))
            {
                result = context.destinationPathName;
            }

            return(result);
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="srcPathName"></param>
        /// <param name="destPathName"></param>
        /// <returns></returns>
        public static AppPathMappingContext CreateMapping(string srcPathName, string destPathName)
        {
            ExceptionHelper.CheckStringIsNullOrEmpty(srcPathName, "srcPathName");
            ExceptionHelper.CheckStringIsNullOrEmpty(destPathName, "destPathName");

            ExceptionHelper.TrueThrow(AppPathMappingContextCache.Instance.ContainsKey(srcPathName),
                                      "已经为AppPath\"{0}\"建立了映射关系", srcPathName);

            AppPathMappingContext context = new AppPathMappingContext();

            context.sourcePathName      = srcPathName;
            context.destinationPathName = destPathName;

            AppPathMappingContextCache.Instance.Add(context.sourcePathName, context);

            return(context);
        }