Learn Dapper: https://www.learndapper.com/
Dapper Tutorial: https://dappertutorial.net/
Info
Version: | 1.0.0 |
Author(s): | EZCRUD |
Last Update: | Saturday, July 18, 2020 |
.NET Fiddle: | Create the first Fiddle |
NuGet Url: | https://www.nuget.org/packages/EZCRUD |
Install
Install-Package EZCRUD
dotnet add package EZCRUD
paket add EZCRUD
EZCRUD Download (Unzip the "nupkg" after downloading)
Dependencies
- Microsoft.CSharp(>= 4.7.0)
- Microsoft.Extensions.Configuration.Abstractions(>= 3.1.5)
- System.ComponentModel.Annotations(>= 4.7.0)
- System.Data.SqlClient(>= 4.8.1)
- System.Runtime(>= 4.3.1)
Tags
Example: var childUsers = new Users().SelectWhereOrderBy("Age <= 17");
How to implement:
- Add EZCRUD reference to your model library.
- Inherit Model_RecordBase for each model.
- Set EZCRUD's connection string ("DBAccess.DBSettings.ConnectionString = <your connection string>" in your Startup.cs
Now all of your models have CRUD functionality!
Available methods:
- <yourModel>.AddRecord(); // adds the current model instance as a new record in the database
- <yourModel>.UpdateRecord(); // updates the database table with the matching ID
- <yourModel>.DeleteRecord(); // deletes the database table with the matching ID
- <yourModel>.SelectAll(); // returns all records, of the current model type, from the database.
Equivalent to: SELECT * FROM <yourModelType>
- <yourModel>.SelectWhereOrderBy(optional sWhere/sOrderBy); // returns an arbitrary set of records that matches the provided where phrase
Equivalent to: SELECT * FROM <Table> WHERE <sWhere> ORDER BY <sOrderBy>
- <yourModel>.LoadRecord(id); // loads the record from the database table with the matching id and populates the
current model instance using the retreived data.
- <yourModel>.LoadRecordWhere(sWhere); // loads the record from the database table that meets the where phrase criteria and populates the current model instance using the retreived data.