TrackableData provides a way to track the changes of poco, list, set and dictionary. It's small and simple to use. For example:
var u = new TrackableUserData(); // create UserData can track changes
u.SetDefaultTracker(); // set Tracker to track changes of UserData
u.Name = "Bob"; // make changes
u.Level = 1;
u.Gold = 10;
Console.WriteLine(u.Tracker); // watch what has changed via Tracker
// { Name:->Bob, Level:0->1, Gold:0->10 }
u.Tracker.Clear(); // clear all changes
u.Level += 10; // make another changes
u.Gold += 100;
Console.WriteLine(u.Tracker); // watch what has changed via Tracker
// { Level:1->11, Gold:10->110 }
PM> Install-Package TrackableData
TrackableData uses compile-time code generation to track poco and user container. So if you want use it, install TrackableData.Templates too.
PM> Install-Package TrackableData.Templates
There are many good libraries for tracking data. Most of them are ORM libraries like EntityFramework and NHibernate. They provides several good-to-have features and affordable performance. But just for tracking data it seems a little bit big.
This library has been developed for two goals.
It works only for tracking data and doesn't aim at being versatile ORM. Because of that, it can be kept small and simple and also provides additional features like rollback and merge of changes.
Unity3D only supports .NET Framework 3.5 until now. And dynamic code generation is forbidden to support iOS and WebGL which uses IL2CPP. Core library and transfer plugins are written under this limitation.
Comprehensive manual for using TrackableData: Manual
TrackableData itself just tracks changes. For more jobs, plugins are required. There are two categories for plugins.
Common serialization library works for transfering changes. But more readable and optimized representation can be achieved with help of plugin.
- Json: TrackableData.Json
- Protocol Buffer: TrackbleData.Protobuf
For data persistency, storage plugin is essential.
- Microsoft SQL Server: TrackableData.MsSql
- MySQL: TrackableData.MySql
- PostgreSQL: TrackableData.PostgreSql
- MongoDB: TrackableData.MongoDB
- Redis: TrackableData.Redis