admin管理员组文章数量:1128465
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:
- Maintain the DB schema in a SQL Project (
.sqlproj
) - including tables, views, stored procedures, and user-defined functions - In the same solution, have a .NET DAL library that consumes the schema definitions and generates
DbContext
with entity classes
Is 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?
本文标签:
版权声明:本文标题:c# - Generating EF Core (or Dapper) classes from .sqlproj T-SQL definitions using T4 or Roslyn Source Generators - Stack Overflo 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736698226a1948294.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论