Skip to content

Data Manager

Liam edited this page Mar 26, 2021 · 2 revisions

The data manager is a manager for the users data that controls how data is processed. It should act like a unit of work class.

To create your own you can inherit from the IDataManager interface.

What a data manager needs

The data manager needs to implment the following methods.

Read

The read method should use the data worker to get the data object requeeted.

Read many

The overload of read takes in a list of Ids and should simple call the read method multiple times.

ReadAll

This method should use the data worker to get all the data object for the type and return all.

ReadIndex

This method should use the index worker to get the ids from the index with the key and then call read many to return the results.

Write

This method should write data using the data worker and handle calling the audit and index works when needed.

Delete

This method should use the data worker to delete the data and handle calling the audit and index works when needed.

Restore

This method should use the data worker to restore data that was soft deleted and handle calling the audit and index works when needed.

GetNextId

This method should use the data worker to get the next available id for the data type

GetAuditLog

This method should use the audit worker to get the audit log for the requested data object.

Extending the data manager

The default data manager handles alot of the havy work of calling the works in the right order but if you need to change this or want to add in extra bits then you will need to implment your own data manager however you might be able to inherit from the default one and override the methods you want to change or provide extra methods that are not provided as standard.