Where to hook in order to create SQL from model - How can I change the list of Entity Framework Core services from DbContext

AxD 666 Reputation points
2021-09-23T08:24:06.127+00:00

I've written an EF Core extension, providing model extension methods to add user/role objects to the database. Now I need a way to create SQL statements from the model when the database is created/migrated.

So, I guess I need to replace two Entity Framework Core services (IRelationalDatabaseCreator and IMigrationsSqlGenerator).

How can I do this?

I don't seem to be able to modify the list of services with only a DbContext available.

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
725 questions
{count} votes

Accepted answer
  1. AxD 666 Reputation points
    2021-09-28T11:10:44.02+00:00

    Thank you, Jack, for taking the time.

    In the meantime, I worked into the EF Core 6 code and managed to find the hooks myself.

    Shortly, I will be publishing an extension to EF Core for managing database users and roles by use of FluentAPI.

    0 comments No comments

0 additional answers

Sort by: Most helpful