ObjectStructure 1.0.1
See the version list below for details.
dotnet add package ObjectStructure --version 1.0.1
NuGet\Install-Package ObjectStructure -Version 1.0.1
<PackageReference Include="ObjectStructure" Version="1.0.1" />
paket add ObjectStructure --version 1.0.1
#r "nuget: ObjectStructure, 1.0.1"
// Install ObjectStructure as a Cake Addin #addin nuget:?package=ObjectStructure&version=1.0.1 // Install ObjectStructure as a Cake Tool #tool nuget:?package=ObjectStructure&version=1.0.1
ObjectStructure
A libary that creates a flat structure for types and a flat key-value structure for instances.
Usage
If you just ant to create the schema of a type just pass it to the IStructureBuilder
.
IStructureBuilder builder = new StructureBuilder();
Structure structure = builder.CreateStructure<Customer>();
Console.WriteLine(structure.Schema);
This will result in a flat list of the property structure of the type Customer
.
FirstName
LastName
Address
Address.Street
Address.Number
Address.Zip
Address.City
Address.Country
Tags
To create the schema and accessors for the values of an instance pass the instance to the IStructureBuilder
.
Customer customer = new Customer
{
FirstName = "Sherlock",
LastName = "Holmes",
Address = new Address
{
Street = "Baker Street",
Number = "221b",
Zip = "NW1",
City = "London",
Country = "England"
},
Tags = new string[] { "detective", "addict" }
};
IStructureBuilder builder = new StructureBuilder();
Structure structure = builder.CreateStructure(customer);
Console.WriteLine(structure.Indices);
This will result in a flat list of the property values in the given instance of type Customer
.
FirstName = "Sherlock"
LastName = "Holmes"
Address = "ConsoleApp1.Address"
Address.Street = "Baker Street"
Address.Number = "221b"
Address.Zip = "NW1"
Address.City = "London"
Address.Country = "England"
Tags = "System.String[]"
Tags[0] = "detective"
Tags[1] = "addict"
Acknowledgement
Most of the terminology and code structure of the library comes from the libary Structurizer
by Daniel Wertheim. This is basically a fork of his work which I bent to my needs, f.e. the need
to support null
values in index values and some other fixes and tweaks. I completely remove the configuration part and added the
ability to just get the schema of a type. The library this work is based on is licensed under the MIT license and so it this library.
References
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Fluxera.Guards (>= 6.0.22)
- Fluxera.Utilities (>= 6.0.16)
- JetBrains.Annotations (>= 2022.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.