Moro.Framework.Data.EntityFramework 2.0.1

dotnet add package Moro.Framework.Data.EntityFramework --version 2.0.1
NuGet\Install-Package Moro.Framework.Data.EntityFramework -Version 2.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Moro.Framework.Data.EntityFramework" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Moro.Framework.Data.EntityFramework --version 2.0.1
#r "nuget: Moro.Framework.Data.EntityFramework, 2.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Moro.Framework.Data.EntityFramework as a Cake Addin
#addin nuget:?package=Moro.Framework.Data.EntityFramework&version=2.0.1

// Install Moro.Framework.Data.EntityFramework as a Cake Tool
#tool nuget:?package=Moro.Framework.Data.EntityFramework&version=2.0.1

Overview

This framework provides an abstraction layer for working with Entity Framework 6. It includes the following classes:

  • EFUnitOfWork: Implements the Unit of Work pattern.
  • IEFBaseRepository: Defines the base repository interface.
  • EFBaseRepository: Implements the base repository.
  • IEFSpecification: Defines the specification interface.
  • EFCompositeSpecification: Implements the composite specification.
  • EFAndSpecification: Implements the AND specification.
  • EFOrSpecification: Implements the OR specification.
  • EFNotSpecification: Implements the NOT specification.
  • ExpressionExtension: Provides extensions for expressions.

Dependencies

This framework depends on the following:

  • Moro.Framework.Data
  • .NET 5.0
  • EntityFramework 6

Installation

To install the Moro.Framework.Data.EntityFramework package, run the following command in the Package Manager Console:

PM> Install-Package Moro.Framework.Data.EntityFramework

How to use

To use this framework, follow the steps below:

  1. Add the Moro.Framework.Data.EntityFramework NuGet package to your project.
  2. Create a class that inherits from EFBaseRepository.
  3. Implement the IEFBaseRepository and IEFSpecification interfaces.
  4. Use the Unit of Work pattern to save changes to the database.

Example

Below is an example of how to use this framework:

using Moro.Framework.Data.EntityFramework;

public class MyRepository : EFBaseRepository<MyEntity>, IMyRepository
{
    public MyRepository(DbContext context) : base(context)
    {
    }

    public IEnumerable<MyEntity> GetEntitiesBySpecification(ISpecification<MyEntity> specification)
    {
        return GetEntities(specification);
    }
}

public interface IMyRepository : IEFBaseRepository<MyEntity>
{
    IEnumerable<MyEntity> GetEntitiesBySpecification(ISpecification<MyEntity> specification);
}

public class MyEntity
{
    public int Id { get; set; }
    public string Name { get; set; }
}

public class MySpecification : CompositeSpecification<MyEntity>
{
    public override Expression<Func<MyEntity, bool>> ToExpression()
    {
        return entity => entity.Id == 1 && entity.Name == "Test";
    }
}

## Testing

To run the automated tests for this project, run the following command in the Package Manager Console:

PM> Test-Project Moro.Framework.Data.EntityFramework.Tests


## Contributing

Contributions are welcome! Please feel free to submit a pull request if you find any bugs or have any suggestions for improvement.

## 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 180 12/17/2023

This release converted the framework to .NET 5.0.