Configuration Options Reference

June 10, 2026 · View on GitHub

Complete property-by-property reference for all DataSurface options classes.


DataSurfaceEfCoreOptions

Configured via AddDataSurfaceEfCore(). Controls EF Core backend behavior.

builder.Services.AddDataSurfaceEfCore(opt =>
{
    // ... properties below
});
PropertyTypeDefaultDescription
FeaturesDataSurfaceFeatures(all flags enabled)Feature flags — see Feature Flags
AssembliesToScanAssembly[][]Assemblies to scan for [CrudResource] classes
AutoRegisterCrudEntitiesboolfalseAuto-register discovered resource types in the EF model
EnableSoftDeleteFilterboolfalseApply ISoftDelete global query filter
EnableRowVersionConventionboolfalseConfigure byte[] RowVersion as EF concurrency token
EnableTimestampConventionboolfalseAuto-populate CreatedAt/UpdatedAt for ITimestamped
UseCamelCaseApiNamesbooltrueConvert property names to camelCase for API names
StrictQueryboolfalseReject filter/sort on non-allowlisted fields with HTTP 400 instead of silently ignoring them
ContractBuilderOptionsContractBuilderOptions(see below)Fine-tune contract generation

ContractBuilderOptions

PropertyTypeDefaultDescription
ExposeFieldsOnlyWhenAnnotatedbooltrueOnly expose properties with [CrudField]
DefaultIncludeScalarsInReadboolfalseWhen ExposeFieldsOnlyWhenAnnotated is false, include un-annotated scalar properties in the Read shape
UseCamelCaseApiNamesbooltrueGenerate camelCase API names from CLR property names (synced from DataSurfaceEfCoreOptions.UseCamelCaseApiNames)

DataSurfaceHttpOptions

Passed to MapDataSurfaceCrud(). Controls HTTP endpoint mapping and HTTP-level features.

app.MapDataSurfaceCrud(new DataSurfaceHttpOptions
{
    // ... properties below
});
PropertyTypeDefaultDescription
ApiPrefixstring"/api"Base route prefix for all endpoints
MapStaticResourcesbooltrueMap routes for static EF Core resources
MapDynamicCatchAllboolfalseMap /api/d/{route} for dynamic resources (opt-in)
DynamicPrefixstring"/d"Route prefix for dynamic resources
MapResourceDiscoveryEndpointboolfalseEnable GET /api/$resources
MapSchemaEndpointbooltrueMap GET /api/$schema/{resourceKey}. Schema and discovery endpoints participate in the same default authorization / API key / rate limiting as CRUD endpoints
RequireAuthorizationByDefaultboolfalseRequire auth on all endpoints
DefaultPolicystring?nullDefault ASP.NET Core authorization policy
EnableEtagsboolfalseInclude ETag headers in responses
EnableConditionalGetboolfalseSupport If-None-Match → 304 responses
CacheControlMaxAgeSecondsint0Cache-Control: private, max-age=N for GET responses (0 disables the header)
ThrowOnRouteCollisionbooltrueFail at mapping time on duplicate routes (a collision would otherwise surface as a 500 at request time)
EnablePutForFullUpdateboolfalseEnable PUT endpoints for full replacement
EnableBulkOperationsboolfalseMap bulk endpoints (POST /api/{resource}/bulk)
EnableStreamingboolfalseMap streaming endpoints (GET /api/{resource}/stream)
EnableImportExportboolfalseEnable import/export endpoints
MaxExportRowsint100000Max rows an export will materialize; beyond it the response is truncated and X-Export-Truncated: true is returned
EnableRateLimitingboolfalseEnable ASP.NET Core rate limiting
RateLimitingPolicystring?nullRate limiting policy name
EnableApiKeyAuthboolfalseEnable API key authentication
ApiKeyHeaderNamestring"X-Api-Key"Header name for API key

DataSurfaceDynamicOptions

Configured via AddDataSurfaceDynamic(). Controls dynamic entity behavior.

builder.Services.AddDataSurfaceDynamic(opt =>
{
    // ... properties below
});
PropertyTypeDefaultDescription
Schemastring"dbo"Database schema for dynamic metadata tables
WarmUpContractsOnStartbooltrueLoad all dynamic contracts at application startup

DataSurfaceAdminOptions

Passed to MapDataSurfaceAdmin(). Controls the admin REST API.

app.MapDataSurfaceAdmin(new DataSurfaceAdminOptions
{
    // ... properties below
});
PropertyTypeDefaultDescription
Prefixstring"/admin/ds"Route prefix for admin endpoints
Schemastring"dbo"Database schema for dynamic metadata tables
RequireAuthorizationbooltrueRequire auth on admin endpoints
Policystring?nullASP.NET Core authorization policy for admin access

DataSurfaceFeatures

Configured via DataSurfaceEfCoreOptions.Features. See Feature Flags for full documentation including presets and the flag reference table.


DataSurfaceCacheOptions

Configured via Configure<DataSurfaceCacheOptions>(). Controls query result caching.

builder.Services.Configure<DataSurfaceCacheOptions>(options =>
{
    options.EnableQueryCaching = true;
    options.DefaultCacheDuration = TimeSpan.FromMinutes(5);
    options.ResourceConfigs["Product"] = new ResourceCacheConfig
    {
        Enabled = true,
        Duration = TimeSpan.FromMinutes(30),
        CacheList = true,
        CacheGet = true
    };
});
PropertyTypeDefaultDescription
EnableQueryCachingboolfalseEnable server-side query result caching
DefaultCacheDurationTimeSpan5 minutesDefault cache duration for all resources
CacheKeyPrefixstring"ds:"Prefix for generated cache keys
ResourceConfigsDictionary<string, ResourceCacheConfig>{}Per-resource cache configuration

ResourceCacheConfig

PropertyTypeDefaultDescription
EnabledboolfalseEnable caching for this resource
DurationTimeSpan?null (uses default)Cache duration for this resource
CacheListboolfalseCache list query results
CacheGetboolfalseCache individual entity results