EverCodo.ChangesMonitoring
1.0.0-beta1
This is a prerelease version of EverCodo.ChangesMonitoring.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package EverCodo.ChangesMonitoring --version 1.0.0-beta1
NuGet\Install-Package EverCodo.ChangesMonitoring -Version 1.0.0-beta1
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="EverCodo.ChangesMonitoring" Version="1.0.0-beta1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EverCodo.ChangesMonitoring --version 1.0.0-beta1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EverCodo.ChangesMonitoring, 1.0.0-beta1"
#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 EverCodo.ChangesMonitoring as a Cake Addin #addin nuget:?package=EverCodo.ChangesMonitoring&version=1.0.0-beta1&prerelease // Install EverCodo.ChangesMonitoring as a Cake Tool #tool nuget:?package=EverCodo.ChangesMonitoring&version=1.0.0-beta1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EverCodo.ChangesMonitoring
Powerful framework to handle PropertyChanged and CollectionChanged events on any hierarchy of nested objects and collections.
Data model
// INotifyPropertyChanged implementation is omitted to keep the example simple
public class Entity : INotifyPropertyChanged
{
public string Name { get; set; }
public DateTime CreationTime { get; set; }
public Metadata Metadata { get; set; }
}
public class Metadata : INotifyPropertyChanged
{
public string Description { get; set; }
public ObservableCollection<string> Tags { get; set; }
}
public class File : EntityInfo
{
public int Size { get; set; }
}
public class Folder : EntityInfo
{
public ObservableCollection<Entity> Children { get; set; }
}
Subscription for changes
public class Tree
{
public Tree()
{
// ... loading tree to the Root is omitted ...
_ChangesMonitor = ChangesMonitor.Create(Root);
_ChangesMonitor.Changed += ChangesMonitor_Changed;
}
public FolderInfo Root { get; }
public string IsDirty { get; private set; }
private readonly ChangesMonitor _ChangesMonitor;
private void ChangesMonitor_Changed(object sender, MonitoredObjectChangedEventArgs args)
{
// any change of any property or collection on any level inside the Root makes the tree dirty
IsDirty = true;
}
public void Save()
{
// ... saving tree from the Root is omitted ...
IsDirty = false;
}
}
Changes monitoring
[TestClass]
public class TreeChangeTests
{
[TestMethod]
public void AddMetadataTag()
{
var tree = new Tree();
Assert.IsFalse(tree.IsDirty);
tree.Root.Children[5].Children[3].Children[1].Metadata.Tags.Add("Some tag");
Assert.IsTrue(tree.IsDirty);
tree.Save();
Assert.IsFalse(tree.IsDirty);
}
[TestMethod]
public void ReplaceMetadata()
{
var tree = new Tree();
Assert.IsFalse(tree.IsDirty);
tree.Root.Children[5].Children[3].Metadata = new Metadata();
Assert.IsTrue(tree.IsDirty);
tree.Save();
Assert.IsFalse(tree.IsDirty);
}
[TestMethod]
public void ChangeMetadataDescription()
{
var tree = new Tree();
Assert.IsFalse(tree.IsDirty);
tree.Root.Children[5].Children[3].Metadata.Description = "Some description";
Assert.IsTrue(tree.IsDirty);
tree.Save();
Assert.IsFalse(tree.IsDirty);
}
[TestMethod]
public void ChangeEntityName()
{
var tree = new Tree();
Assert.IsFalse(tree.IsDirty);
tree.Root.Children[5].Name = "Some name";
Assert.IsTrue(tree.IsDirty);
tree.Save();
Assert.IsFalse(tree.IsDirty);
}
[TestMethod]
public void ReplaceChildren()
{
var tree = new Tree();
Assert.IsFalse(tree.IsDirty);
tree.Root.Children[5].Children = new ObservableCollection<Entity>();
Assert.IsTrue(tree.IsDirty);
tree.Save();
Assert.IsFalse(tree.IsDirty);
}
}
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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.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 | 22,995 | 7/6/2022 |
1.0.0-beta2 | 204 | 7/1/2022 |
1.0.0-beta1 | 203 | 6/27/2022 |