/// <summary> /// Create a new drive. Create a connection to the database and set /// the Database property in the PSDriveInfo. /// </summary> /// <param name = "drive"> /// The path to the RavenDB data directory. /// </param> /// <returns>The added drive.</returns> protected override PSDriveInfo NewDrive(PSDriveInfo drive) { // check if drive object is null if (drive == null) { WriteError(new ErrorRecord( new ArgumentNullException("drive"), "NullDrive", ErrorCategory.InvalidArgument, null) ); return null; } // check if drive root is not null or empty if (String.IsNullOrEmpty(drive.Root)) { WriteError(new ErrorRecord( new ArgumentException("drive.Root"), "NoRoot", ErrorCategory.InvalidArgument, drive) ); return null; } var ravenDBPSDriveInfo = new RavenDBPSDriveInfo(drive); var db = new DocumentDatabase(new RavenConfiguration {DataDirectory = drive.Root}); ravenDBPSDriveInfo.Database = db; return ravenDBPSDriveInfo; }