Skip to content

v4.1

Compare
Choose a tag to compare
@dsuryd dsuryd released this 30 Jun 01:36
· 425 commits to master since this release

This release provides improved support for asynchronous execution within a view model and allow the use of methods to express view model commands.

Features

  • Add OnCreatedAsync virtual method in BaseVM to allow asynchronous view model initialization (#110).

Example:

public class MyViewModel: BaseVM
{
   ...  
   public override async Task OnCreatedAsync()
   {
      MyPropertyValue = await SomeAsyncMethod();
   }
}
  • Support using method instead of Action property.

Example:

vm.$dispatch({Submit: {/*form data*/}});
public class MyForm : BaseVM
{
   // OLD:
   public Action<FormData> Submit 
   {
      get => formData => SubmitForm(formData);
   }

   // NEW:
   public void Submit(FormData formData) => SubmitForm(formData);
}
  • Support asynchronous action methods. They are awaitable, which means you no longer need to call PushUpdates.

Example:

vm.$dispatch({Submit: {/*form data*/}});
public class MyAsyncForm : BaseVM
{
   public string Message 
   { 
      get => Get<string>(); 
      set => Set();
   }

   public async Task Submit(FormData formData)
   {
      await SubmitFormAsync(formData);
      Message = "Submitted";
   }
}
  • Provide [ItemKey] attribute to specify list item keys for CRUD operations (#205).
    Example:
// OLD:
public string Employees_itemKey => nameof(EmployeeInfo.Id);
public IEnumerable<EmployeeInfo> Employees { get; private set; }

// NEW:
[ItemKey(nameof(EmployeeInfo.Id)]
public IEnumerable<EmployeeInfo> Employees { get; private set; }

Bug Fixes

  • Fix the middleware that extract headers so that the client can update the headers through dispatch (#251).

Notice

The library for ASP.NET Framework "DotNetify.SignalR.Owin" is no longer maintained, with v3.6.1 being the last published version. The source code was moved out the main repo and archived here. However, private support is possible with sponsorship.