cmeeren / Facil

Facil generates F# data access source code from SQL queries and stored procedures. Optimized for developer happiness.
MIT License
140 stars 7 forks source link

Prefixing the sql object names with the database name in the generated sql #28

Closed costa100 closed 2 years ago

costa100 commented 2 years ago

Hi,

I have another issue - it turns out that .net core doesn't support distributed transactions. See this.

Because the processing that I have to do involves multiple databases, would it be possible to include an option in facil to have it prefix sql object names with the database name? Fortunately, all my databases are on the same server, so if the objects are prefixed with the database name I could in theory use the same connection to do all the processing though in the yaml file the objects are under different connection strings. I tried to prefix a table name with the database name but it doesn't work, facil doesn't find the object, which was kind of what I expected. This is another option, to allow the developer to specify the database name in the yaml file, but I don't know if you want to go there. Well, I don't know what's simpler from an implementation point of view.

If you can't do it, then I will have to write more code manually.

Thanks!

PS. I appreciate greatly the help that provided so far!

cmeeren commented 2 years ago

Thanks for the feature suggestion. This would likely require significant changes across the codebase in regards to how objects are identified in Facil. Furthermore, in the (I would think common) case that the DBs are not named the same across environments (for example, testing/staging/production environments have different DB names), then it will not work.

For now, Facil will remain database-scoped.