RKSoftware.DAL.EntityFramework 9.0.1

dotnet add package RKSoftware.DAL.EntityFramework --version 9.0.1
                    
NuGet\Install-Package RKSoftware.DAL.EntityFramework -Version 9.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="RKSoftware.DAL.EntityFramework" Version="9.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RKSoftware.DAL.EntityFramework" Version="9.0.1" />
                    
Directory.Packages.props
<PackageReference Include="RKSoftware.DAL.EntityFramework" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RKSoftware.DAL.EntityFramework --version 9.0.1
                    
#r "nuget: RKSoftware.DAL.EntityFramework, 9.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.
#:package RKSoftware.DAL.EntityFramework@9.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RKSoftware.DAL.EntityFramework&version=9.0.1
                    
Install as a Cake Addin
#tool nuget:?package=RKSoftware.DAL.EntityFramework&version=9.0.1
                    
Install as a Cake Tool

RKSoftware.DAL.EntityFramework

NuGet License

Overview

RKSoftware.DAL.EntityFramework is a .NET library that provides an implementation of the RKSoftware.DAL.Core contracts using Entity Framework Core. It enables developers to leverage the power of Entity Framework Core while adhering to the abstractions defined in the RKSoftware.DAL.Core package.

This package is part of the RK Software Systems ecosystem and is designed to simplify the integration of Entity Framework Core into your Data Access Layer (DAL).

Features

  • Full implementation of RKSoftware.DAL.Core contracts using Entity Framework Core.
  • Supports transactional operations with ITransactionalStorage.
  • Simplifies CRUD operations with IStorage and IReadonlyStorage.
  • Compatible with .NET 9.0.
  • Extensible and easy to integrate with existing projects.

Installation

You can install the package via NuGet:

dotnet add package RKSoftware.DAL.EntityFramework --version 9.0.1

Or via the NuGet Package Manager in Visual Studio.

Usage

To use this package, reference it in your project and configure it with your Entity Framework Core DbContext. Below is an example of how to set up and use the RKSoftware.DAL.EntityFramework package:

Example

using System; using System.Threading.Tasks; 
using Microsoft.EntityFrameworkCore; 
using RKSoftware.DAL.EntityFramework;
using RKSoftware.DAL.Core;

public class MyDbContext : DbContext { public DbSet<MyEntity> MyEntities { get; set; } }

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

public class Example { 
  private readonly ITransactionalStorage _transactionalStorage;

  public Example(ITransactionalStorage transactionalStorage)
  {
      _transactionalStorage = transactionalStorage;
  }

  public async Task PerformOperationsAsync()
  {
      try
      {
          // Begin a transaction
          _transactionalStorage.BeginTransaction();
  
          // Add an entity
          var entity = new MyEntity { Id = 1, Name = "Sample Entity" };
          await _transactionalStorage.AddAsync(entity);
  
          // Commit the transaction
          await _transactionalStorage.CommitTransactionAsync();
          Console.WriteLine("Transaction committed successfully.");
      }
      catch (Exception ex)
      {
          Console.WriteLine($"An error occurred: {ex.Message}");
  
          // Rollback the transaction
          await _transactionalStorage.ResetTransactionAsync();
          Console.WriteLine("Transaction rolled back.");
      }
  }
}

Configuration

To use RKSoftware.DAL.EntityFramework, you can register its services in your dependency injection container using the provided extension methods from the DependencyRegistration class. Below is an example:

// Add your DbContext 
services.AddDbContext<MyDbContext>(options => options.UseSqlServer("YourConnectionString"));

// Register RKSoftware.DAL.EntityFramework services 
services.AddRKEFStorages();
Available Registration Methods
  • AddRKEFReadonlyStorage: Registers the IReadonlyStorage implementation.
  • AddRKEFQueryStorage: Registers the IQueryStorage implementation.
  • AddRKEFStorage: Registers the IStorage and ITransactionalStorage implementations.
  • AddRKEFStorages: Registers all the above implementations in one call.

Choose the appropriate method based on your requirements. For most use cases, AddRKEFStorages is sufficient as it registers all available storage implementations.

Documentation

For more details about the core contracts, refer to the RKSoftware.DAL.Core documentation.

Repository

The source code for this package is available on GitHub:

RKSoftware.DAL GitHub Repository

Feel free to contribute, report issues, or suggest features.

License

This package is licensed under the MIT OR Apache-2.0 license. You may choose either license to use this package. See the LICENSE file for more details.

Tags

  • DAL
  • RKSoftware
  • Entity Framework
  • .NET 9
  • Data Access Layer
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
9.0.1 151 4/18/2025
8.0.1 194 4/7/2025
2.0.1 2,458 4/24/2023
1.0.7 718 11/27/2022
1.0.6 1,245 1/2/2022
1.0.5 986 3/31/2021
1.0.4 435 3/31/2021
1.0.2 475 2/12/2021
1.0.1 437 2/6/2021
1.0.0 449 2/6/2021