Пример #1
0
 public Database(string filePath, string outputPath)
     : this((IntPtr)Database.Open(filePath, outputPath), true, outputPath, DatabaseOpenMode.CreateDirect)
 {
 }
Пример #2
0
 /// <summary>
 /// Opens an existing database or creates a new one.
 /// </summary>
 /// <param name="filePath">Path to the database file. If an empty string
 /// is supplied, a temporary database is created that is not persisted.</param>
 /// <param name="mode">Open mode for the database</param>
 /// <exception cref="InstallerException">the database could not be created/opened</exception>
 /// <remarks><p>
 /// Because this constructor initiates database access, it cannot be used with a
 /// running installation.
 /// </p><p>
 /// The database object should be <see cref="InstallerHandle.Close"/>d after use.
 /// The finalizer will close the handle if it is still open, however due to the nondeterministic
 /// nature of finalization it is best that the handle be closed manually as soon as it is no
 /// longer needed, as leaving lots of unused handles open can degrade performance.
 /// </p><p>
 /// A database opened in <see cref="DatabaseOpenMode.CreateDirect" /> or
 /// <see cref="DatabaseOpenMode.Direct" /> mode will be automatically commited when it is
 /// closed. However a database opened in <see cref="DatabaseOpenMode.Create" /> or
 /// <see cref="DatabaseOpenMode.Transact" /> mode must have the <see cref="Commit" /> method
 /// called before it is closed, otherwise no changes will be persisted.
 /// </p><p>
 /// Win32 MSI API:
 /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msiopendatabase.asp">MsiOpenDatabase</a>
 /// </p></remarks>
 public Database(string filePath, DatabaseOpenMode mode)
     : this((IntPtr)Database.Open(filePath, mode), true, filePath, mode)
 {
 }