Jelu Miah
Jelu Miah

Reputation: 13

Does the Application class in Prism Library store data persistently?

I am currently using the Prism Library to build a Xamarin.Forms application. Prism provides developers with an interface 'IApplicationStore' that exposes properties. I implement the interface in my application. I was wondering does the Properties dictionary exposed in the interface store data persistently to a user's device or is this data only available whilst the application is open or in the background? The documentation on the Prism Library Github page doesn't really specify this.

Upvotes: 0

Views: 90

Answers (1)

Roubachof
Roubachof

Reputation: 3401

Here is the source code of ApplicationStore on Prism repo on Github:

using System.Collections.Generic;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace Prism.AppModel
{
    public class ApplicationStore : IApplicationStore
    {
        public IDictionary<string, object> Properties
        {
            get { return Application.Current.Properties; }
        }

        public Task SavePropertiesAsync() =>
            Application.Current.SavePropertiesAsync();
    }
}

So it's just a wrapper around Xamarin.Forms application properties. If you want to persist the properties, just call SavePropertiesAsync() and it should be fine:

https://learn.microsoft.com/en-US/dotnet/api/xamarin.forms.application.savepropertiesasync?view=xamarin-forms

Upvotes: 1

Related Questions