Data Stores

FlexBase provides a comprehensive set of data store abstractions for modern application development. Each store type is designed for specific use cases and provides a unified interface across multiple provider implementations.

Available Data Stores

Core Data Stores

Store Type
Description
Providers

Semantic search, RAG, embeddings

SQL Server 2025, Azure AI Search, pgvector, OpenSearch

Keyword search with ranking

SQL Server, PostgreSQL, MySQL, Elasticsearch

Document Store

JSON document storage

MongoDB, CosmosDB, DynamoDB, RavenDB

File Store

Binary file storage

AWS S3, Azure Blob, GCP Storage, Disk

Graph Store

Relationship networks

Neo4j, Cosmos Gremlin

Time Series Store

Time-based metrics

InfluxDB, TimescaleDB, Azure Data Explorer

When to Use Each Store

Use Case
Recommended Store

Semantic search

Vector Store

Keyword search

Full-Text Search

Document management

Document Store

File uploads

File Store

Social networks

Graph Store

IoT/Metrics

Time Series Store

Structured data

Quick Start

Automatic Setup via Flex Studio

Data Store providers are automatically added to your application through Flex Studio. When you add a data store provider:

  1. Provider files are created in Infrastructure/Providers/{YourApplication}.DataStoreProviders/{Category}/{Provider}/

  2. NuGet package is referenced automatically

  3. Default configuration is added to Application/EndPoints/{YourApplication}.EndPoint.CommonConfigs/AppSettings/DataStores/{Category}/{Provider}.json

  4. README documentation is included in the provider folder

You can find all provider files, configuration examples, and documentation in the generated infrastructure folder.

1. Choose Your Store

Select the appropriate store type based on your use case. Each store has specific strengths:

  • Vector Store - When you need AI-powered semantic search or RAG

  • Full-Text Search - When you need fast keyword search with ranking

  • Document Store - When you need flexible schema and JSON storage

  • File Store - When you need to store and serve binary files

2. Add Provider via Flex Studio

In Flex Studio, select the data store category and provider you want to use. Flex Studio will:

  • Create the provider infrastructure folder

  • Reference the appropriate NuGet package

  • Generate default configuration files

  • Include provider-specific documentation

3. Configure and Use

After adding via Flex Studio:

  1. Update configuration in the generated AppSettings/DataStores/{Category}/{Provider}.json file

  2. Review registration examples in the provider folder's README

  3. Register in DI using the extension methods shown in the README

  4. Inject and use in your services

The Vector Store is particularly powerful when combined with AI Providers for implementing RAG (Retrieval-Augmented Generation):

Hybrid Approaches

Combine semantic and keyword search for best results:

SQL Server 2025: All-in-One

SQL Server 2025 supports both relational data AND vector search in one database:

Provider-Agnostic Design

All FlexBase data stores follow a consistent pattern:

  1. Unified Interface - Same API across all providers

  2. Provider-Specific Features - Access advanced features when needed

  3. Easy Migration - Switch providers with configuration changes

  4. Testing Support - Mock implementations for unit tests

Integration with FlexBase Features

All data stores integrate seamlessly with FlexBase features:

  • Dependency Injection - Standard IOptions pattern

  • Logging - Structured logging built-in

  • Health Checks - Test connectivity on startup

  • Configuration - appsettings.json support

  • Multi-tenancy - Tenant isolation support

  • Caching - Integration with FlexCache

Best Practices

  1. Start Simple - Use what you need, add complexity later

  2. Test Locally - Use in-memory or local providers for development

  3. Monitor Performance - Track query times and costs

  4. Implement Caching - Cache frequently accessed data

  5. Plan for Scale - Consider growth from the start

  6. Use Hybrid - Combine stores for optimal results

Advanced Usage Examples

Vector Store

Vector stores are used for semantic search and retrieval-augmented generation (RAG). Below is an example:

Full-text search stores are optimized for keyword-based search. Below is an example:

Document Store

Document stores are ideal for JSON-based storage. Below is an example:

File Store

File stores are used for binary file storage. Below is an example:

See Also

Last updated