You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DbUp Discuss
Good Morning,
how can I access variables within a Code-based scripts?
I want to pass a set of parameters to the "script" in C #, and I do not know how to do it ..
Can anyone help?
thank you
Adam K
unread,
Nov 6, 2018, 9:53:05 AM11/6/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DbUp Discuss
Use .WithVariables to push the variables in.
Use if blocks (e.g. IF '$TargetEnvironment$' = 'LOCAL') to branch behavior in the scripts.
We try not to use these too often because you can end up with mismatches in behavior in different environments.
Jorge Marques
unread,
Nov 6, 2018, 10:55:48 AM11/6/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DbUp Discuss
My problem is not in using variables in SQL statements, but in C #
public class CreateTenantBusinessLayer : IScript
{
public string ProvideScript(Func<IDbCommand> commandFactory)
{
if ('$TargetEnvironment$' == 'LOCAL')
{
Adam K
unread,
Nov 7, 2018, 9:37:06 AM11/7/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DbUp Discuss
You might need to describe what you're trying to do. In our console app that runs DbUp, we use appsettings, but you could also use command line params. It really depends on what you're trying to accomplish.