研究了一周的单元测试,现在勉强算是摸到了门槛,现整理笔记如下: 项目架构是简单的工厂模式,对应代码为: DAL IDAL BLL DALFactory 最开始就卡在这里,一度以为静态方法无法单元测试,后来发现原因是因为ConfigurationManager.AppSettings["WebDAL" ...
分类:
其他好文 时间:
2016-07-18 16:47:57
阅读次数:
185
读语句: String str = ConfigurationManager.AppSettings["DemoKey"]; 写语句: Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); cfa.AppSet...
分类:
移动开发 时间:
2016-07-13 17:02:00
阅读次数:
265
出现原因: 因为Global类初始化某个静态变量时没有成功则会抛 System.NullReferenceException 异常,具体代码: public static string connstring = System.Configuration.ConfigurationManager.Co ...
为了方便有时我们会把一些简单的配置的信息放入web.config文件里。 放到appSettings添加key value等信息。 var config= ConfigurationManager.AppSettings["minAmount"];//获取值 Configuration cfa = ...
分类:
移动开发 时间:
2016-06-30 14:14:53
阅读次数:
242
private string connectionString; private void SaveCustomerInfo() { var entityConnStr = ConfigurationManager.ConnectionStrings["DcsEntities"].Connectio ...
分类:
数据库 时间:
2016-06-10 11:00:06
阅读次数:
166
public abstract class SQLHelper { //只读的静态数据库连接字符串 //需添加引用System.Configuration; public static readonly string connString = ConfigurationManager.Connect ...
分类:
数据库 时间:
2016-05-30 17:15:06
阅读次数:
244
SCCMTP4配置发现方法对于刚刚安装完成的SCCM服务器需要对其进行初始化的一些配置。SCCM发现会标识可使用ConfigurationManager管理的计算机和用户资源。它还可以发现环境中的网络基础结构。发现将为每个发现的对象创建发现数据记录(DDR),并将此信息存储在ConfigurationManager..
分类:
其他好文 时间:
2016-05-18 22:18:11
阅读次数:
237
string ConStr = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString; protected void Page_Load(object sender, EventArg ...
分类:
Web程序 时间:
2016-05-18 21:20:32
阅读次数:
220
<appSettings> <add key="MailProfile" value="AAA"/> </appSettings> private void btnSendMail() { try { string mailProfile = ConfigurationManager.AppSett ...
分类:
数据库 时间:
2016-04-21 18:39:00
阅读次数:
212
protected void BtnDowload_Click(object sender, EventArgs e) { string path = Server.MapPath(ConfigurationManager.AppSettings["PersonRecordUrl"]); strin ...
分类:
其他好文 时间:
2016-04-18 18:58:41
阅读次数:
177