Moro.Framework.Data
2.0.1
dotnet add package Moro.Framework.Data --version 2.0.1
NuGet\Install-Package Moro.Framework.Data -Version 2.0.1
<PackageReference Include="Moro.Framework.Data" Version="2.0.1" />
paket add Moro.Framework.Data --version 2.0.1
#r "nuget: Moro.Framework.Data, 2.0.1"
// Install Moro.Framework.Data as a Cake Addin #addin nuget:?package=Moro.Framework.Data&version=2.0.1 // Install Moro.Framework.Data as a Cake Tool #tool nuget:?package=Moro.Framework.Data&version=2.0.1
Moro.Framework.Data
This project provides interfaces for the IUnitOfWork
, ISpecification<TEntity>
, and IRepository<TEntity>
classes, which are used to manage transactions, query data, and perform CRUD operations in the application.
Installation
To install the Moro.Framework.Data
package, run the following command in the Package Manager Console:
PM> Install-Package Moro.Framework.Data
Usage
To use the IUnitOfWork
interface, you must first create an instance of the UnitOfWork
class and then call the Commit
method to commit the transaction. Here is an example:
using (var unitOfWork = new UnitOfWork())
{
// Perform database operations here...
unitOfWork.Commit();
}
To use the ISpecification<TEntity>
interface, you must first create an instance of the AndSpecification<TEntity>
, OrSpecification<TEntity>
, or NotSpecification<TEntity>
class and then call the IsSatisfiedBy
method to check if an entity satisfies the specification. Here is an example:
var specification = new AndSpecification<TEntity>(leftSpecification, rightSpecification);
var isSatisfied = specification.IsSatisfiedBy(entity);
var specification = new OrSpecification<TEntity>(leftSpecification, rightSpecification);
var isSatisfied = specification.IsSatisfiedBy(entity);
var specification = new NotSpecification<TEntity>(specification);
var isSatisfied = specification.IsSatisfiedBy(entity);
To use the IRepository<TEntity>
interface, you must first create an instance of the Repository<TEntity>
class and then call the Insert
, Update
, Delete
, GetSingle
, GetList
, or GetList
method to perform CRUD operations on the entity. Here is an example:
using (var repository = new Repository<TEntity>())
{
// Insert a new entity
repository.Insert(entity);
// Update an existing entity
repository.Update(entity);
// Delete an existing entity
repository.Delete(entity);
// Get a single entity that satisfies the specification
var singleEntity = repository.GetSingle(specification);
// Get a list of entities that satisfy the specification
var entityList = repository.GetList(specification);
// Get a list of all entities
var allEntities = repository.GetList();
}
Contributing
Contributions are welcome! Please feel free to submit a pull request if you find any bugs or have any suggestions for improvement.
Dependencies
The Moro.Framework.Data
package has the following dependencies:
- .NET 5.0
Testing
To run the automated tests for this project, run the following command in the Package Manager Console:
PM> Test-Project Moro.Framework.Data.Tests
Reporting Bugs
If you find any bugs in this project, please report them by opening an issue on the GitHub repository.
I hope this helps! If you have any questions or need further assistance, please don't hesitate to ask.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Moro.Framework.Data:
Package | Downloads |
---|---|
Moro.Framework.Data.EntityFramework
Implementation of unit of work, repository and specification pattern for EntityFramework. |
GitHub repositories
This package is not used by any popular GitHub repositories.
This release converted de framework to .NET 5.