uBeac.Common includes base entities, models, interfaces. This package has no external dependencies and is the core of all uBeac packages.
In all / most .NET projects there are a series of common modules whose implementation only wastes your time. Instead of re-implementing each of these modules in different projects, you can use a common library. This library is maintained and developed by a good community and you do not need to be involved in infrastructure.
Install the package with NuGet:
dotnet add package uBeac.Common
You can inherit from IEntity or Entity to implement your base entities:
public class YourEntity : IEntity<int>
{
}
public class YourEntity : IEntity
{
}
public class YourEntity : Entity<int>
{
}
public class YourEntity : Entity
{
}Default TKey of base entities is Guid. Therefore, if you do not specify TKey, Guid will be selected as TKey by default.
Or you can inherit from IAuditEntity or AuditEntity to implement your audit entities:
public class YourEntity : IAuditEntity<int>
{
}
public class YourEntity : IAuditEntity
{
}
public class YourEntity : AuditEntity<int>
{
}
public class YourEntity : AuditEntity
{
}
IAuditEntityinherited fromIEntity, And in addition to Id, it has other properties likeCreatedBy,CreatedAt,LastUpdatedBy,LastUpdatedAtand etc.
You can use two types of result models:
IResult/Result: This is base result model that containsTraceId,SessionId,Duration,Code,ErrorsandDebug.IListResult/ListResult: This is list result model that inherited from base result model, is used to return an IEnumerable with pagination dataPageSize,TotalPages,PageNumber,TotalCount,HasPrevious,HasNext.
There are several extension methods that you can use to generate results:
data.ToResult();
data.ToListResult();Enjoy!