uBeac.Common 0.43.2

There is a newer version of this package available.
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
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="uBeac.Common" Version="0.43.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add uBeac.Common --version 0.43.2
#r "nuget: uBeac.Common, 0.43.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install uBeac.Common as a Cake Addin
#addin nuget:?package=uBeac.Common&version=0.43.2

// Install uBeac.Common as a Cake Tool
#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 contains TraceId, SessionId, Duration, Code, Errors and Debug
  • IListResult - ListResult : Used to return a IEnumerable<T> with pagination data PageSize, TotalPages, PageNumber, TotalCount, HasPrevious, HasNext - NOTE: This model inherits from IResult and Result

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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,144 10/21/2022
0.43.13 2,141 8/15/2022
0.43.12 2,259 7/20/2022
0.43.11 2,205 6/23/2022
0.43.10 2,131 6/23/2022
0.43.9 2,164 6/22/2022
0.43.8 2,179 6/22/2022
0.43.7 2,070 6/22/2022
0.43.6 2,172 5/29/2022
0.43.5 2,217 5/18/2022
0.43.4 2,154 5/18/2022
0.43.3 2,192 5/18/2022
0.43.2 2,131 5/13/2022
0.43.1 2,126 5/8/2022
0.43.0 2,080 5/8/2022
0.42.0 2,054 5/8/2022
0.40.0 2,047 5/1/2022
0.39.0 2,082 4/23/2022
0.38.0 2,117 4/15/2022
0.37.0 1,729 4/13/2022
0.36.0 1,729 4/13/2022
0.34.0 1,403 4/13/2022
0.33.0 1,463 4/9/2022
0.32.0 1,447 4/4/2022
0.31.0 1,468 4/3/2022
0.30.0 1,462 4/3/2022
0.29.0 1,443 4/1/2022
0.28.0 1,326 4/1/2022
0.27.0 1,456 3/31/2022
0.26.0 1,457 3/31/2022
0.25.0 1,442 3/29/2022
0.24.0 1,426 3/29/2022
0.23.0 1,436 3/29/2022
0.22.0 1,440 3/29/2022
0.21.0 1,339 3/28/2022
0.20.0 1,315 3/28/2022
0.19.1 1,469 3/28/2022
0.19.0 1,487 3/28/2022
0.18.0 1,341 3/27/2022
0.17.6 1,337 3/27/2022
0.17.5 1,353 3/27/2022
0.17.4 1,330 3/27/2022
0.17.3 1,344 3/27/2022
0.17.2 1,310 3/27/2022
0.17.1 1,113 3/27/2022
0.17.0 1,299 3/27/2022
0.16.0 1,335 3/27/2022
0.15.0 1,321 3/23/2022
0.14.0 1,312 3/23/2022
0.13.0 1,335 3/14/2022
0.12.0 1,306 3/14/2022
0.11.2 1,324 3/14/2022
0.11.1 1,359 3/14/2022
0.11.0 1,361 3/13/2022
0.10.0 1,340 3/13/2022
0.9.1 1,329 3/12/2022
0.9.0 1,328 3/12/2022
0.8.1-alpha 286 3/9/2022
0.8.0-alpha 245 3/9/2022
0.7.1 1,340 3/2/2022
0.7.0 1,352 2/28/2022
0.6.4-alpha 287 2/27/2022
0.6.3-alpha 288 2/21/2022
0.6.2-alpha 283 2/21/2022
0.6.1-alpha 302 2/20/2022
0.5.2-alpha 290 2/20/2022
0.5.1-alpha 290 2/19/2022
0.4.1-alpha 291 2/18/2022
0.3.1-alpha 279 2/16/2022
0.2.1-alpha 262 2/16/2022
0.1.5 1,325 2/16/2022
0.1.4 1,336 2/15/2022
0.1.3 1,323 2/15/2022
0.1.2 1,554 2/14/2022
0.1.1 1,121 2/14/2022