Entity Framework
This page publishes the canonical Entity Framework guidance used by RecroGrid Framework integrations.
Use Entity Framework as the owner of the server-side data model that backs the RecroGrid Framework runtime.
Integration model
RecroGrid Framework relies on the server-side DbContext to expose entities, persistence behavior, and the metadata needed by the application runtime.
A maintainable integration usually chooses one of these approaches:
- derive the generated
BaseDbContextfrom the application's mainDbContext; - or use a custom
DbContextas the single application-owned persistence surface and register that context explicitly withUseRGF<TDbContext>().
Recommended ownership rule
Keep one clear owner for the Entity Framework model.
That means:
- avoid partially duplicating entity ownership across unrelated contexts;
- keep the RecroGrid Framework runtime attached to the same application data model that your business logic uses;
- make database initialization and migration responsibilities explicit in the application startup and deployment process.
Practical guidance
Use the generated context when you want the fastest route to a working application.
Use a custom application context when you need:
- shared entity ownership across application modules;
- existing database-first integration;
- stronger long-term control over migrations and persistence conventions.