fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
578 stars 146 forks source link

Auto-generate types by `dotnet publish` time #799

Closed 64J0 closed 1 year ago

64J0 commented 1 year ago

Is your feature request related to a problem? Please describe.

When we try to Dockerize an application that uses this tool, it depends on the database being up and running, with a specific schema. Ideally, we would not need this database service to publish the project (e.g. dotnet publish -c Release ...).

Please let me know if you think this idea makes sense.

Describe the solution you'd like

It would be very nice if, when using this publish command, this tool scans all the code and creates the necessary types out of it. This way, it's able to compile the project without a database running.

Describe alternatives you've considered

Considered this option: https://github.com/fsprojects/SQLProvider/issues/644.

But I don't think it's really feasible for a big project. Also, it would be great if we could keep only the code itself in our version management tool, instead of keeping both code and data.

Additional context

Thorium commented 1 year ago

Which database? With Microsoft SQL Server you have option to use SSDT: https://fsprojects.github.io/SQLProvider//core/mssqlssdt.html With other databases you have option to use schema cache: https://fsprojects.github.io/SQLProvider//core/parameters.html#ContextSchemaPath

64J0 commented 1 year ago

With PostgreSQL. I'll check the schema cache, thanks for the information @Thorium

64J0 commented 1 year ago

Well, that was not what I was looking for; we'll still need to keep the schema cache along with the project code. But I guess we can make it work with it. Thanks again @Thorium.