In this learning path you will be reviewing an dotnet Application written in C# and Maui that uses the Couchbase Lite .NET SDK. You will learn how to get and insert documents using the key-value engine, query the database using the QueryBuilder engine or SQL++, and learn how to sync information between your mobile app and either a Couchbase Server using Sync Gateway or using peer-to-peer technology.
Full documentation can be found on the Couchbase Developer Portal
To run this prebuilt project, you will need:
- Familiarity with building dotnet Application with Maui.
- Visual Studio or Visual Studio Code
- dotnet version 7 or above installed and setup
- Android SDK installed and setup (> v.33.0.0)
- Android Build Tools (> v.33.0.0)
- Android device or emulator running API level 24 or above
- Nuget can be used to install the Couchbase Lite nuget package. From the terminal in your main project directory, run the following command:
dotnet add package Couchbase.Lite
An entry should be added to your CSPROJ file.
...
<ItemGroup>
<PackageReference Include="Couchbase.Lite" Version="3.0.8" />
</ItemGroup>
For more information on installation, please see the Couchbase Lite Documentation.
The demo application used in this learning path is based on auditing inventory for a fictitious company. Most companies have some inventory - from laptops to office supplies and from time to time must audit their stock. For example, when a user's laptop breaks, they can send out a replacement from the inventory of spare laptops they have on hand.
Users running the mobile app would log into the application to see the projects they are assigned to work on. Then, the user would look at the project to see which office location they need to travel to. Once at the site, they would inspect the number of items, tracking them in the mobile application.
The demo application uses application architecture concepts in developing modern Maui applications recommended by the Maui development team.
Dependency injection is handled using the built-in dotnet classes that are popular with the dotnet community. Microsoft.Extensions.DependencyInjection is used to set up the dependency injection container. The container is used to set up the services that are used throughout the application. The services are then injected into the various classes that need them. The services are also injected into the ViewModels that are used to control the state of the application.
- Open src/Couchbase.Maui.sln using Visual Studio.
- Build and run the project.
- Verify that you see the login screen.