Skip to content

DatabaseHandler Methods

Felipe Bellini edited this page Jun 18, 2020 · 2 revisions

ClearHandler

Clears the current database handler. This causes the all internal properties to be set to default and the database xml files to be deleted.

public void ClearHandler();

CreateDatabase

Creates a database file of a type T that inherits from IDatabase.

  • <type_parameter> T is a type that inherits from the Interface.IDatabase interface.
public void CreateDatabase<T>() where T : IDatabase;

DeleteDatabase

Deletes a database file from the computer.

  • <type_parameter> T is a type that inherits from the Interface.IDatabase interface.
public void DeleteDatabase<T>() where T : IDatabase;

Get

Gets a selection of items that inherit from ICollectable object from their database collection.

  • <type_parameter> T is a type that inherits from the Interface.ICollectableObjectinterface.

Returns all items of the selected type T in the database.

public ICollection<T> Get<T>() where T : ICollectableObject;

Get

Gets a selection of items that inherit from ICollectable object from their database collection.

If propertyName and propertyValue are null, then returns all items of the selected type T in the database.

If propertyName and propertyValue are NOT null, then all items matching the query (propertyNames that have propertyValues as their value).

  • <type_parameter> T is a type that inherits from the Interface.ICollectableObjectinterface.
  • <method_parameter> propertyName = The name of a property defined in T
  • <method_parameter> propertyValue = The value of a property named 'propertyName' and defined in T

Returns all items of the selected type T in the database matching the input parameters.

public ICollection<T> Get<T>(string propertyName, object propertyValue) where T : ICollectableObject;

Insert

Inserts a selection of items that inherit from ICollectable object in their database collection.

  • <type_parameter> T is a type that inherits from the Interface.ICollectableObject interface.
  • <method_parameter> items = A collection of items of type T.
public void Insert<T>(ICollection<T> items) where T : ICollectableObject;

Remove

Removes a selection of items that inherit from ICollectable object from their database collection.

  • <type_parameter> T is a type that inherits from the Interface.ICollectableObject interface.
  • <method_parameter> items = A collection of items of type T.
public void Remove<T>(ICollection<T> items) where T : ICollectableObject;

Save

Saves a selection of items in its respective database.

  • <type_parameter> T is a type that inherits from the Interface.ICollectableObject interface.
  • <method_parameter> items = A collection of items of type T.
public void Save<T>(ICollection<T> items) where T : ICollectableObject;

SetWorkspace

Sets the workspace of this class. Type parameters must all inherit from IDatabase.

  • <method_parameter> workspace = A path to a folder.
  • <method_parameter> items = A collection of types.
public void SetWorkspace(string workspace, ICollection<Type> databaseTypes);

ImportDatabase

Sets the workspace of this class. Type parameters must all inherit from IDatabase.

  • <method_parameter> fileToImport = A full path to a database file.
  • <method_parameter> exportPath = A path to a folder.
public void ImportDatabase(string fileToImport, string exportPath);

ExportDatabase

Exports a group of database files to a single zipped file.

  • <method_parameter> pathToSave = A folder where the database file will be created.
  • <method_parameter> filename = A name for a new database file.
  • <method_parameter> fileExtension = An extension for the database file.
public void ExportDatabase(string pathToSave, string filename, string fileExtension = ".db");

Update

Updates a selection of items that inherit from ICollectable object in their database collection.

  • <type_parameter> T is a type that inherits from the Interface.ICollectableObject interface.
  • <method_parameter> items = A collection of items of type T.
public void Update<T>(ICollection<T> items) where T : ICollectableObject;