RA.Utilities.Data.Entities
10.0.0
Prefix Reserved
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
<PackageReference Include="RA.Utilities.Data.Entities" Version="10.0.0" />
<PackageVersion Include="RA.Utilities.Data.Entities" Version="10.0.0" />
<PackageReference Include="RA.Utilities.Data.Entities" />
paket add RA.Utilities.Data.Entities --version 10.0.0
#r "nuget: RA.Utilities.Data.Entities, 10.0.0"
#:package RA.Utilities.Data.Entities@10.0.0
#addin nuget:?package=RA.Utilities.Data.Entities&version=10.0.0
#tool nuget:?package=RA.Utilities.Data.Entities&version=10.0.0
RA.Utilities.Data.Entities
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 | Versions 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. |
-
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 |