Apps.Contextsphere.Uwp 1.0.2

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

// Install Apps.Contextsphere.Uwp as a Cake Tool
#tool nuget:?package=Apps.Contextsphere.Uwp&version=1.0.2                


Contextsphere facilitates clean separation of concerns by encapsulating app's functionalities in each its own context.

This design pattern is primarily aimed at front-end development usage. Whence a developer can write code in CQRS-oriented fashion without the bulk of using message buses/hubs.


Build your app's contexts in the root node class of your choice.

    public class MyRootNode : IRootNode, IHandle<MyHandledObject1>, IHandleAsync<MyHandledAsyncObject1> ...  

In the class' constructor

    public MyRootNode(IContext context, IRootNodeObject rootNodeObject, IChildNode1Object childNode1Object, IChildNode2Object childNode2Object ...)
        // 01.  core app context
         var rootContext = context.CreateContext(this, ContextType.Permanent);
        // 02.  first child context
        rootContext.CreateContext(new MyChildNode1(childNode1Object), ContextType.Permanent)
        // 03.  second child context (subsequent creation can be chained)
        .CreateContext(new MyChildNode2(childNode2Object), ContextType.Permanent)
        this.Context = rootContext;

In the consuming classes, use dependency injection to access instance of IRootNode.

private readonly IRootNode root;


// send calls thru the root node.
MyObject? result1 = root.Context.Handle<MyObject>();
MyObject? result2 = await root.Context.HandleAsync<MyObject>();
MyObject? result3 = root.Context.Handle<MyParam, MyObject>(myParamInstance);
MyObject? result4 = await root.Context.HandleAsync<MyParam, MyObject>(myParamInstance);


// validation
bool isValid = root.Context.Validate<MyObject>(myObjectInstance);  
bool isValid = await root.Context.ValidateAsync<MyObject>(myObjectInstance);  
IValidationDetail<MyObject> validationDetails1 = root.Context.ValidateDetailed<MyObject>(myObjectInstance);  
IValidationDetail<MyObject> validationDetails2 = await root.Context.ValidateDetailedAsync<MyObject>(myObjectInstance);  

Context node classes provides the handling logic

public class MyContextNode1 : IHandleNoParamAsync<IEnumerable<MyObject>>, ...
    public async Task<IEnumerable<MyObject>?> HandleAsync()


You may reach me thru Happy coding!

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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.2 439 6/25/2022