-
Notifications
You must be signed in to change notification settings - Fork 11
Configuration
This page will explain how the relational store is configured. This page is still a WIP.
By default, Nevermore will use SelectAllColumnsTableResolver. SelectAllColumnsTableResolver
will use a *
for column names when doing a select and has no concerns of the order that columns appear in the table.
It's possible to override this behaviour by changing the RelationalStoreConfiguration.TableColumnNameResolver
when configuring Nevermore. The following are supplied implementations of ITableColumnNameResolver
provided by Nevermore for usage - however you can create your own implementation of ITableColumnNameResolver
to choose how column names are resolved if needed.
This is the default implementation for Nevermore. When querying for columns, it will return *
.
This is a decorator for another implementation of ITableColumnNameResolver
that will allow you to pass an implementation of ITableColumnsCache
to choose how column names are cached, and won't re-select the column names when they already exist. It's recommended to use the CachingTableColumnNameResolver
with JsonLastTableColumnNameResolver
to prevent querying the database every read/write transaction.
This will query the table schema to get the column names for a table, with the JSON column last.
This is used as a solution to having a type column after the JSON column. Nevermore cannot do a *
select with a type column after the JSON column if the type column is after the JSON column in the table schema, as it starts to deserialize the results when it streams the JSON column in, and won't know what type to deserialize into if it hasn't read the type column first. By using the JsonLastTableColumnNameResolver
, it changes SELECT *
queries into SELECT column1, column2, type, JSON
with the JSON column coming last. This removes the constraint of having to have the type column first within your table schema.
If your application doesn't use type columns, or you've structured your tables to have the type column before the JSON column, this behaviour might not be desirable to you. In that case, it's likely better to leave the default behaviour of SelectAllColumnsTableResolver
.
It's recommended to use CachingTableColumnNameResolver
to avoid querying tables constantly for their column structure, and instead cache it after the first time retrieving it. That could look like:
var tableColumnsCache = new TableColumnsCache();
configuration.TableColumnNameResolver = queryExecutor => new CachingTableColumnNameResolver(new JsonLastTableColumnNameResolver(queryExecutor), tableColumnsCache);
Please note here: The TableColumnsCache is created outside of the lambda, otherwise each time TableColumnNameResolver
is resolved, it'll create a new TableColumnsCache
, thus not sharing cache with previous instances.
Overview
Getting started
Extensibility
Misc