TypeExtensions.PocoBuilder
1.0.0
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
<PackageReference Include="TypeExtensions.PocoBuilder" Version="1.0.0" />
paket add TypeExtensions.PocoBuilder --version 1.0.0
#r "nuget: TypeExtensions.PocoBuilder, 1.0.0"
// 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
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 | 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. |
-
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.