Here's an example code snippet that shows how to create a method using Dapper to call a SQL script referenced as an embedded resource in C#:
main.cs763 chars29 lines
To use this method, you would provide the name of the embedded resource that contains the SQL script you want to run, as well as an open IDbConnection
object that will be used to execute the script. For example:
main.cs162 chars6 lines
Note that the scriptName
parameter should be the full name of the embedded resource, which includes the namespace and assembly name. You can find this value by opening the Properties window for the file in Visual Studio and copying the value from the "Full Name" field.
gistlibby LogSnag