18 using System.Collections.Generic;
45 DiscoverDataVersion();
77 public string Name {
get;
private set; }
101 return new Dictionary<string, object> {
111 if (dataVerion != null)
117 GC.SuppressFinalize(
this);
132 if (TableComposite != null)
133 TableComposite.Dispose();
139 System.RemoveDatabase(
this);
144 TableComposite = null;
163 public Version Version {
get;
private set; }
178 return TableComposite.Exists();
179 }
catch (IOException e) {
180 throw new Exception(
"An error occurred while testing database existence.", e);
190 public bool IsOpen {
get;
private set; }
198 public ITable SingleRowTable {
get;
private set; }
202 if (callbacks != null) {
203 foreach (var callback
in callbacks) {
205 if (callback != null)
207 }
catch (Exception) {
240 public void Create(
string adminName,
string adminPassword) {
244 if (String.IsNullOrEmpty(adminName))
245 throw new ArgumentNullException(
"adminName");
246 if (String.IsNullOrEmpty(adminPassword))
247 throw new ArgumentNullException(
"adminPassword");
251 TableComposite.Create();
253 using (var session = this.CreateInitialSystemSession()) {
254 using (var context = session.CreateQuery()) {
259 CreateSchemata(context);
265 context.CreatePublicUser();
271 this.CreateAdminUser(context, adminName, adminPassword);
273 SetCurrentDataVersion(context);
278 OnDatabaseCreate(context);
288 }
catch (Exception ex) {
295 TableComposite.Close();
298 }
catch (Exception e) {
313 }
catch (Exception ex) {
344 if (!TableComposite.Exists())
350 TableComposite.Open();
355 }
catch (Exception e) {
386 TableComposite.Delete();
389 TableComposite.Close();
393 }
catch (Exception e) {
400 #region DatabaseTransactionFactory
406 this.database = database;
417 transaction = database.TableComposite.CreateTransaction(isolation);
420 }
catch (Exception ex) {
Defines the metadata properties of a column within a table of a database.
Defines the contract to access the data contained into a table of a database.
static void CreateTables(IQuery context)
Defines the callback that a IDatabase.Create function calls right before the finalization of the data...
The context of a single database within a system.
Defines the required features to factory transactions within a relational system. ...
~Database()
Finalizes an instance of the Database class.
void OnDatabaseCreate(IQuery context)
virtual void Dispose(bool disposing)
void Close()
Closes the database making it not accessible to connections.
The default implementation of a database in a system.
Exception thrown where various problems occur within the database.
Database(DatabaseSystem system, IDatabaseContext context)
void SetCurrentDataVersion(IQuery context)
The representation of a single database in the system.
Manages all the open sessions towards a single database within as system.
IEventSource ParentSource
Gets an optional parent source.
IEnumerable< KeyValuePair< string, object > > Metadata
Gets the list of metadata associated to the source.
void Dispose(bool disposing)
void CreateSchemata(IQuery context)
void Create(string adminName, string adminPassword)
Creates the database in the context given, granting the administrative control to the user identified...
void Open()
Opens the database making it ready to be accessed.
Provides utilities and properties for handling the SYSTEN schema of a database.
ITransaction CreateTransaction(IsolationLevel isolation)
Creates a new the transaction with the isolation specified.
DatabaseTransactionFactory(Database database)
void OnDatabaseCreate(IQuery context)
Called when the database is created and before the finalization of the initialization process...
const string Name
The name of the system schema that contains tables referring to system information.
readonly Database database
static void Create(IQuery context)
The simplest implementation of a transaction.
void DiscoverDataVersion()
Represents the origin of system events, providing a mechanism to fill the metadata before dispatching...