Replacing the mock data store
As explored in previous sections, we can register the implementation of data store services in MauiProgram.cs
as follows:
builder.Services.AddSingleton<IDataStore<Item>, MockDataStore>();
builder.Services.AddSingleton<IUserService<User>, UserService>();
In the above code snippet, we receive an instance of MockDataStore
for the IDataStore
interface. This is a mock implementation to simplify the initial development. Now, it’s time to substitute this with the actual implementation. We will replace the above code with the following:
builder.Services.AddSingleton<IDataStore<Item>, DataStore>();
builder.Services.AddSingleton<IUserService<User>, UserService>();
Here, DataStore
is the actual implementation of the IDataStore
service, which we will fully implement in the remainder of this chapter.
The password database is a local database in the KeePass 2.x format. Within this database...