-
-
Notifications
You must be signed in to change notification settings - Fork 6
Basic
The basic part of the DataAccess project is the DbAccessLayer class. It contains several Generic and non generic functions to perform the 4 basic actions for each database.
- Select
- Update
- Delete
- Refresh
The DbAccessLayer relies on an internal configuration that can be filled by using ether Attributes contained in the JPB.DataAccess.ModelsAnotations
namespace. The most important one would be the ForModel attribute. This attribute allows you to "Rename" an property and maps this to an corresponding result Column. Use this if you want to mix conventions of you'r code with naming conventions on Database level. For example a column on a table is named 'User_Id' but you want to name the property just 'Id'. Then decorate the property with the ForModel attribute.
There are 2 ways to select something from the database:
- Selecting full Entitys (single [Annotation required] or multibe)
- With Query Generation
- Without Query Generation
- With Factory usage
- Selecting Scalar Values
- Without Query Generation
For full Entitys you can choose to ether to:
- Let the Framework generate the select statement
- Provide you'r own statement that should return a ResultSet that matches the configuration of the given type
- Create a factory function that provides conditional statements based on given Arguments or the internal state of Entity
By taking care of an eventually exiting RowVersion field (Annotation required) the Entity will be updated on the Server. This requires an existing and filled PrimaryKey (Annotation required)
Deletes a single Row from the server by using the PrimaryKey (Annotation required)
This is a non Database related function. It allows to refresh all Propertys on a given Entity by using its PrimaryKey (Annotation required)