uBeac.Common
0.43.2
See the version list below for details.
dotnet add package uBeac.Common --version 0.43.2
NuGet\Install-Package uBeac.Common -Version 0.43.2
<PackageReference Include="uBeac.Common" Version="0.43.2" />
<PackageVersion Include="uBeac.Common" Version="0.43.2" />
<PackageReference Include="uBeac.Common" />
paket add uBeac.Common --version 0.43.2
#r "nuget: uBeac.Common, 0.43.2"
#addin nuget:?package=uBeac.Common&version=0.43.2
#tool nuget:?package=uBeac.Common&version=0.43.2
A Common Library For Your .NET Projects
uBeac.Common provides common interfaces, classes and extension methods in .NET projects without any external dependencies. Therefore, you can use single library / package instead of multiple libraries, packages and dependencies!
Getting Started
Install the package with NuGet:
dotnet add package uBeac.Common
Or:
Install-Package uBeac.Common
Common / Base / Audit Entities
Most projects require a common entity, which can be a class or an interface. You can use IEntity
or Entity
to implement your entities.
public class MyEntity : IEntity<int>
{
public int Id { get; set; }
}
public class MyEntity : IEntity
{
public Guid Id { get; set; }
}
public class MyEntity : Entity<int>
{
}
public class MyEntity : Entity
{
}
There is also another interface and class called IAuditEntity
and AuditEntity
that includes more properties like CreatedAt
, CreatedBy
, LastUpdatedAt
and LastUpdatedBy
.
public class MyEntity : IAuditEntity<int>
{
public int Id { get; set; }
public string CreatedBy { get; set; }
public DateTime CreatedAt { get; set; }
public string LastUpdatedBy { get; set; }
public DateTime LastUpdatedAt { get; set; }
}
public class MyEntity : IAuditEntity
{
public Guid Id { get; set; }
public string CreatedBy { get; set; }
public DateTime CreatedAt { get; set; }
public string LastUpdatedBy { get; set; }
public DateTime LastUpdatedAt { get; set; }
}
public class MyEntity : AuditEntity<int>
{
}
public class MyEntity : AuditEntity
{
}
Common Models
Each API consists of a set of request and result. In order to be able to provide good results, we need a base model of the result that is the same in our API. At uBeac.Common we offer two result models:
IResult
-Result
: This is base result model that containsTraceId
,SessionId
,Duration
,Code
,Errors
andDebug
IListResult
-ListResult
: Used to return a IEnumerable<T> with pagination dataPageSize
,TotalPages
,PageNumber
,TotalCount
,HasPrevious
,HasNext
- NOTE: This model inherits fromIResult
andResult
There are also several extension methods that you can use to generate results:
IListResult<T> ToListResult<T>(this IEnumerable<T> values)
IResult<T> ToResult<T>(this T value)
IListResult<T> ToListResult<T>(this Exception exception)
IResult<T> ToResult<T>(this Exception exception)
For example:
public async Task<IResult<bool>> Register(RegisterRequest request)
{
try
{
var data = await UserService.Register(request.UserName, request.Password);
return data.ToResult();
}
catch (Exception ex)
{
return ex.ToResult<bool>();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on uBeac.Common:
Package | Downloads |
---|---|
uBeac.Repositories.Abstractions
Contains abstractions for your repository layer! |
|
uBeac.Services.Abstractions
Contains abstractions for your service layer! |
|
uBeac.Logging
Easily implement logging in your .NET projects! |
|
uBeac.Web.Common
Contains common modules for your web projects! |
|
uBeac.Web.Logging
Easily implement HTTP request/response logging in your .NET projects! |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.43.14 | 2,299 | 10/21/2022 |
0.43.13 | 2,280 | 8/15/2022 |
0.43.12 | 2,414 | 7/20/2022 |
0.43.11 | 2,362 | 6/23/2022 |
0.43.10 | 2,274 | 6/23/2022 |
0.43.9 | 2,293 | 6/22/2022 |
0.43.8 | 2,332 | 6/22/2022 |
0.43.7 | 2,219 | 6/22/2022 |
0.43.6 | 2,284 | 5/29/2022 |
0.43.5 | 2,363 | 5/18/2022 |
0.43.4 | 2,295 | 5/18/2022 |
0.43.3 | 2,350 | 5/18/2022 |
0.43.2 | 2,272 | 5/13/2022 |
0.43.1 | 2,259 | 5/8/2022 |
0.43.0 | 2,221 | 5/8/2022 |
0.42.0 | 2,183 | 5/8/2022 |
0.40.0 | 2,182 | 5/1/2022 |
0.39.0 | 2,227 | 4/23/2022 |
0.38.0 | 2,259 | 4/15/2022 |
0.37.0 | 1,853 | 4/13/2022 |
0.36.0 | 1,845 | 4/13/2022 |
0.34.0 | 1,525 | 4/13/2022 |
0.33.0 | 1,568 | 4/9/2022 |
0.32.0 | 1,556 | 4/4/2022 |
0.31.0 | 1,571 | 4/3/2022 |
0.30.0 | 1,571 | 4/3/2022 |
0.29.0 | 1,558 | 4/1/2022 |
0.28.0 | 1,441 | 4/1/2022 |
0.27.0 | 1,558 | 3/31/2022 |
0.26.0 | 1,555 | 3/31/2022 |
0.25.0 | 1,559 | 3/29/2022 |
0.24.0 | 1,536 | 3/29/2022 |
0.23.0 | 1,550 | 3/29/2022 |
0.22.0 | 1,549 | 3/29/2022 |
0.21.0 | 1,433 | 3/28/2022 |
0.20.0 | 1,422 | 3/28/2022 |
0.19.1 | 1,570 | 3/28/2022 |
0.19.0 | 1,606 | 3/28/2022 |
0.18.0 | 1,444 | 3/27/2022 |
0.17.6 | 1,446 | 3/27/2022 |
0.17.5 | 1,466 | 3/27/2022 |
0.17.4 | 1,419 | 3/27/2022 |
0.17.3 | 1,450 | 3/27/2022 |
0.17.2 | 1,408 | 3/27/2022 |
0.17.1 | 1,211 | 3/27/2022 |
0.17.0 | 1,396 | 3/27/2022 |
0.16.0 | 1,441 | 3/27/2022 |
0.15.0 | 1,433 | 3/23/2022 |
0.14.0 | 1,419 | 3/23/2022 |
0.13.0 | 1,439 | 3/14/2022 |
0.12.0 | 1,400 | 3/14/2022 |
0.11.2 | 1,429 | 3/14/2022 |
0.11.1 | 1,458 | 3/14/2022 |
0.11.0 | 1,456 | 3/13/2022 |
0.10.0 | 1,448 | 3/13/2022 |
0.9.1 | 1,426 | 3/12/2022 |
0.9.0 | 1,435 | 3/12/2022 |
0.8.1-alpha | 390 | 3/9/2022 |
0.8.0-alpha | 331 | 3/9/2022 |
0.7.1 | 1,455 | 3/2/2022 |
0.7.0 | 1,456 | 2/28/2022 |
0.6.4-alpha | 370 | 2/27/2022 |
0.6.3-alpha | 386 | 2/21/2022 |
0.6.2-alpha | 382 | 2/21/2022 |
0.6.1-alpha | 400 | 2/20/2022 |
0.5.2-alpha | 374 | 2/20/2022 |
0.5.1-alpha | 384 | 2/19/2022 |
0.4.1-alpha | 390 | 2/18/2022 |
0.3.1-alpha | 375 | 2/16/2022 |
0.2.1-alpha | 359 | 2/16/2022 |
0.1.5 | 1,419 | 2/16/2022 |
0.1.4 | 1,437 | 2/15/2022 |
0.1.3 | 1,433 | 2/15/2022 |
0.1.2 | 1,664 | 2/14/2022 |
0.1.1 | 1,213 | 2/14/2022 |