RedMask.framework
1.0.1
See the version list below for details.
dotnet new install RedMask.framework::1.0.1
RedMaskFramework
small and light framework to help you develop your apps using DDD concepts aucha as IAgreegateRoot,ValueObject,Entity and ....
Aggregates
Aggregates are the basic element of transfer of data storage � you request to load or save whole aggregates. Transactions should not cross aggregate boundaries.
public class User : AggregateRoot<long>
{
public User( string actorUserName, string password,Email email)
{
ActorUserName = actorUserName;
Password = password;
Email=email;
}
public string ActorUserName { get; private set; }
public string Password { get; private set; }
public Email Email {get; private set;}
List<UserActivity> _activities=[];
public IReadOnlyCollection<UserActivity> Activities => _activities.AsReadOnly();
List<DynamicData> _dynamicData=[];
public IReadOnlyCollection<DynamicData> DynamicData => _dynamicData.AsReadOnly();
}
Entity
Many objects are not fundamentally defined by their attributes, but rather by a thread of continuity and identity.
public class UserActivity : Entity<long>
{
public UserActivity(DateTime dateTime, string actorIp, string action, string controller, string area)
{
DateTime = dateTime;
ActorIp = actorIp;
Action = action;
Controller = controller;
Area = area;
}
public DateTime DateTime { get; private set; }
public long UserId { get; private set; }
public string ActorIp { get; private set; }
public string Action { get; private set; }
public string Controller { get; private set; }
public string Area { get; private set; }
}
ValueObject
A value object is a small object that represents a simple entity whose equality is not based on identity: i.e. two value objects are equal when they have the same value, not necessarily being the same object.
public sealed record Email : ValueObject
{}
or
public sealed record DynamicData : ValueObjectEntity
{
public long Id { get; set; }
public string Key { get; set; }
public string Val { get; set; }
}
Repository
A repository (or repo) is a type of centrally located storage where you can keep all your project�s files and resources. Any of the project�s stakeholders or developers can pull your repository�s code (or resource) for new feature delivery or bug fixes in the product or software application.
public class UserRepository: IRepository<User>
{
//..... implementions
}
IUnitOfWork
public class BlogDbContext : DbContext, IUnitOfWork
{
public BlogDbContext(DbContextOptions<BlogDbContext> options) : base(options) { }
public DbSet<User> Users { get; set; }
}
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.