/// <summary> /// Initializes a new instance of the <see cref="Collection" /> class. /// </summary> /// <param name="name">The name of the Document Collection.</param> /// <param name="database">The database.</param> /// <param name="schema">The schema.</param> /// <exception cref="System.ArgumentException"></exception> /// <exception cref="System.ArgumentNullException"></exception> internal Collection(string name, Database database, Schema schema = null) { if (String.IsNullOrWhiteSpace(name)) throw new ArgumentException($"{nameof(name)} cannot be null or blank"); if (database == null) throw new ArgumentNullException(nameof(database)); Name = name; Schema = schema ?? Schema.CreateDefault(name); _documentStorage = database.DocumentStorage; var indexPath = Path.Combine(database.IndexBasePath, name); _luceneIndex = new LuceneIndex(indexPath, Schema); }
/// <summary> /// Initializes a new instance of the <see cref="Collection" /> class based on a Schema. /// </summary> /// <param name="schema">The Schema.</param> /// <param name="database">The database.</param> internal Collection(Schema schema, Database database) : this(schema.Name, database, schema) { }