public LibraryIndexHelper(IndexKinds indexKind, string databaseConnectionString) { lazyConnection = new Lazy <SqlConnection>(() => { var connection = new SqlConnection(databaseConnectionString); connection.Open(); return(connection); }); IndexName = GetIndexName(indexKind); }
public static string GetIndexName(IndexKinds indexKind) { string indexNameKey; switch (indexKind) { case IndexKinds.CommonCollection: indexNameKey = CommonCollectionIndexNameKey; break; case IndexKinds.PersonalCollection: indexNameKey = PersonalCollectionIndexNameKey; break; default: throw new ArgumentOutOfRangeException(indexKind.ToString()); } return(ConfigurationManager.AppSettings[indexNameKey]); }