In method GetHRPaidTimeOffConnectionString(),
I can't use
ConfigurationManager class to get connection string in web.config because it doesn't appear in ItelliSense.
When I copy DBHelper.cs file in source code of this book to Framework folder and press Ctrl + F5 to run project,
one error come up:
"The name 'ConfigurationManager' does not exist in the current context."
I think ConfigurationManager class can be accessed in PaidTimeOffUI not DAL layer, right?
What can I do to slove this problem?
Here is DBHelper class:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace V2.PaidTimeOffDAL.Framework
{
public class DBHelper
{
private const string HRPAIDTIMEOFF_CONNSTRING_KEY = "HRPaidTimeOffConnString";
public static string GetHRPaidTimeOffConnectionString()
{
return ConfigurationManager.ConnectionString[HRPAIDTIMEOFF_CONNSTRING_KEY].ConnectionString;
}
}
}