[Home](../../) › [Metalama](../../metalama) › [Features](../features.md) › [Extensibility Features](extensibility.md) › Code Query API

# Code Query API

> Metalama's Code Query API enables querying code like a database, facilitating diagnostics, interactive investigations, and architecture validation in .NET applications.

Canonical: https://postsharp.net/metalama/features/code-query.html

Query your code as if it's a database using the `Metalama.Framework.Workspaces` package. Whether you're running interactive queries in LINQPad or hosting them in any .NET application, it's all possible.

Although Metalama is primarily designed to run within the compiler or IDE process, you can also use its code API from any .NET application.

## Use cases

- **Diagnose the Metalama compilation process.** Inspect aspects and see their effects on source code.
- **Interactively investigate a codebase.** Run queries in LINQPad and search for types or members based on any criteria.
- **Validate architecture.** Spot anomalies in your architecture by running code queries and reporting errors from your CI/CD pipeline.

## Features

- **LINQPad driver.** Execute code queries interactively from LINQPad.
- **Hostable in any application.** After all, it's just a .NET API.
- **Open projects and solutions.** Open `csproj` or `sln` files.
- **Query code references and dependencies.** Access the dependency graph through the API.

## Resources

* Reference documentation:
  - [Querying code with or without LINQPad](https://doc.metalama.net/conceptual/introspection/linqpad)
  - [Introspection API](https://doc.metalama.net/api/introspection-api)

---

## Site navigation

- Previous: [Roslyn Extensibility](roslyn.md)
- Next: [Divorce](divorce.md)
- Index of the whole site: [llms.txt](../../llms.txt)

