TypeExtensions.PocoBuilder 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TypeExtensions.PocoBuilder --version 1.0.0                
NuGet\Install-Package TypeExtensions.PocoBuilder -Version 1.0.0                
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="TypeExtensions.PocoBuilder" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TypeExtensions.PocoBuilder --version 1.0.0                
#r "nuget: TypeExtensions.PocoBuilder, 1.0.0"                
#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 TypeExtensions.PocoBuilder as a Cake Addin
#addin nuget:?package=TypeExtensions.PocoBuilder&version=1.0.0

// Install TypeExtensions.PocoBuilder as a Cake Tool
#tool nuget:?package=TypeExtensions.PocoBuilder&version=1.0.0                

POCO Builder

CI NuGet
Quality Gate Status Coverage Security Rating Maintainability Rating Reliability Rating

What is POCO Builder?

POCO builder is a light-weight library that creates POCO (Plain Old CLR Object) type at runtime from any compile time definied type. All properies defined in POCO type has automatically created getters and setters and can be extended with attributes just like the type itself.

How do I get started?

Just install NuGet package and use PocoTypeBuilder generic class to create new POCO type. For example:

//Define test class to create POCO type from
public class TestClass
{
    public string Property { get; }

    public TestClass(string property)
    {
        Property = property;
    }
}

//Define test attribute to extend POCO type and its property
public class TestAttribute : Attribute
{
}

//Create POCO type builder for test class
var pocoTypeBuilder = new PocoTypeBuilder<TestClass>();

//Extend build POCO type and its property with attribute
pocoTypeBuilder
    .AddAttribute<TestAttribute>()
    .Property(type => type.Property,
        propertyBuilder => propertyBuilder.AddAttribute<TestAttribute>());
        
//Build POCO type
var pocoType = pocoTypeBuilder.Build();

//Access POCO type property through reflection.
var propertyInfo = pocoType.GetRuntimeProperty("Property");

You can check out more examples in test project.

Contribution

Welcome to join in and feel free to contribute by creating an Issue or Pull Request.

License

The project is under MIT license.

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
1.0.4 1,296 5/22/2023
1.0.3 200 4/13/2023
1.0.2 328 12/3/2022
1.0.1 331 12/2/2022
1.0.0 341 12/1/2022