Views: 9K
Replies: 1
Archived
|
Connectionstring explanations pleaseWhat is the purpose of these 2 connection string related lines:
1) is under DataObjects/ADO.NET/SqlServer private static readonly string connectionStringName = ConfigurationManager.AppSettings.Get("ConnectionStringName"); private static readonly string connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString; 2) the other is in DataObjects private static readonly string connectionStringName = ConfigurationManager.AppSettings.Get("ConnectionStringName"); private static readonly IDaoFactory factory = DaoFactories.GetFactory(connectionStringName); Thanks Dennis Dennis Tucker, May 16, 2012
|
|
Reply 1Dennis,
These are all essentially dynamic ways to get the correct connection string from your web.config file. As you know, you can have more than one connection string configured in your web.config/connectionStrings section. By placing a key in the appSettings section for a selected connection string you want to use specifically, you are telling your DataObjects factory which connection string you want to use. This is a cleaner way of getting the connection string, in my opinion, than hard-coding the connection string name in your factory class, or by identifying it by it's index. I hope that answers your question. Thanks, King Wilder King Wilder, Jun 01, 2012
John I appreciate your suggestion & thank you.
I am using C# and Web Browser Control to extract the page content. I was success in processing all the ajax requests on the pages & get the data. Now I am planning for developing an API so that other tool/project can use this API & get required data.
I thought Singleton pattern but not sure whether this is good decision or not.
Any help...
Thanks,
Neetha
Jun 07, 2011
|