Adding AI to an existing .NET application: four features that pay off, and how to build them
Four AI features that remove manual work in business .NET apps, how to build them with Microsoft.Extensions.AI, and what it takes to run them in production.
Vlado Pandžić · Founder · Senior .NET architect
Published · 4 min read
Most business .NET applications don’t need an AI rewrite. They need one or two features that remove manual work: reading documents, sorting incoming requests, finding answers in the company’s own data, drafting text for a person to approve. In .NET 10 the building blocks for this are mature. The hard part is not calling a model. It’s the data, the costs, privacy, and knowing whether the output is right.
Four features that usually pay off
1. Reading documents
Invoices, delivery notes, contracts and identity documents are still typed in by hand in many companies. Azure AI Document Intelligence has prebuilt models for invoices, receipts and identity documents, and returns every field with a confidence score. For documents without a standard layout, a language model with structured output does the same job.
From our own work: an application that scanned identity documents with an expensive commercial SDK now reads the machine-readable zone in the browser and sends only the rest to Document Intelligence. Same result for the users, a fraction of the licence cost.
2. Sorting and routing
Emails, support tickets, orders, complaints. A model reads the text and returns a category, a priority and the fields you need, as a typed object your code can act on. People only look at the cases the model isn’t sure about.
3. Searching your own data
Manuals, contracts, past tickets, product data. The text is split into chunks, turned into embeddings and stored for vector search. A question retrieves the closest chunks, and the model answers from them, with links to the sources. SQL Server 2025 has a native vector type and EF Core 10 supports it, so for many applications the search can live in the database you already have.
4. Drafting text
Replies to customers, summaries of long threads, product descriptions in several languages. The model writes the first version and a person approves it. This is where time savings are easiest to measure.
The building blocks in .NET
Microsoft.Extensions.AI is the common abstraction: IChatClient for language models and IEmbeddingGenerator for embeddings. The same code works with Azure OpenAI, OpenAI or a local model, and caching, logging and OpenTelemetry are added as middleware:
IChatClient innerClient = new AzureOpenAIClient(endpoint, credential)
.GetChatClient("your-deployment")
.AsIChatClient();
builder.Services.AddDistributedMemoryCache();
builder.Services.AddChatClient(innerClient)
.UseDistributedCache()
.UseOpenTelemetry();
Getting a typed result back from the model takes a few lines:
public record SupportTicket(string Category, string Priority, string CustomerId, string Summary);
var response = await chatClient.GetResponseAsync<SupportTicket>(
$"Classify this support email and extract the fields:\n\n{emailText}");
SupportTicket ticket = response.Result;
Azure AI Document Intelligence has a .NET SDK (Azure.AI.DocumentIntelligence) for its prebuilt and custom document models.
Vector search in EF Core 10 uses SqlVector<float> properties and EF.Functions.VectorDistance on SQL Server 2025 or Azure SQL. When the data lives elsewhere, Azure AI Search or PostgreSQL with pgvector do the same job.
What makes it work in production
Demos skip this part, and it’s where most of the work is.
- Know where the data goes. Decide which fields leave your system at all. For EU data, use a deployment that keeps processing in the EU and sign the provider’s data processing terms. Azure OpenAI does not use customer data to train models.
- Measure quality on your own data. Collect a few hundred real examples with the correct answers, and measure before and after every change of prompt, model or document type.
- Plan for uncertainty. Use confidence scores and send uncertain cases to a person instead of guessing. Time-outs, retries and a manual fallback are part of the design, not an afterthought.
- Watch the costs. Cost is tokens per request times volume. Cache repeated requests, use smaller models for simple tasks, and log usage per feature.
- Treat documents and emails as untrusted input. Text can contain instructions aimed at the model. The model suggests, your code checks and decides.
- Tell people when they talk to AI. Since 2 August 2026 the EU AI Act requires that users are told when they interact with an AI system, unless it’s obvious.
Where to start
Pick one process with a lot of manual work and a clear measure of success, such as invoices typed in by hand. Build a small version on real data, measure accuracy and cost per document, and only then connect it to the rest of the system. A few weeks of this tell you more than months of planning.
Sources
- Microsoft.Extensions.AI libraries, Microsoft Learn
- Use the IChatClient interface, Microsoft Learn
- Azure AI Document Intelligence, Microsoft Learn
- Vector search in the EF Core SQL Server provider, Microsoft Learn
- Article 50: Transparency obligations, EU AI Act