Oxylium 1.0.0

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

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

Oxylium

Problem: Let us assume we're maintaining a WPF application which heavily relies on the property binding mechanism for our controls and the INotifyPropertyChanged interface. Some such applications have numerous transitive dependencies between various controls - and thus by extension - various properties. When adding a new property, the programmer must not only refresh this property, but also others which depend on it, and then all the properties that depend on those properties and so on. Naturally, such an application becomes slow to extend and difficult to maintain.

Solution: Oxylium provides a simple NotifyPropertyChangedMediator. In it, classes that can raise a PropertyChanged can be registered, along with their properties. A notification of a property changing is then reported to all dependent objects, along with the properties that need to be refreshed.

Currently supported .NET version: .NET 6

Getting started

Oxylium is distributed as a NuGet package.

After installing Oxylium implement INotifyPropertyChanged and IRaisePropertyChanged in the client class - raise the PropertyChanged event in the implemented method.

Then, create a mediator instance and register the property dependencies.

Four registration methods are provided:

  RegisterBetween(IRaisePropertyChanged item, string propertyDepends, IRaisePropertyChanged onItem, string onProperty)
  Register(IRaisePropertyChanged item, string propertyDepends, string onProperty)
  RegisterBetweenQ(IRaisePropertyChanged item, object propertyDepends, IRaisePropertyChanged onItem, object onProperty, string propertyDependsExpression = "", string onPropertyExpression = "")
  RegisterQ(IRaisePropertyChanged item, object propertyDepends, IRaisePropertyChanged onItem, object onProperty, string propertyDependsExpression = "", string onPropertyExpression = "")

RegisterBetween - Use when the dependency of properties spans two objects Register - Use when the dependency of properites is contained in the same object. Functionally identical to RegisterBetween(item, propertyDepends, item, onProperty)

The Q variants (Shorthand for Quick) leverage the CallerArgumentExpression attribute to extract the property name via the used expression and are at most capable of extracting the property name when . is used. For example, this line will work:

  mediator.RegisterBetweenQ(other, other.Prop1, this, this.Prop2);

Which is shorter than:

  mediator.RegisterBetween(other, nameof(other.Prop1), this, nameof(this.Prop2);

Finally, call mediator.OnPropertyChanged(this); in your property setters. OnPropertyChanged in turn leverages the CallerMemberName attribute to extract the name of the property it was called from.

In the event of errors a simple property checking mechanism has been implemented. If a given type does not contain the given property, then ArgumentException is thrown.

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.0 213 3/25/2022

Base functionality: register properties that depend on other properties and propagate their changes.