OLT.Core.Attribute.Abstractions 9.0.0-beta-0007

Prefix Reserved
This is a prerelease version of OLT.Core.Attribute.Abstractions.
dotnet add package OLT.Core.Attribute.Abstractions --version 9.0.0-beta-0007                
NuGet\Install-Package OLT.Core.Attribute.Abstractions -Version 9.0.0-beta-0007                
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="OLT.Core.Attribute.Abstractions" Version="9.0.0-beta-0007" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OLT.Core.Attribute.Abstractions --version 9.0.0-beta-0007                
#r "nuget: OLT.Core.Attribute.Abstractions, 9.0.0-beta-0007"                
#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 OLT.Core.Attribute.Abstractions as a Cake Addin
#addin nuget:?package=OLT.Core.Attribute.Abstractions&version=9.0.0-beta-0007&prerelease

// Install OLT.Core.Attribute.Abstractions as a Cake Tool
#tool nuget:?package=OLT.Core.Attribute.Abstractions&version=9.0.0-beta-0007&prerelease                

CI Quality Gate Status

Custom Attribute Classes

CodeAttribute & DescriptionAttribute

Enum Attribute to add a Code string value to an enum

NOTE: Description attrbute is found in the System.ComponentModel.DescriptionAttribute

public enum ApplicationTypes
{
    [Code("new-app")] 
    [Description("New Application")] 
    New = 1000,

    [Code("renew-app")] 
    [Description("Renew Application")] 
    Renew = 2000,
}
GetCodeEnum Extension

Extension to return string value from CodeAttribute

ApplicationTypes.New.GetCodeEnum();  //new-app

ApplicationTypes.Renew.GetDescription();  //Renew Application

KeyValueAttribute

public enum ApplicationTypes
{
    [KeyValue("Custom", "Another Test 1")]
    New = 1000,

    [KeyValue("Custom", "Value Test 2")]
    [KeyValue("Another", "Another Value")]
    Renew = 2000,
}
GetKeyValueAttributes Extension

Extension to return KeyValueAttribute from Enum

ApplicationTypes.New.GetKeyValueAttributes().FirstOrDefault(p => p.Key == "Custom")?.Value;


ApplicationTypes.Renew.GetKeyValueAttributes().Where(p => p.Key == "Custom");

UniqueIdAttribute

public enum ApplicationTypes
{
    [UniqueId("1393fff9-3850-4bb2-848b-18973a9f88d0")]
    New = 1000,
}
GetKeyValueAttributes Extension

Extension to return Guid value from UniqueId

var uid = OltAttributeExtensions.GetAttributeInstance<UniqueIdAttribute, ApplicationTypes>(ApplicationTypes.New)?.UniqueId;

SortOrderAttribute

public enum ApplicationTypes
{
    [SortOrder(10)]
    New = 1000,
}
OltSortOrderAttributeExtensions Extension

Extension to return Sort Order or default value

var sortOrder = ApplicationTypes.New.GetSortOrderEnum();

Not Empty Attributes

Utility/Item/Object Description
OltNotGuidEmptyAttribute Validation that Guid is not Guid.Empty
OltNotNullAttribute Validation that object is not null

public class MyPersonModel
{
    [OltNotGuidEmpty]
    public Guid Id { get; set; }

    [StringLength(100)]
    [Required(AllowEmptyStrings = false)]
    public string Value { get; set; }

    [OltNotNull]
    public MyOtherModel Other { get; set; }

}

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on OLT.Core.Attribute.Abstractions:

Package Downloads
OLT.Core.Common

Contains common generic assets and contstants for OLT Packages

OLT.Core.Model.Abstractions

Package Description

OLT.Core.Identity.Abstractions

Package Description

OLT.Core.EntityFrameworkCore.Abstractions

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.0.0-beta-0007 88 12/9/2024
9.0.0-beta-0005 56 12/2/2024
8.4.0-beta-0010 153 11/7/2024
8.4.0-beta-0005 144 10/9/2024