The Future of .NET with AI APIs — Are We Still Writing Controllers?
Look guys… we’re entering a new era in the .NET world.
A phase where the Controllers we’ve memorized since the MVC days could become just a thin interface on top of a “smart brain” that writes queries and executes logic by itself 😅.
💡 How We Used to Work
-
Build a regular Web API:
-
Controller with actions like
GetAll(),GetById(),Create() -
Queries written in LINQ
-
All the logic manual, step by step
-
-
We had to write everything ourselves, from receiving the request to sending the response
🚀 Now, with AI APIs
With tools like:
-
Azure OpenAI Service
-
Semantic Kernel (from Microsoft itself)
-
.NET 9 AI SDK
We now have a completely new layer inside the backend called the AI Orchestrator.
🔍 What’s an AI Orchestrator?
Think of it as the brain that thinks for you:
-
Understands user intent
-
Decides which code or data to invoke
-
Converts natural language (English or Arabic) into an actual action in your code
Example:
Instead of the user sending:
They can simply write:
"Show me all orders shipped in October"
The Controller now:
-
Receives the text
-
Sends it to Semantic Kernel
-
Kernel calls an Azure OpenAI model (GPT-4 or GPT-4o)
-
The model figures out the query and executes the method in your code:
-
The result goes back to the user like magic 🤯
🧠 How It Works Technically
-
Semantic Kernel has Plugins (or Skills)
-
These are methods in your code registered as Functions
-
When the model decides to call a function, it returns JSON like:
-
-
The Kernel executes it directly in the code
-
You can add Memory so the Agent remembers context
-
You can also use a Vector Store like Azure AI Search for RAG (Retrieval-Augmented Generation)
-
Meaning it fetches data from docs or DB and adds it to the prompt before responding
-
⚙️ What’s the Controller Doing Now?
Still there, but its role has changed:
-
Handles Auth and Rate Limiting
-
Passes Context (user, session, language)
-
Routes the request to the Kernel instead of executing the logic itself
Example:
Instead of:
It now does:
🔥 Bottom Line
-
We’ve entered a new stage: no more writing business logic line by line
-
Instead, we’re building a system that thinks and decides which code to run
-
.NET 9 will officially support AI SDK
-
Semantic Kernel supports OpenAI, Azure OpenAI, HuggingFace, Ollama
-
Function Calling and RAG pipelines are now trivial to implement
💬 In the end:
-
Controllers won’t die… but they’ll stop “thinking”
-
They become just a bridge between the user and the smart brain inside your backend
👨💻 So the question is:
Are you ready to enter this phase? Or are you still writing Controllers with GetAll and GetById? 😄