RA.Utilities.Data.Entities 10.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package RA.Utilities.Data.Entities --version 10.0.0
                    
NuGet\Install-Package RA.Utilities.Data.Entities -Version 10.0.0
                    
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="RA.Utilities.Data.Entities" Version="10.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RA.Utilities.Data.Entities" Version="10.0.0" />
                    
Directory.Packages.props
<PackageReference Include="RA.Utilities.Data.Entities" />
                    
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 RA.Utilities.Data.Entities --version 10.0.0
                    
#r "nuget: RA.Utilities.Data.Entities, 10.0.0"
                    
#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 RA.Utilities.Data.Entities@10.0.0
                    
#: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=RA.Utilities.Data.Entities&version=10.0.0
                    
Install as a Cake Addin
#tool nuget:?package=RA.Utilities.Data.Entities&version=10.0.0
                    
Install as a Cake Tool

RA.Utilities.Data.Entities

NuGet version Codecov NuGet Downloads Documentation GitHub license

This package provides a set of core abstractions and base classes for data entities within the RA.Utilities ecosystem. It helps solve the problem of boilerplate and inconsistency in data models by providing common interfaces like IEntity<T> and base classes with standard properties like Id, CreatedDate, and UpdatedDate.

The primary goal is to promote consistency and reduce repetitive code when creating data entities for use with an ORM like Entity Framework Core.

Getting started

You can install the package via the .NET CLI:

dotnet add package RA.Utilities.Data.Entities

Or through the NuGet Package Manager in Visual Studio.

Usage

To use the package, simply have your entity classes inherit from one of the provided base classes. This automatically gives your entities a primary key and auditing fields.

BaseEntity<T>

This is the most common base class. It provides an Id property of a specified type T, along with CreatedDate and UpdatedDate for auditing.

Here is an example of a Product entity inheriting from BaseEntity<int>:

using RA.Utilities.Data.Entities;

public class Product : BaseEntity<int>
{
    public string Name { get; set; } = string.Empty;
    public string? Description { get; set; }
    public decimal Price { get; set; }
}

When you create an instance of this Product class, it will have the following properties:

  • Id (int)
  • CreatedDate (DateTime)
  • UpdatedDate (DateTime?)
  • Name (string)
  • Description (string?)
  • Price (decimal)

BaseEntity

This is a non-generic version that provides a Guid as the primary key type.

using RA.Utilities.Data.Entities;

public class Order : BaseEntity
{
    public DateTime OrderDate { get; set; }
    public decimal TotalAmount { get; set; }
    
    // Foreign key
    public Guid CustomerId { get; set; }
}

This Order class will have an Id property of type Guid.

Using with Entity Framework Core

These base entities work seamlessly with EF Core. You can configure the properties in your DbContext.

using Microsoft.EntityFrameworkCore;

public class AppDbContext : DbContext
{
    public DbSet<Product> Products { get; set; }
    public DbSet<Order> Orders { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Product>(entity =>
        {
            entity.HasKey(e => e.Id);
            entity.Property(e => e.Name).IsRequired().HasMaxLength(100);
            entity.Property(e => e.Price).HasColumnType("decimal(18,2)");
        });
    }
}

Additional documentation

For more information on how this package fits into the larger RA.Utilities ecosystem, please see the main officiary documentation.

Feedback

If you have suggestions or find a bug, please open an issue in the RA.Utilities GitHub repository. Contributions are welcome!

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on RA.Utilities.Data.Entities:

Package Downloads
RA.Utilities.Data.Abstractions

Provides a collection of essential data access abstractions, including the Repository and Unit of Work patterns. This library helps create a decoupled and testable data access layer in .NET applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.1 257 12/14/2025
10.0.0 220 11/24/2025
10.0.0-rc.2 162 10/30/2025