1、从WebConfig的AppSettings节点中读取到属性ERP-License-ProductVersion的值。
System.Configuration.ConfigurationManager.AppSettings["ERP-License-ProductVersion"]
2、在XML中使用XPath检索
xmlDocument.SelectSingleNode("/licenseArray/licenses/license[@productVersion=\"" + ProductVersion + "\"]")
3、上述节点的查询结果的OuterXml就是旧License的内容.
影子License其实就是旧版本license.xml文件,时随着新license2.xml自动生成。 这样核心ERP读取license信息的代码不用调整,依旧按照原来的方式读取license.xml文件,最大限制减小对核心ERP的影响。
此时ERP-License-ProductVersion版本号必须有一个对应License2.xml中license节点属性productVersion值
重构ERP只存在一个license文件,且必须是License2.xml文件,存放在bin目录中。 web.config必须配置ERP-License-ProductVersion,且必须有一个对应License2.xml中license节点属性productVersion值