t01Mvvm - densen2014/Blazor100 GitHub Wiki
dotnet new console -o t01Mvvm dotnet add t01Mvvm package CommunityToolkit.Mvvm dotnet sln add t01Mvvm/t01Mvvm.csproj
var model = new testEntity();
model.PropertyChanged += (s, e) => { Console.WriteLine("changing " + e.PropertyName); }; model.Vers = 1; model.Vers = 111; model.Vers = 133;
[ObservableObject]
public partial class testEntity
{
public string SaveAI(string x)
{
Console.WriteLine("SaveAI " + x);
return x;
}
public string FullName{
set {
Console.WriteLine("SaveAI2 ");
System.IO.File.WriteAllText("12345.txt", "12344");
}
}
[ObservableProperty]
[AlsoNotifyChangeFor(nameof(FullName))]
[NonSerialized]
int vers;
public int Ver { get => ver; set { SetProperty(ver, value, callback: (x) => SaveAI(x.ToString())); } }
int ver = 0;
}