Open daiplusplus opened 5 years ago
I enumerate a SSDT dacpac model in EF Core Power Tools (Reverse engineering from a SSDT dacpac) - sample code: https://github.com/ErikEJ/EFCorePowerTools/blob/master/src/GUI/ReverseEngineer20/ReverseEngineer/SqlServerDacpacDatabaseModelFactory.cs
Previously I used to design my databases using a live SQL Server instance running on my LAN server using SSMS and import them into SSDT using Schema Compare, but lately I now do most of my original design work in SSDT and then Publish to my LAN server and then run EF database reverse-engineering against that server - this isn't exactly ideal because doing a publish-then-compare is time-consuming for complex databases, and it doesn't help that VS still blocks the UI when T4 scripts run.
I'm currently working on projects that really don't need a development SQL Server instance - but I still need it to run the EF database reverse-engineering tools against (including this T4 script).
SSDT does actually run a LocalDb instance with this default connection string:
However SSDT doesn't actually replicate the project database design in this database until/unless you start an SSDT debugging session using default settings or explicitly publish the project to it.
I'm curious if there's any other way for a T4 script to access the object-model of an SSDT project to discover the database structure. Has anyone ever poked-around the managed-code components of SSDT (e.g. Schema Compare) when it compares an SSDT project to a live database and saw how it works?