AdapterModule 0.0.4

Suggested Alternatives

ModularSystem.Core

dotnet add package AdapterModule --version 0.0.4
NuGet\Install-Package AdapterModule -Version 0.0.4
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="AdapterModule" Version="0.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AdapterModule --version 0.0.4
#r "nuget: AdapterModule, 0.0.4"
#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 AdapterModule as a Cake Addin
#addin nuget:?package=AdapterModule&version=0.0.4

// Install AdapterModule as a Cake Tool
#tool nuget:?package=AdapterModule&version=0.0.4

Part of the service modular system standart .

To use it just call AdapterModule.

Ex:

PresentedType presented =  AdapterModule.Adapt<PresentedType>(object);
  • In the presented type you must tag the properties with the AdapterMarkerAttribute passing the equivalent property name in the object thats beign adapted to the AdapterMarkerAttribute constructor.

Ex:

public class User 
{ 
    public string Name;
}
public class PresentedUser
{
    [AdapterMarker("Name")]
    public string PresentedName;
}
  • You can optionally tell the adapter to use a custom method to adapt a property, to do that you must create a property in the presented object type called 'Adapters', the type must be * List<AdapterMethod<object, object>>. Use the optional second argument from the Marker constructor to tell the Adapter to use the custom method instead. The easiest way to do that is to extend the presented type class from the Adaptable class, and add the custom adapter method. The AdapterMethod object must contain the property taget name and a method from type Func<object, object>.

Ex:

public class User 
{ 
    public string Name;
}

public class PresentedUser : Adaptable
{
    [AdapterMarker("Name", true)]
    public string PresentedName;

    public PresentedUser()
    {
        Adapters.Add( new AdapterMethod(){ PropertyName = "Name", Method = (object property) => { return "Some code here..."; } } );
    }
}
Product 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.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.0.4 828 10/18/2020
0.0.3 749 10/18/2020
0.0.2 791 10/18/2020
0.0.1 756 10/17/2020