GaEpd.AppLibrary 1.0.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package GaEpd.AppLibrary --version 1.0.1
NuGet\Install-Package GaEpd.AppLibrary -Version 1.0.1
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="GaEpd.AppLibrary" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GaEpd.AppLibrary --version 1.0.1
#r "nuget: GaEpd.AppLibrary, 1.0.1"
#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 GaEpd.AppLibrary as a Cake Addin
#addin nuget:?package=GaEpd.AppLibrary&version=1.0.1

// Install GaEpd.AppLibrary as a Cake Tool
#tool nuget:?package=GaEpd.AppLibrary&version=1.0.1

Georgia EPD-IT App Library

This library was created by Georgia EPD-IT to provide common classes and tools for our web applications. (Much of this work was inspired by the ABP Framework.)

.NET Test CodeQL SonarCloud Quality Gate Status Lines of Code

How to install

To install , search for "GaEpd.AppLibrary" in the NuGet package manager or run the following command:

dotnet add package GaEpd.AppLibrary

What's included

Guard clauses

Guard clauses simplify checking for invalid input parameters. (This might be moved to a separate package later or replaced with a third-party tool like ardalis/GuardClauses.)

Example usage:

public class SomeClass
{
    private readonly string _name;

    public SomeClass(string name)
    {
        _name = Guard.NotNullOrWhiteSpace(name);
    }
}

Domain entities

The following interfaces and abstract implementations of domain entities are provided for domain driven design:

  • The basic IEntity<TKey> interface defines a basic entity with a primary key of the given type.
  • IAuditableEntitey<TUserKey> adds creation/update properties and methods for basic data auditing.
  • ISoftDelete<TUserKey> adds properties for "soft deleting" an entity rather than actually deleting it.

There are also abstract classes based on the above that you can derive your domain entities from, including Entity<TKey>, AuditableEntity<TKey, TUserKey>, SoftDeleteEntity<TKey, TUserKey>, and AuditableSoftDeleteEntity<TKey, TUserKey>.

ValueObject

An abstract ValueObject record can help add value objects to your domain entities. A value object is a compound of properties, such as an address or date range, that are comparable based solely on their values rather than their references. The properties of a value object are typically stored with its parent class, not as a separate record with its own ID. Value objects should be treated as immutable. When deriving from ValueObject, you will have to provide a GetEqualityComponents() method to define which properties to use to determine equality.

Example usage:

[Owned]
public record Address : ValueObject
{
    public string Street { get; init; } = string.Empty;
    public string? Street2 { get; init; }
    public string City { get; init; } = string.Empty;
    public string State { get; init; } = string.Empty;

    [DataType(DataType.PostalCode)]
    public string PostalCode { get; init; } = string.Empty;

    protected override IEnumerable<object> GetEqualityComponents()
    {
        yield return Street;
        yield return Street2 ?? string.Empty;
        yield return City;
        yield return State;
        yield return PostalCode;
    }
}

Note: The [Owned] attribute is an Entity Framework attribute defining this as a value object owned by the parent class. See Owned Entity Types for more info on how this is implemented in EF Core.

Repository interfaces

Common repository interfaces define basic entity CRUD operations. The IReadOnlyRepository<TEntity, in TKey> interface defines get and search operations (including paginated search). IRepository<TEntity, in TKey> adds write operations.

Note that these interfaces work directly with domain entities. Your application should define application/domain services that define how the application interacts with the entities & repositories through data transfer objects (DTOs).

Pagination classes

IPaginatedRequest and IPaginatedResult<T> define how to request and receive paginated (and sorted) search results.

List Item record

A ListItem<TKey> record type defines a key-value pair with fields for ID of type TKey and string Name. The ToSelectList() extension method takes a ListItem enumerable and returns an MVC SelectList which can be used to create an HTML <select> element.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.2.1 385 4/30/2024
5.2.0 97 4/29/2024
5.1.0 940 1/3/2024
5.0.1 96 1/2/2024
5.0.0 104 1/2/2024
4.1.0 547 11/9/2023
4.0.0 180 10/25/2023
3.5.1 327 9/20/2023
3.5.0 137 9/19/2023
3.4.0 109 9/18/2023
3.3.0 330 8/11/2023
3.2.0 577 5/22/2023
3.1.0 393 4/25/2023
3.0.0 707 3/27/2023
2.0.0 269 3/7/2023
1.1.0 651 12/22/2022
1.0.1 400 10/14/2022
1.0.0 828 10/6/2022
0.4.0-beta 199 9/29/2022
0.3.0-beta 178 9/23/2022

v1.0.1
- Added Readme file to package
v1.0.0
- Initial release