Open Brannos1970 opened 4 years ago
I'm not sure I follow what you are describing. This works, for example:
using Csla;
using System;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("Starting");
var obj = await DataPortal.FetchAsync<Test>("root");
Console.WriteLine($"root name: {obj.Name}");
obj.Name = "changed";
await obj.SaveAndMergeAsync();
Console.WriteLine($"root name: {obj.Name}");
Console.WriteLine("Done");
Console.ReadLine();
}
}
[Serializable]
public class Test : BusinessBase<Test>
{
public static readonly PropertyInfo<string> NameProperty = RegisterProperty<string>(nameof(Name));
public string Name
{
get => GetProperty(NameProperty);
set => SetProperty(NameProperty, value);
}
public static readonly PropertyInfo<Test> ChildProperty = RegisterProperty<Test>(nameof(Child));
public Test Child
{
get => LazyGetPropertyAsync(ChildProperty, DataPortal.FetchAsync<Test>("lazy"));
set => SetProperty(ChildProperty, value);
}
[Fetch]
private void Fetch(string name)
{
using (BypassPropertyChecks)
{
Name = name;
}
}
}
}
Currently in the BusinessBase when the ReadProperty is called and the property is a LazyLoad the "Property get not allowed" is generated. That is great except that when the view model is saved this error gets pushed to the UI which would be confusing to a user. Is there a way to ignore this error on a save?
Version and Platform CSLA version: 5.2.0 OS: Windows Platform: Blazor