Reputation: 11
I’m working in a .NET Core solution where the DBAs team has mandated using a .sqlproj
(SQL Project) as the single source of truth for our SQL database schema. Because of that, we can’t rely on EF Core’s code-first approach and don't have direct access to live DBs. Instead, my team wants to generate our entity classes directly from the T-SQL definitions in the .sqlproj
My vision is:
.sqlproj
) - including tables, views, stored procedures, and user-defined functionsDbContext
with entity classesIs there a known way to hook T4 templates or Roslyn source generators directly into a .sqlproj so that it can parse the T-SQL and generate C# code automatically (in separate project)? Or do I need a separate build step (e.g., generating a DACPAC and parsing that) to produce these classes?
Upvotes: 1
Views: 56