### Install Bit.ResxTranslator
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/ResxTranslator/README.md
Installs the Bit.ResxTranslator as a .NET global tool. This command should be run in your terminal.
```bash
dotnet tool install --global Bit.ResxTranslator
```
--------------------------------
### Install MAUI Workloads for BlazorUI Demo App
Source: https://github.com/bitfoundation/bitplatform/blob/develop/docs/how-to-build.md
Install the necessary MAUI workloads to build the BlazorUI Demo App project. On Linux, only the Android workload is currently supported due to MAUI limitations.
```bash
dotnet workload install maui-android
```
```bash
dotnet workload install maui
```
--------------------------------
### Install Playwright Browsers
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/BlazorUI/Tests/Performance/README.md
Installs the necessary Playwright browsers for running performance tests. Use the appropriate command for your operating system.
```bash
pwsh bin/Debug/net10.0/playwright.ps1 install
```
```bash
./bin/Debug/net10.0/playwright.sh install
```
--------------------------------
### Install Bit BlazorUI NuGet Package (Command Line)
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/BlazorUI/Bit.BlazorUI/README.md
Use this command to add the Bit.BlazorUI nuget package to your project via the .NET CLI.
```bash
dotnet add package Bit.BlazorUI
```
--------------------------------
### Install Bit BlazorUI Extras NuGet Package (Package Manager Console)
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/BlazorUI/Bit.BlazorUI.Extras/README.md
Use this command in the Package Manager Console within Visual Studio to install the Bit.BlazorUI.Extras NuGet package.
```powershell
Install-Package Bit.BlazorUI.Extras
```
--------------------------------
### Install Bit BlazorUI Extras NuGet Package (CLI)
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/BlazorUI/Bit.BlazorUI.Extras/README.md
Use this command in your project's directory to add the Bit.BlazorUI.Extras NuGet package via the .NET CLI.
```bash
dotnet add package Bit.BlazorUI.Extras
```
--------------------------------
### Add Bit Butil NuGet Package
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Butil/README.md
Install the Bit.Butil NuGet package using the .NET CLI.
```bash
dotnet add package Bit.Butil
```
--------------------------------
### Basic Brouter Setup
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Brouter/README.md
Define routes using the Brouter component with various configurations like redirects, named routes, and parameter handling.
```razor
404
Sorry, there's nothing at this address.
```
--------------------------------
### Run Test Host Manually
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/BlazorUI/Tests/Performance/README.md
Starts the Blazor Server test host application locally. Navigate to the provided URLs to access test pages and trigger performance tests.
```bash
dotnet run --urls http://localhost:5280 -f net10.0
```
--------------------------------
### Configure Bit.ResxTranslator
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/ResxTranslator/README.md
Example configuration file for Bit.ResxTranslator. This JSON file defines languages, resource file paths, and LLM provider details. API keys should ideally be provided via environment variables.
```json
{
"DefaultLanguage": "en",
"DefaultLanguage__Comment": "Required: .NET culture's name, en, en-US for example.",
"SupportedLanguages": [ "nl", "fa", "sv", "hi", "zh", "es", "fr", "ar", "de" ],
"SupportedLanguages__Comment": "Required: An array of .NET culture names.",
"ResxPaths": [ "src/**/*.resx" ],
"ResxPaths__Comment": "Required: An array of glob patterns to find your *base* .resx files",
"OpenAI": {
"Model": "gpt-4.1-mini",
"Endpoint": "https://models.inference.ai.azure.com",
"Endpoint__Samples": "Google AI Studio: https://generativelanguage.googleapis.com/v1beta/openai | GitHub: https://models.inference.ai.azure.com",
"Endpoint__Samples2": "xAI(Grok): https://api.x.ai/v1 | Azure AI Foundry: https://YOUR_AZURE_FOUNDRY.services.ai.azure.com/openai/v1",
"ApiKey": null,
"ApiKey__Comment": "API key can be set here OR via [OpenAI__ApiKey] environment variable"
}
}
```
--------------------------------
### Add Bit.Bswup NuGet Package
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Bswup/README.md
Install the Bit.Bswup package using the .NET CLI. This is the first step to enable service-worker functionality.
```bat
dotnet add package Bit.Bswup
```
--------------------------------
### Install Bit BlazorUI NuGet Package (Package Manager Console)
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/BlazorUI/Bit.BlazorUI/README.md
Use this command to add the Bit.BlazorUI nuget package to your project via the Package Manager Console in Visual Studio.
```powershell
Install-Package Bit.BlazorUI
```
--------------------------------
### Query Products by Embedding Similarity
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Websites/WikiDocs/MS.Ext.AI-Integration.md
Example of querying products based on semantic similarity using vector embeddings in PostgreSQL with Entity Framework Core. This retrieves the top 10 most similar products.
```csharp
var results = await dbContext.Products
.OrderBy(p => p.DescriptionEmbedding!.DistanceTo(queryEmbedding))
.Take(10)
.ToListAsync();
```
--------------------------------
### Add Keycloak Service in .NET Aspire
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.AppHost/Infrastructure/Realms/README.md
Configure Keycloak as a containerized service within a .NET Aspire application. This setup automatically handles realm imports from a specified directory.
```csharp
var keycloak = builder.AddKeycloak("keycloak", 8080)
.WithDataVolume()
.WithRealmImport("./Infrastructure/Realms");
```
--------------------------------
### Add New Component Test Page
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/BlazorUI/Tests/Performance/README.md
Example of creating a new Razor page for performance testing a component. It defines routes for both the base component page and a version with a specified count.
```razor
@page "/perf/your-component"
@page "/perf/your-component/{Count:int}"
```
--------------------------------
### Boilerplate HTML and CSS
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/web-interop-app.html
This CSS defines the visual styling for the Bitplatform, including the background, title, and a rotating loader animation. It requires no specific setup beyond being included in an HTML file.
```css
html { height: 100%; }
body { background-image: radial-gradient(circle farthest-corner at center, #3C4B57 0%, #1C262B 100%); }
.title { left: 50%; font-size: 24px; color: #EFEFFA; position: absolute; text-align: center; top: calc(50% + 100px); transform: translate(-50%, -50%); font-family: 'Courier New', Courier, monospace; }
.loader { top: 50%; left: 50%; width: 96px; height: 96px; position: absolute; perspective: 800px; border-radius: 50%; transform: translate(-50%, -50%); }
.inner { width: 100%; height: 100%; position: absolute; border-radius: 50%; box-sizing: border-box; }
.inner.one { top: 0%; left: 0%; border-bottom: 3px solid #EFEFFA; animation: rotate-one 1s linear infinite; }
.inner.two { top: 0%; right: 0%; border-right: 3px solid #EFEFFA; animation: rotate-two 1s linear infinite; }
.inner.three { right: 0%; bottom: 0%; border-top: 3px solid #EFEFFA; animation: rotate-three 1s linear infinite; }
@keyframes rotate-one {
0% { transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg); }
100% { transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg); }
}
@keyframes rotate-two {
0% { transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg); }
100% { transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg); }
}
@keyframes rotate-three {
0% { transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg); }
100% { transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg); }
}
```
--------------------------------
### Build bit platform Website
Source: https://github.com/bitfoundation/bitplatform/blob/develop/docs/how-to-build.md
Run this command in the `Bit.Websites.Platform.Server` project folder to build the website. Basic requirements are sufficient.
```bash
dotnet build
```
--------------------------------
### Run bit platform Website with Watch
Source: https://github.com/bitfoundation/bitplatform/blob/develop/docs/how-to-build.md
Execute this command in the `Bit.Websites.Platform.Server` project folder to run the website with live reloading. Basic requirements are sufficient.
```bash
dotnet watch
```
--------------------------------
### Build the Project
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/AGENTS.md
Run `dotnet build` in the `Boilerplate.Server.Web` project root directory.
```bash
dotnet build
```
--------------------------------
### Run the Project
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/AGENTS.md
Execute `dotnet run` from the `Boilerplate.Server.Web` project root directory.
```bash
dotnet run
```
--------------------------------
### Type-safe Parameter Extraction
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Brouter/README.md
Access route parameters within a Content template using the `Get` method for type-safe retrieval.
```razor
User: @p.Get("id")
```
--------------------------------
### Generate New Project with Bit-BP Template
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/README.md
Use this command to create a new project with the bit-bp template. Configure database, file storage, API, pipeline, module, and other features using the provided flags.
```bash
dotnet new bit-bp
--name Boilerplate
--database SqlServer
--database PostgreSQL
--database MySql
--database Other
--filesStorage S3
--filesStorage AzureBlobStorage
--filesStorage Other
--api Standalone
--pipeline Azure
--pipeline None
--module Admin
--module Sales
--captcha reCaptcha
--aspire false
--notification false
--sample
--sentry
--appInsights
--signalR
--offlineDb
--cloudflare false
--ads
```
--------------------------------
### Add New Migrations
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/AGENTS.md
Add new migrations by running `dotnet ef migrations add --output-dir Data/Migrations --verbose` in the `Boilerplate.Server.Api` project root directory.
```bash
dotnet ef migrations add --output-dir Data/Migrations --verbose
```
--------------------------------
### Add New Component Test Class
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/BlazorUI/Tests/Performance/README.md
Example of creating a new C# test class for performance testing a component. It inherits from PerformanceTestBase and applies relevant test categories.
```csharp
[TestClass]
[TestCategory("Performance")]
[TestCategory("Browser")]
public class YourComponentBrowserTests : PerformanceTestBase
{
// Follow the pattern in BitActionButtonBrowserTests.cs
}
```
--------------------------------
### Programmatic Navigation with IBrouter
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Brouter/README.md
Demonstrates how to use IBrouter for navigating between routes, including named routes with parameters and resolving URLs.
```razor
@inject IBrouter brouter
@code {
void GoHome() => brouter.Navigate("/");
void GoToUser() => brouter.NavigateToName(
"user",
new Dictionary { ["id"] = 42 });
string UserUrl() => brouter.ResolveUrl(
"user",
new Dictionary { ["id"] = 42 });
}
```
--------------------------------
### Run Bitplatform Application
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/web-interop-app.html
This JavaScript code initializes and runs the Bitplatform application. Ensure the WebInteropApp module is correctly imported or available in the scope before calling this method.
```javascript
WebInteropApp.run();
```
--------------------------------
### Simulate BitPlatform Boilerplate Upgrade
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Websites/WikiDocs/UpgradeToLatestBoilerplateVersion.md
Commands to simulate upgrading the BitPlatform boilerplate in a temporary directory. This process helps identify changes before applying them to your main project. Tailored for Windows Command Line.
```cmd
dotnet new install Bit.Boilerplate::9.7.3
dotnet new bit-bp --name UpgradeTestProject --signalR
cd UpgradeTestProject
git init
git add .
git commit -m "project with older version"
for /d %i in (*) do rd /s /q "%i"
for /f "delims=" %i in ('dir /b /a-d ^| findstr /v ".git"') do del /f /q "%i"
cd ..
dotnet new install Bit.Boilerplate::9.7.4
dotnet new bit-bp --name UpgradeTestProject --signalR --force
cd UpgradeTestProject
git add .
```
--------------------------------
### Add Bit Brouter Services
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Brouter/README.md
Configure Bit Brouter services during application startup. Options include case sensitivity, ignoring trailing slashes, and scroll behavior.
```csharp
using Bit.Brouter;
builder.Services.AddBitBrouterServices(o =>
{
o.CaseSensitive = false; // default
o.IgnoreTrailingSlash = true; // default
o.ScrollBehavior = BrouterScrollMode.ToTop;
});
```
--------------------------------
### Include Raw Assets with MauiAsset
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/Resources/Raw/AboutAssets.txt
Use the MauiAsset build action in your .csproj file to include raw assets and their child directories. The LogicalName ensures assets are deployed with the correct path.
```xml
```
--------------------------------
### Optimize DbContext with Compiled Models (Terminal)
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Infrastructure/Data/README.md
Execute this command in the Boilerplate.Server.Web project directory's terminal to generate compiled models for AppOfflineDbContext, optimizing EF Core performance. Ensure the correct project path is specified.
```bash
dotnet tool restore && dotnet ef dbcontext optimize --context AppOfflineDbContext --output-dir Infrastructure/Data/CompiledModel --namespace Boilerplate.Client.Core.Infrastructure.Data --project ../../Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj --verbose
```
--------------------------------
### Ask DeepWiki for BitPlatform Features
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/AGENTS.md
For UI-related tasks, query DeepWiki with: "What features does BitPlatform offer to help me complete this task? [USER'S ORIGINAL REQUEST]"
```markdown
* For UI-related tasks, you **MUST** first ask `DeepWiki`: *"What features does BitPlatform offer to help me complete this task? [USER'S ORIGINAL REQUEST]"*
```
--------------------------------
### Enable OData Query Support with [EnableQuery]
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Websites/WikiDocs/OData.md
Add the `[EnableQuery]` attribute to your `HttpGet` action to automatically enable OData query support for `IQueryable` results. This applies server-side filtering, sorting, and projection after your initial business logic.
```csharp
[HttpGet]
[EnableQuery]
public IQueryable Get()
{
return _db.Products
.Where(p => p.IsActive)
.Select(p => new ProductDto
{
Id = p.Id,
Name = p.Name,
Price = p.Price
});
}
```
--------------------------------
### BitBswupProgress Initialization
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/index.html
Initializes the BitBswupProgress component with configurable options for auto-reload, logging, asset display, and UI element targeting. Set autoReload to false to prevent reloads during active user sessions.
```typescript
const autoReload = false, showLogs = false, showAssets = false, appContainer = '#app-container', hideApp = false, autoHide = true, handler = null;
BitBswupProgress.start(autoReload, showLogs, showAssets, appContainer, hideApp, autoHide, handler);
```
--------------------------------
### Download SQLite DB from Browser Cache
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Infrastructure/Data/README.md
Run these JavaScript commands in the browser console to open the cache, retrieve the SQLite DB file, and initiate a download.
```javascript
const cache = await caches.open('bit-Besql');
const resp = await cache.match('/data/cache/App_Data/Offline.db');
const blob = await resp.blob();
const urlToDownload = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = urlToDownload;
a.download = 'Offline.db';
a.click();
URL.revokeObjectURL(urlToDownload);
```
--------------------------------
### Generate Resx C# Code
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/AGENTS.md
Generate Resx C# code by running `dotnet build -t:PrepareResources` in the `Boilerplate.Shared` project root directory.
```bash
dotnet build -t:PrepareResources
```
--------------------------------
### Ask DeepWiki for ZiggyCreatures/FusionCache Info
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/AGENTS.md
Use `DeepWiki_ask_question` with repository `ZiggyCreatures/FusionCache` for FusionCache tasks like hybrid caching, L2 cache backplane, distributed locking, and OpenTelemetry integration.
```markdown
* For FusionCache tasks (hybrid caching, L2 cache backplane, distributed locking, OpenTelemetry integration, cache factory configuration), you **MUST** use the `DeepWiki_ask_question` tool with repository `ZiggyCreatures/FusionCache` to find correct usage patterns.
```
--------------------------------
### Configure Supported App Versions
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Websites/WikiDocs/CrossPlatformForceUpdate.md
Define minimum supported application versions for various platforms in the application's configuration. This JSON structure allows for platform-specific minimum version settings.
```json
{
"SupportedAppVersions": {
"MinimumSupportedAndroidAppVersion": "1.0.0",
"MinimumSupportedIosAppVersion": "1.0.0",
"MinimumSupportedMacOSAppVersion": "1.0.0",
"MinimumSupportedWindowsAppVersion": "1.0.0",
"MinimumSupportedWebAppVersion": "1.0.0",
"SupportedAppVersions__Comment": "Enabling `AutoReload` (Disabled by default) ensure the latest app version is always applied in Web & Windows apps. Refer to `Client.Web/Components/AppBswupProgressBar.razor`, `Client.Web/wwwroot/index.html` and `Client.Windows/appsettings.json` for details."
}
}
```
--------------------------------
### Initialize Application Insights SDK
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/wwwroot/index.html
This is the main JavaScript snippet for initializing the Application Insights SDK. It automatically loads the SDK script and sets up basic configurations. Ensure your instrumentation key or connection string is correctly provided.
```javascript
!(function (cfg) { function e() { cfg.onInit && cfg.onInit(i) } var S, u, D, t, n, i, C = window, x = document, w = C.location, I = "script", b = "ingestionendpoint", E = "disableExceptionTracking", A = "ai.device."; "instrumentationKey"[S = "toLowerCase"], u = "crossOrigin", D = "POST", t = "appInsightsSDK", n = cfg.name || "appInsights", (cfg.name || C[t]) && (C[t] = n), i = C[n] || function (l) { var d = !1, g = !1, f = { initialize: !0, queue: [], sv: "7", version: 2, config: l }; function m(e, t) { var n = {}, i = "Browser"; function a(e) { e = "" + e; return 1 === e.length ? "0" + e : e } return n[A + "id"] = i[S](), n[A + "type"] = i, n["ai.operation.name"] = w && w.pathname || "_unknown_", n["ai.internal.sdkVersion"] = "javascript:snippet_" + (f.sv || f.version), { time: (i = new Date).getUTCFullYear() + "-" + a(1 + i.getUTCMonth()) + "-" + a(i.getUTCDate()) + "T" + a(i.getUTCHours()) + ":" + a(i.getUTCMinutes()) + ":" + a(i.getUTCSeconds()) + "." + (i.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z", iKey: e, name: "Microsoft.ApplicationInsights." + e.replace(/-/g, "") + "." + t, sampleRate: 100, tags: n, data: { baseData: { ver: 2 } }, ver: 4, seq: "1", aiDataContract: undefined } } var h = -1, v = 0, y = ["js.monitor.azure.com", "js.cdn.applicationinsights.io", "js.cdn.monitor.azure.com", "js0.cdn.applicationinsights.io", "js0.cdn.monitor.azure.com", "js2.cdn.applicationinsights.io", "js2.cdn.monitor.azure.com", "az416426.vo.msecnd.net"], k = l.url || cfg.src; if (k) { if ((n = navigator) && (~(n = (n.userAgent || "").toLowerCase()).indexOf("msie") || ~n.indexOf("trident/")) && ~k.indexOf("ai.3") && (k = k.replace(/(\/)(ai\.3\.)(\[^\\d\]\*)$/, function (e, t, n) { return t + "ai.2" + n })), !1 !== cfg.cr) for (var e = 0; e < y.length; e++)if (0 < k.indexOf(y[e])) { h = e; break } var i = function (e) { var a, t, n, i, o, r, s, c, p, u; f.queue = [], g || (0 <= h && v + 1 < y.length ? (a = (h + v + 1) % y.length, T(k.replace(/^(.\*\\/\/)(\[\\w\\.\]\*)(\/.\*)$/, function (e, t, n, i) { return t + y[a] + i })), v += 1) : (d = g = !0, o = k, c = (p = function () { var e, t = {}, n = l.connectionString; if (n) for (var i = n.split(";"), a = 0; a < i.length; a++) { var o = i[a].split("="); 2 === o.length && (t[o[0]][S]()]= o[1]) } return t[b] || (e = (n = t.endpointsuffix) ? t.location : null, t[b] = "https://" + (e ? e + "." : "") + "dc." + (n || "services.visualstudio.com")), t }()).instrumentationkey || l.instrumentationKey || "", p = (p = p[b]) ? p + "/v2/track" : l.endpointUrl, (u = [])push((t = "SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details)", n = o, r = p, (s = (i = m(c, "Exception")).data).baseType = "ExceptionData", s.baseData.exceptions = [{ typeName: "SDKLoadFailed", message: t.replace(/\\./g, "-"), hasFullStack: !1, stack: t + "\\nSnippet failed to load [" + n + "] -- Telemetry is disabled\\nHelp Link: https://go.microsoft.com/fwlink/?linkid=2128109\\nHost: " + (w && w.pathname || "_unknown_") + "\\nEndpoint: " + r, parsedStack: [] }]), i)), u.push((s = o, t = p, (r = (n = m(c, "Message")).data).baseType = "MessageData", (i = r.baseData).message = 'AI (Internal): 99 message:"' + ("SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details) (" + s + ")").replace(/\\"/g, "") + '"', i.properties = { endpoint: t }, n)), o = u, c = p, JSON && ((r = C.fetch) && !cfg.useXhr ? r(c, { method: D, body: JSON.stringify(o), mode: "cors" }) : XMLHttpRequest && ((s = new XMLHttpRequest).open(D, c), s.setRequestHeader("Content-type", "application/json"), s.send(JSON.stringify(o)))))) }, a = function (e, t) { g || setTimeout(function () { !t && f.core || i() }, 500), d = !1 }, T = function (e) { var n = x.createElement(I), e = (n.src = e, cfg[u]); return !e && "" !== e || "undefined" == n[u] || (n[u] = e), n.onload = a, n.onerror = i, n.onreadystatechange = function (e, t) { "loaded" !== n.readyState && "complete" !== n.readyState || a(0, t) }, cfg.ld && cfg.ld < 0 ? x.getElementsByTagName("head")[0].appendChild(n) : setTimeout(function () { x.getElementsByTagName(I)[0].parentNode.appendChild(n) }, cfg.ld || 0), n }; T(k) } try { f.cookie = x.cookie } catch (p) { } function t(e) { for (; e.length;)!function (t) { f[t] = function () { var e = arguments; d || f.queue.push(function () { f[t].apply(f, e) }) } }(e.pop()) } var r, s, n = "track", o = "TrackPage", c = "TrackEvent", n = (t([n + "Event", n + "PageView", n + "Exception", n + "Trace", n + "DependencyData", n + "Metric", n + "PageViewPerformance", "start" + o, "stop" + o, "start" + c, "stop" + c, "addTelemetryInitializer", "setAuthenticatedUserContext", "clearAuthenticatedUserContext", "flush"])), f.SeverityLevel = { Verbose: 0, Information: 1, Warning: 2, Error: 3, Critical: 4 }, (l.extensionConfig || {}).ApplicationInsightsAnalytics || {}); return !0 !== l[E] && !0 !== n[E] && (t(
```
--------------------------------
### Run All Performance Tests
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/BlazorUI/Tests/Performance/README.md
Executes all performance tests within the Bit.BlazorUI.Tests.Performance project. The --output detailed flag provides more verbose logging.
```bash
dotnet test -f net10.0 --output detailed
```
--------------------------------
### Ask DeepWiki for microsoft/aspire Info
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/AGENTS.md
Use `DeepWiki_ask_question` with repository `microsoft/aspire` for .NET Aspire tasks, including AppHost, resource configuration, service discovery, and integrations.
```markdown
* For .NET Aspire tasks (AppHost orchestration, resource configuration, switching Docker resources to Azure equivalents, service discovery, integrations), you **MUST** use the `DeepWiki_ask_question` tool with repository `microsoft/aspire` to find correct implementation patterns — it significantly outperforms Microsoft Learn for code-level questions.
```
--------------------------------
### Standard Controller Action for OData
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Websites/WikiDocs/OData.md
Use this standard controller action when you want to return an `IQueryable` to enable OData query support.
```csharp
using Microsoft.AspNetCore.Mvc;
using System.Linq;
[ApiController]
[Route("[controller]")]
public class ProductsController : ControllerBase
{
private readonly AppDbContext _db;
public ProductsController(AppDbContext db) => _db = db;
[HttpGet]
public IQueryable Get()
{
return _db.Products
.Where(p => p.IsActive)
.Select(p => new ProductDto
{
Id = p.Id,
Name = p.Name,
Price = p.Price
});
}
}
```
--------------------------------
### Global Navigation Hooks
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Brouter/README.md
Illustrates how to implement global navigation hooks (OnNavigating, OnNavigated, OnError) using IBrouter events and the IDisposable interface for cleanup.
```razor
@inject IBrouter brouter
@implements IDisposable
@code {
private Func? _onNavigating;
private Func? _onNavigated;
private Func? _onError;
protected override void OnInitialized()
{
_onNavigating = ctx =>
{
// Telemetry, analytics, page title, scroll restoration, ...
return ValueTask.CompletedTask;
};
_onNavigated = ctx => ValueTask.CompletedTask;
_onError = (ctx, ex) => ValueTask.CompletedTask;
brouter.OnNavigating += _onNavigating;
brouter.OnNavigated += _onNavigated;
brouter.OnError += _onError;
}
public void Dispose()
{
// Always unsubscribe to avoid handler leaks when the component is removed.
if (_onNavigating is not null) brouter.OnNavigating -= _onNavigating;
if (_onNavigated is not null) brouter.OnNavigated -= _onNavigated;
if (_onError is not null) brouter.OnError -= _onError;
}
}
```
--------------------------------
### Ask DeepWiki for keycloak/keycloak Info
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/AGENTS.md
Use `DeepWiki_ask_question` with repository `keycloak/keycloak` for Keycloak/realm related tasks.
```markdown
* For Keycloak/realm related tasks, you **MUST** use the `DeepWiki_ask_question` tool with repository `keycloak/keycloak` to find relevant information.
```
--------------------------------
### Ask DeepWiki for microsoft/agent-framework Info
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/AGENTS.md
Use `DeepWiki_ask_question` with repository `microsoft/agent-framework` for Microsoft Agent Framework tasks, including agent creation, orchestration, workflows, and tool integration.
```markdown
* For Microsoft Agent Framework tasks (agent creation, multi-agent orchestration, workflows, tools/function calling, MCP, A2A communication, memory/context, provider integrations), you **MUST** use the `DeepWiki_ask_question` tool with repository `microsoft/agent-framework` to find correct implementation patterns.
```
--------------------------------
### Enable Static File Caching in Startup.cs
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Bswup/README.md
Configure static file caching in your Blazor application's Startup.cs file. This ensures that static assets are cached effectively, with cache control headers set for production environments.
```csharp
app.UseStaticFiles(new StaticFileOptions
{
OnPrepareResponse = ctx =>
{
if (env.IsDevelopment() is false)
{
// https://bitplatform.dev/templates/cache-mechanism
ctx.Context.Response.GetTypedHeaders().CacheControl = new()
{
MaxAge = TimeSpan.FromDays(7),
Public = true
};
}
}
});
```
--------------------------------
### Run Tests
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/AGENTS.md
Execute `dotnet test` within the `Boilerplate.Tests` project root directory.
```bash
dotnet test
```
--------------------------------
### Optimize DbContext with Compiled Models (Package Manager Console)
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Infrastructure/Data/README.md
Run this PowerShell command in the Package Manager Console to generate compiled models for AppOfflineDbContext, optimizing EF Core performance. Ensure the correct startup and default projects are set.
```powershell
Optimize-DbContext -Context AppOfflineDbContext -OutputDir Infrastructure/Data/CompiledModel -Namespace Boilerplate.Client.Core.Infrastructure.Data -Verbose
```
--------------------------------
### Add Migration for AppOfflineDbContext (Terminal)
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Infrastructure/Data/README.md
Execute this command in the Boilerplate.Server.Web project directory's terminal to add a new migration for the AppOfflineDbContext. Ensure the client project path is correct.
```bash
dotnet tool restore && dotnet ef migrations add Initial --context AppOfflineDbContext --output-dir Infrastructure/Data/Migrations --project ../Client/Boilerplate.Client.Core/Boilerplate.Client.Core.csproj --verbose
```
--------------------------------
### Initialize Application Insights Telemetry
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/index.html
This script initializes Application Insights for telemetry. It configures the instrumentation key and disables telemetry if needed. The script also includes error handling for unhandled exceptions.
```javascript
f = function(cfg) { var C = window, T = C.document, S = C.navigator, E = "appInsights", N = C[E], r = C.location, o = C.JSON; if (N && N.queue && N.queue.length) { return N; } var s = function() { var e = []; return function() { return e.push(Array.prototype.slice.call(arguments)), e; }; }(), a = s("load time", Date.now()); var i = { config: cfg.config || {}, initialize: function(e, t) { if (!t && !e) throw new Error("You must specify either an instrumentation key or a configuration object."); var n = !1; if (e) var r = e; if (t) { for (var i in t) if (t.hasOwnProperty(i)) { if (i === "instrumentationKey") { r = t[i]; } n = !0; } } if (!r) throw new Error("Instrumentation key must be specified."); if (n) { C[E] = { config: t }; } else { C[E] = { config: { instrumentationKey: r } }; } var o = C[E].config; if (!o.url) { o.url = "https://dc.services.visualstudio.com/v2/track"; } var s = o.endpointUrl; if (s) { o.endpointUrl = s; } var u = "Microsoft.ApplicationInsights."; var p = "ai.3.gbl.min.js"; var d = T.createElement("script"); d.src = o.url || "https://js.monitor.azure.com/scripts/b/ai.3.gbl.min.js"; d.crossOrigin = "anonymous"; if (o.ld) { d.ld = o.ld; } if (o.crossOrigin) { d.crossOrigin = o.crossOrigin; } if (o.nonce) { d.nonce = o.nonce; } d.addEventListener("load", function() { C.appInsights.loadAppInsights(); }); d.addEventListener("error", function() { C.appInsights.disableTelemetry = !0; }); T.body.appendChild(d); return !0; }, trackPageView: function(e, t, n, r) { var o = { url: r || C.location.href }; if (n) o.name = n; if (t) o.properties = t; if (e) o.measurements = e; var s = C[E].queue; if (s) { s.push(["trackPageView", o]); } }, trackEvent: function(e, t, n) { var r = { name: e }; if (t) r.properties = t; if (n) r.measurements = n; var o = C[E].queue; if (o) { o.push(["trackEvent", r]); } }, trackException: function(e, t, n, r, o) { var s = { exception: e }; if (t) s.properties = t; if (n) s.measurements = n; if (r) s.operation = r; if (o) s.operation.name = o; var a = C[E].queue; if (a) { a.push(["trackException", s]); } }, flush: function() { var e = C[E].queue; if (e) { e.push(["flush"]); } } }; C[E] = i; var u = C.onerror; C.onerror = function(e, t, n, r, o) { var s = u && u(e, t, n, r, o); var a = C[E]; if (!a) return s; var f = a.config; if (!f || f.disableTelemetry) return s; var l = f.instrumentationKey; if (!l) return s; var c = C.event; if (c && c.src) { var h = C.location.href; var m = C.document.referrer; var g = C.navigator.userAgent; var v = { message: e, url: t, lineNumber: n, columnNumber: r, error: o, evt: c, page: h, referrer: m, userAgent: g }; a._"onerror"(v); } return s; }; return i; }; var C = window, T = C.document, S = C.navigator, E = "appInsights", N = C[E]; var r = "onerror"; var o = C.JSON; var s = C.onerror; var f = (C[E] = T.createElement("script"), C[E].src = "https://js.monitor.azure.com/scripts/b/ai.3.gbl.min.js", C[E].ld = -1, C[E].crossOrigin = "anonymous", C[E]); var l = { cfg: { instrumentationKey: "00000000-0000-0000-0000-000000000000", disableTelemetry: true } }; var c = f(l.cfg); (C[n] = c).queue && 0 === c.queue.length ? (c.queue.push(e), c.trackPageView({})) : e();
```
--------------------------------
### Initialize Application Insights SDK
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/wwwroot/index.html
This snippet initializes the Application Insights SDK for web applications. It configures the SDK with an instrumentation key and an ingestion endpoint. Ensure the 'instrumentationKey' and 'ingestionEndpoint' are correctly set in the configuration object.
```javascript
!(function (cfg) { function e() { cfg.onInit && cfg.onInit(i) } var S, u, D, t, n, i, C = window, x = document, w = C.location, I = "script", b = "ingestionendpoint", E = "disableExceptionTracking", A = "ai.device."; "instrumentationKey"[S = "toLowerCase"](), u = "crossOrigin", D = "POST", t = "appInsightsSDK", n = cfg.name || "appInsights", (cfg.name || C[t]) && (C[t] = n), i = C[n] || function (l) { var d = !1, g = !1, f = { initialize: !0, queue: [], sv: "7", version: 2, config: l }; function m(e, t) { var n = {}, i = "Browser"; function a(e) { e = "" + e; return 1 === e.length ? "0" + e : e } return n[A + "id"] = i[S](), n[A + "type"] = i, n["ai.operation.name"] = w && w.pathname || "_unknown_", n["ai.internal.sdkVersion"] = "javascript:snippet_" + (f.sv || f.version), { time: (i = new Date).getUTCFullYear() + "-" + a(1 + i.getUTCMonth()) + "-" + a(i.getUTCDate()) + "T" + a(i.getUTCHours()) + ":" + a(i.getUTCMinutes()) + ":" + a(i.getUTCSeconds()) + "." + (i.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z", iKey: e, name: "Microsoft.ApplicationInsights." + e.replace(/-/g, "") + "." + t, sampleRate: 100, tags: n, data: { baseData: { ver: 2 } }, ver: 4, seq: "1", aiDataContract: undefined } } var h = -1, v = 0, y = ["js.monitor.azure.com", "js.cdn.applicationinsights.io", "js.cdn.monitor.azure.com", "js0.cdn.applicationinsights.io", "js0.cdn.monitor.azure.com", "js2.cdn.applicationinsights.io", "js2.cdn.monitor.azure.com", "az416426.vo.msecnd.net"], k = l.url || cfg.src; if (k) { if ((n = navigator) && (~(n = (n.userAgent || "").toLowerCase()).indexOf("msie") || ~n.indexOf("trident/")) && ~k.indexOf("ai.3") && (k = k.replace(/(\/)(ai\.3\.)(\[^\\d\]\*)$/, function (e, t, n) { return t + "ai.2" + n })), !1 !== cfg.cr) for (var e = 0; e < y.length; e++)if (0 < k.indexOf(y[e])) { h = e; break } var i = function (e) { var a, t, n, i, o, r, s, c, p, u; f.queue = [], g || (0 <= h && v + 1 < y.length ? (a = (h + v + 1) % y.length, T(k.replace(/^(.\*\\/\\/)(\[\\w\\.\]\*)(\/.\*)$/, function (e, t, n, i) { return t + y[a] + i })), v += 1) : (d = g = !0, o = k, c = (p = function () { var e, t = {}, n = l.connectionString; if (n) for (var i = n.split(";"), a = 0; a < i.length; a++) { var o = i[a].split("="); 2 === o.length && (t[o[0]][S]()]) = o[1] } return t[b] || (e = (n = t.endpointsuffix) ? t.location : null, t[b] = "https://" + (e ? e + "." : "") + "dc." + (n || "services.visualstudio.com")), t }()).instrumentationkey || l.instrumentationKey || "", p = (p = p[b]) ? p + "/v2/track" : l.endpointUrl, (u = [])).push((t = "SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details)", n = o, r = p, (s = (i = m(c, "Exception")).data).baseType = "ExceptionData", s.baseData.exceptions = [{ typeName: "SDKLoadFailed", message: t.replace(/\./g, "-"), hasFullStack: !1, stack: t + "\nSnippet failed to load [" + n + "] -- Telemetry is disabled\nHelp Link: https://go.microsoft.com/fwlink/?linkid=2128109\nHost: " + (w && w.pathname || "_unknown_") + "\nEndpoint: " + r, parsedStack: [] }]), i)), u.push((s = o, t = p, (r = (n = m(c, "Message")).data).baseType = "MessageData", (i = r.baseData).message = 'AI (Internal): 99 message:"' + ("SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details) (" + s + ")").replace(/\"/g, "") + '"', i.properties = { endpoint: t }, n)), o = u, c = p, JSON && ((r = C.fetch) && !cfg.useXhr ? r(c, { method: D, body: JSON.stringify(o), mode: "cors" }) : XMLHttpRequest && ((s = new XMLHttpRequest).open(D, c), s.setRequestHeader("Content-type", "application/json"), s.send(JSON.stringify(o)))))) }, a = function (e, t) { g || setTimeout(function () { !t && f.core || i() }, 500), d = !1 }, T = function (e) { var n = x.createElement(I), e = (n.src = e, cfg[u]); return !e && "" !== e || "undefined" == n[u] || (n[u] = e), n.onload = a, n.onerror = i, n.onreadystatechange = function (e, t) { "loaded" !== n.readyState && "complete" !== n.readyState || a(0, t) }, cfg.ld && cfg.ld < 0 ? x.getElementsByTagName("head")[0].appendChild(n) : setTimeout(function () { x.getElementsByTagName(I)[0].parentNode.appendChild(n) }, cfg.ld || 0), n }; T(k) } try { f.cookie = x.cookie } catch (p) { } function t(e) { for (; e.length;)!function (t) { f[t] = function () { var e = arguments; d || f.queue.push(function () { f[t].apply(f, e) }) } }(e.pop()) } var r, s, n = "track", o = "TrackPage", c = "TrackEvent", n = (t([n + "Event", n + "PageView", n + "Exception", n + "Trace", n + "DependencyData", n + "Metric", n + "PageViewPerformance", "start" + o, "stop" + o, "start" + c, "stop" + c, "addTelemetryInitializer", "setAuthenticatedU
```
--------------------------------
### Configure OpenAI-Compatible Provider Settings
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Websites/WikiDocs/MS.Ext.AI-Integration.md
Configure settings for non-Azure OpenAI-compatible providers like ChatGPT, Gemini, or DeepSeek in appsettings.json. Use the correct base URL for your chosen provider.
```json
"OpenAI": {
"ChatEndpoint": "https://models.inference.ai.azure.com",
"ChatApiKey": "your_openai_or_provider_api_key"
}
```
--------------------------------
### Implement Custom Interface on Server
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Features/Readme.md
Implement the custom interface in your server-side project. This is optional but ensures compile-time checks for method consistency.
```csharp
public class UserController : AppControllerBase, IUserController
```
--------------------------------
### Ask DeepWiki for Bitfoundation/bitplatform Info
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/Templates/Boilerplate/Bit.Boilerplate/AGENTS.md
Use `DeepWiki_ask_question` with repository `bitfoundation/bitplatform` for information on `Bit.BlazorUI`, `bit Bswup`, `bit Butil`, `bit Besql`, or the bit project template.
```markdown
* For anything related to `Bit.BlazorUI`, `bit Bswup`, `bit Butil`, `bit Besql`, or the bit project template, you **MUST** use the `DeepWiki_ask_question` tool with repository `bitfoundation/bitplatform` to find relevant information.
```
--------------------------------
### Run Bit.ResxTranslator
Source: https://github.com/bitfoundation/bitplatform/blob/develop/src/ResxTranslator/README.md
Executes the Bit.ResxTranslator command to perform translations. Ensure the configuration file is present in the current directory.
```bash
bit-resx-translate
```