zoukankan      html  css  js  c++  java
  • 看了二十四画生的文章才发现ASP.NET Portal Starter Kit中调整顺序的一个Bug

    public void SaveSiteSettings() 

        
    // 原来的:从Cache中获取站点设置信息数据集(好像是个Bug,因为每次更新数据是更新的HttpContext.Current.Items中的) 
        
    //SiteConfiguration siteSettings = (SiteConfiguration) HttpContext.Current.Cache["SiteSettings"]; 
        
    // 修改后的 
        SiteConfiguration siteSettings = (SiteConfiguration) HttpContext.Current.Items["SiteSettings"]; 
     
        
    // 如果Cache中没有,则重新构建 
        if(siteSettings == null
        

            
    // If SaveSiteSettings() is called once, the cache is cleared.  If it is 
            
    // then called again before Global.Application_BeginRequest is called,  
            
    // which reloads the cache, the siteSettings object will be Null  
            
    // (这一句不知翻译的对不对,好像很重要)如果SaveSiteSettings()被调用过一次后,Cache就回被清除。如果它再一次被调用在Global.Application_BeginRequest前siteSettings为null则重新写Cache 
            siteSettings = GetSiteSettings(); 
        }
     
        
    string configFile = HttpContext.Current.Server.MapPath(ConfigurationSettings.AppSettings["configFile"]); 
     
        
    // Object is evicted from the Cache here.   
        
    // 将变更后的数据集写入到Xml文件 
        siteSettings.WriteXml(configFile); 
    }
     

    说起来挺气人的,微软放了这么久的东西这么明显一个bug都不改过来。前几个星期抽了时间把portal排序的主要的一些代码提出来看看,编译后执行程序,要么点了后不动,要么就是ModuleOrder的顺序重复,还以为是自己的问题,放了几个星期了,今天偶然回来博客园看看,发现二十四花生的一篇文章http://www.cnblogs.com/esshs/archive/2005/04/18/139829.html提及到这个Bug.上面是其中一段需要修改的地方。改了基本就正常了。觉得不爽。
  • 相关阅读:
    团队项目第二阶段冲刺第六天
    团队项目冲刺第二阶段第五天
    团队项目冲刺第二阶段第四天
    团队项目冲刺第二阶段第三天
    大道至简阅读笔记1
    团队项目冲刺第二阶段第二天
    团队项目第二阶段冲刺第一天
    团队项目冲刺第九天
    团队项目冲刺第八天
    团队项目冲刺第七天
  • 原文地址:https://www.cnblogs.com/Bruce_H21/p/226450.html
Copyright © 2011-2022 走看看