RA.Utilities.Data.Entities
Version 10.0.0
Updated version from 10.0.0-rc.2 to 10.0.0, indicating the release candidate phase has ended and the package is now considered stable for production use.
Version 10.0.0-rc.2
This release of RA.Utilities.Data.Entities provides a set of core abstractions and base classes for data entities. It helps solve the problem of boilerplate and inconsistency in data models by providing common interfaces and base classes with standard properties.
✨ Key Features
-
IEntity<T>Interface: A core abstraction that defines a contract for any entity with a typed identifier (Id). -
IAuditableInterface: Defines a contract for entities that need auditing fields, includingCreatedDateandUpdatedDate. -
BaseEntity<T>Class: An abstract base class that provides a ready-to-use implementation ofIEntity<T>andIAuditable. It includes:- A typed
Idproperty. CreatedDate(DateTime) andUpdatedDate(DateTime?) properties for auditing.
- A typed
-
BaseEntityClass: A non-generic convenience class that inherits fromBaseEntity<Guid>, providing aGuidas the default primary key type. -
Reduced Boilerplate: By inheriting from these base classes, you can significantly reduce repetitive code in your data models.
🚀 Getting Started
To use the package, simply have your entity classes inherit from one of the provided base classes.
Example with a specific key type (int)
public class Product : BaseEntity<int>
{
public string Name { get; set; } = string.Empty;
public decimal Price { get; set; }
}
Example with the default key type (Guid)
public class Order : BaseEntity
{
public DateTime OrderDate { get; set; }
}