Getting Started
To begin using LinqApi, install the core package from NuGet and configure it in your ASP.NET Core project.
dotnet add package LinqJsApi.Core --version 1.0.0-preview1
// Sample code for configuration
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDynamicLinqApi("",
"Data Source=.\\SQLEXPRESS;Database=YourDB;Trusted_Connection=True;TrustServerCertificate=Yes");
NuGet Integration
LinqApi is designed modularly. You can install individual packages based on your needs:
LinqJsApi.Core
– core abstractions and helpersLinqJsApi.Razor
– Razor view components and extensions
For example:
dotnet add package LinqJsApi.Core --version 1.0.0-preview1
JavaScript Usage
To use LinqApi JS components, include the CDN script with integrity attributes:
<script src="https://cdn.linqjs.com/linq.v1.0.0.min.js"
integrity="sha384-RHlaXhs3O6e7jauYB0yQmcgbt2pmY3QCRXeNnMlth7vq+1OeJ9TRWywlGmurNtP8"
crossorigin="anonymous"
type="module"></script>
And use components like this:
import { LinqDataTable } from '/_content/LinqApi.Razor/js/index.js';
const table = new LinqDataTable({
endpoint: '/api/products/filterpaged',
target: '#grid'
});
API Structure
LinqApi follows a clean separation of concerns. For example, controllers can be auto-generated for CRUD operations. Here's a simple sample:
public class ProductController : LinqVmController
{
// Custom logic here.
}
Extensibility
LinqApi is designed to be extensible. You can override mappings, hook into queries, and replace components to suit your needs.