yesql.net icon indicating copy to clipboard operation
yesql.net copied to clipboard

Loading sql files from another assembly

Open md-redwan-hossain opened this issue 8 months ago • 1 comments

Can you add a feature to load sql files from another assembly apart from the executor assembly? For example, if I have a asp net core project and a class library named Infrastructure, I want to load sql files from Infrastructure assembly. Is this possible?

md-redwan-hossain avatar Apr 22 '25 00:04 md-redwan-hossain

You simply don't need to do that. If you have your sql files in another library, simply create a Directory.Build.props file that takes care of copying the sql files from the infrastructure project to the main host output directory.

Here is an example: https://github.com/MrDave1999/Capture-The-Flag/commit/9d2aa1bb915d0ca15e804585c8bcfaadfe9e3e04 https://github.com/MrDave1999/Capture-The-Flag/blob/4711c27e9ef19719589725bc796d945c327d0fc9/src/Persistence/Persistence.MariaDB/ServiceCollectionExtensions.cs#L27-L29

DevD4v3 avatar Apr 28 '25 14:04 DevD4v3

Is there no other way other than Directory.Build.props? I am using yesql in a client project and it is not possible to add Directory.Build.props

md-redwan-hossain avatar May 24 '25 17:05 md-redwan-hossain

You can also use it in a client project. You only use Directory.Build.props when compiling your client application, so your SQL files should already be copied to the output directory.

DevD4v3 avatar May 30 '25 18:05 DevD4v3