Skip to main content
The AI•Pkg data layer uses EasyAF (easyaf.dev) to eliminate hand-written EF migrations and enforce the SQL Server Database Project as the authoritative schema source.

EasyAF Overview

EasyAF provides:

SQL Server DB Project

The .sqlproj is the authoritative schema. No hand-written EF migrations.

Entity Generation

EasyAF CLI reads the .sqlproj and generates EF Core 10 entity classes.

Repository Generation

Standard CRUD repository classes are generated, reducing boilerplate.

OData Restier

Used exclusively for the internal admin/management API surface. Not exposed publicly.

Data Layer Projects

AI•Pkg.Server.Db/          (.sqlproj)
  Tables/
    Packages.sql
    PackageVersions.sql
    PackageOwners.sql
    Users.sql
    ApiKeys.sql
    Downloads.sql

AI•Pkg.Server.Data/        (generated by EasyAF)
  Entities/
    Package.cs            ← generated from Packages.sql
    PackageVersion.cs     ← generated from PackageVersions.sql
  Repositories/
    PackageRepository.cs  ← generated CRUD
  AIpkgDbContext.cs       ← generated EF Core DbContext

Schema Definitions

AI•Pkg Table Schema (from NuGetGallery)

NuGetGallery sourceAI•Pkg tableChanges
PackagesPackagesRemove: RequiresLicenseAcceptance, DevelopmentDependency, IsSymbolsPackage. Add: Capabilities, Targets, Permissions (JSON columns)
PackageVersionsPackageVersionsSame as above; keep download count
PackageOwnersPackageOwnersNo change
UsersUsersKeep; remove legacy OpenID fields
CredentialsCredentialsKeep PBKDF2 API key structure
PackageDependenciesPackageDependenciesAdd Apms column (JSON) instead of TargetFramework
PackageTagsPackageTagsNo change
PackageHistoriesPackageHistoriesNo change
PackageRenames(drop)Not needed
SymbolPackages(drop)Not applicable

New JSON Columns

Three new JSON columns on Packages / PackageVersions:
ColumnJSON TypeExample
Capabilitiesstring[]["skill","command"]
Targetsstring[]["claude-code","cursor"]
Permissionsstring[]["filesystem:read","network:outbound"]
These are stored as nvarchar(max) JSON columns and indexed via computed columns where needed for Azure AI Search sync.

Schema Change Workflow

1

Edit SQL files

Edit .sql files in AI•Pkg.Server.Db/.
2

Regenerate entities

Run EasyAF codegen to regenerate entities in AI•Pkg.Server.Data/.
3

Publish DB project

Publish the .sqlproj to the target database (generates and runs migration scripts).
4

Commit changes

Commit both .sqlproj changes and regenerated entity files.

EasyAF Code Generation

Run EasyAF CLI against AI•Pkg.Server.Db/ to generate:
easyaf generate --project AI•Pkg.Server.Db --output AI•Pkg.Server.Data
This produces:
  • AI•Pkg.Server.Data/Entities/*.cs — one file per table, strongly typed
  • AI•Pkg.Server.Data/Repositories/*.cs — standard CRUD repositories
  • AI•Pkg.Server.Data/AIpkgDbContext.cs — EF Core DbContext with all DbSet<T> properties
Generated files are committed to the repo. The .gitignore does not exclude them — they are the contract between the DB schema and the application code.

Admin API (OData Restier)

EasyAF’s OData Restier integration is used exclusively for the internal admin/management API surface. It is:
  • Not on the public surface (no public routes)
  • Not in scope for the public Registry API spec
  • Accessible only to admin-role authenticated users via internal tooling
Restier auto-generates an OData feed from AIpkgDbContext, providing a fully explorable admin API without hand-written controllers.