Loading repository data…
Loading repository data…
microsoft / repository
This code demonstrates a working customer order database hosted on Azure, implemented in C# and XAML, and ready to form the basis of your Windows Store enterprise app.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
page_type: sample languages:
A WinUI 3 sample app that showcases UI controls (including a data grid) and the latest design guidance for apps on Windows 11. It also demonstrates features useful to enterprise developers, like Azure Active Directory (AAD) authentication, Sqlite and SQL Azure database integration, Entity Framework, and cloud API services. The sample is based around creating and managing customer accounts, orders, and products for the fictitious company Contoso.
Note - This sample is targeted and tested for Windows 11 Insider Preview using the Insider Preview SDK Build 22000, and Visual Studio 2022 version 17.1 or later. If you are developing on Windows 10, retarget the Contoso.App project to Windows 10, version 2004 (10.0; Build 19041).
This update includes:
Updated Plaform
Updated Target framework
Added new NuGet packages and/or libraries
Updated NuGet packages
Data migration
Improvements:
This update includes:
To see how we updated the UI to look at home on Windows 11, see Updating the Customers Orders Database sample UI to Windows 11.
This update includes:
This sample highlights:
This sample is designed to cover the core scenarios with minimal architectural complexity. For a more complex, full-featured sample that covers many of the same scenarios using a more sophisticated architecture, see the VanArsdel Inventory sample.
This sample is designed to connect to an instance of Azure Active Directory for authentication and an external service for data. To get you started right away, we've provided some demo data and a test service you can connect to. However, in order to debug and explore the full functionality of the app, you'll need to deploy your own instance to Azure.
To get the latest updates to Windows and the development tools, and to help shape their development, join the Windows Insider Program.
Set your startup project as Contoso.App, the architecture to x86 or x64, and press F5 to run.
To fully explore the sample, you'll need to connect to your own Azure Active Directory and data source. Values you need to fill are in Constants.cs.
You can then either start the service running locally, or deploy it to Azure.
First, complete the steps in Register an application with the Microsoft identity platform to register the web application.
| App registration setting | Value for this sample app | Notes |
|---|---|---|
| Name | active-directory-contoso-customer-oders-protected-api | Suggested value for this sample. You can change the app name at any time. |
| Supported account types | Accounts in this organizational directory only (Any Azure AD directory - Multitenant) | Required for this sample. Support for the Single tenant. |
| Expose an API | Scope name: Contoso.ReadWriteWho can consent?: Admins and usersAdmin consent display name: Act on behalf of the userAdmin consent description: Allows the API to act on behalf of the user.User consent display name: Act on your behalfUser consent description: Allows the API to act on your behalf.State: Enabled | Add a new scope that reads as follows api://{clientId}/Contoso.ReadWrite. Required value for this sample. |
Then, complete the steps in Register an application with the Microsoft identity platform to register the deskptop application.
| App registration setting | Value for this sample app | Notes |
|---|---|---|
| Name | active-directory-contoso-customer-oders-winui3 | Suggested value for this sample. You can change the app name at any time. |
| Supported account types | Accounts in any organizational directory (Any Azure AD directory - Multitenant) | Suggested value for this sample. |
| Platform type | Mobile and desktop applications | Required value for this sample |
| Redirect URIs | https://login.microsoftonline.com/common/oauth2/nativeclient | Required value for this sample |
| API Permissions | active-directory-contoso-customer-oders-protected-api Contoso.ReadWrite | Add a new delegated permission for api://<application-id>/Contoso.ReadWrite. Required value for this sample. |
Navigate to Constants.cs and complete the following value using the active-directory-contoso-customer-oders-winui3 Application (client) ID from Azure Portal:
...
public const string AccountClientId = "Application_Client_ID_From_Azure_Portal";
...
Right-click the Contoso.App project, choose Set as Startup Project.
Press F5
Navigate to Settings and ensure it is selected the SQLite option.
Install SQL LocalDB. You could easily install SQL LocalDB using the Visual Studio Installer from Individual Components by searching for the term Local DB or you can find other ways to install this from SQL Server Express LocalDB Installation Media.
Note: The intructions in here are using SQL Express LocalDB, but you can use any SQL Server instance at your disposal.
Open a Windows Terminal and create a new LocalDB instance
SqlLocalDB.exe create