/// <summary> /// Constructor that opens an MSI database. /// </summary> /// <param name="path">Path to the database to be opened.</param> /// <param name="type">Persist mode to use when opening the database.</param> public Database(string path, OpenDatabase type) { int error = MsiInterop.MsiOpenDatabase(path, new IntPtr((int)type), out var handle); if (0 != error) { throw new MsiException(error); } this.Handle = handle; }