Skip to content

IProfileManager

zehavibarak edited this page Oct 27, 2022 · 1 revision

Some scenarios require you maintain custom settings for users in your app.

You can use the IProfileManager service to get a user profile, and then update and retrieve custom settings.

  1. Declare a model for your settings.
public struct MySetting {
   public bool IsAvailable { get; set; }
}
  1. Inject the IProfileManager service.
public class MyClass {
    private readonly IProfileManager _profileManager;
    public MyClass(IProfileManager profileManager) {
        _profileManager = profileManager;
    }
}
  1. Use the Get() method to get the user profile, and the Set() and Get() methods to update settings and retrieve them.
public class MyClass {
    ...
    public void Update(string userId) {
        var profile = _profileManager.Get<MySettings>(userId);
        profile.MyProperty = true;
        _profileManager.Set(profile, userId);
    }
}

Note that settings model can include non-primitive properties, such as an array, dictionary.

Release Notes

Angular npm, Flutter pub.dev and Nuget packages.

Clone this wiki locally