websitepanel/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Config/Entities/ConnectionStringsCollection.cs
2014-12-03 11:43:26 +03:00

39 lines
No EOL
1.4 KiB
C#

using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using WebsitePanel.WebDavPortal.WebConfigSections;
namespace WebsitePanel.WebDavPortal.Config.Entities
{
public class ConnectionStringsCollection : AbstractConfigCollection
{
private readonly IEnumerable<AppConnectionStringsElement> _appConnectionStringsElements;
public ConnectionStringsCollection()
{
_appConnectionStringsElements = ConfigSection.ConnectionStrings.Cast<AppConnectionStringsElement>();
}
public string WebDavServer
{
get
{
AppConnectionStringsElement connectionStr =
_appConnectionStringsElements.FirstOrDefault(
x => x.Key == AppConnectionStringsElement.WebdavConnectionStringKey);
return connectionStr != null ? connectionStr.ConnectionString : null;
}
}
public string LdapServer
{
get
{
AppConnectionStringsElement connectionStr =
_appConnectionStringsElements.FirstOrDefault(
x => x.Key == AppConnectionStringsElement.LdapConnectionStringKey);
return connectionStr != null ? connectionStr.ConnectionString : null;
}
}
}
}