예제 #1
0
        public LibraryIndexHelper(IndexKinds indexKind, string databaseConnectionString)
        {
            lazyConnection = new Lazy <SqlConnection>(() =>
            {
                var connection = new SqlConnection(databaseConnectionString);
                connection.Open();
                return(connection);
            });

            IndexName = GetIndexName(indexKind);
        }
예제 #2
0
        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]);
        }