0

I use LinqPad to query data from microservices. My problem is that i've got 3 environments (test, integration, production). Every environment has it's own configuration (URLs, Users etc.).

Is it possible to create some kind of environment-constants for my LinqPad-Scripts?

My config could look like this:

Test:

{
    "productServiceUrl"="myDevServer.com/product.service",
    "User"="DevUser",
    "Password"="TopSecret"
}

Int:

{
    "productServiceUrl"="myIntServer.com/product.service",
    "User"="IntUser",
    "Password"="TopSecret2"
}

Prod:

{
    "productServiceUrl"="myProdServer.com/product.service",
    "User"="ProdUser",
    "Password"="TopSecret3"
}

And in myscript is want to user something like this:

var myProductService = new MyProductClient(CurrentEnvironmentConfig.ProductServiceUrl);
kara
  • 3,205
  • 4
  • 20
  • 34
  • You can use the `#load`directive to merge another query in that defines a `Config` class and merge a second query that defines the `CurrentEnvironmentConfig`? How would you expect to set the current environment? – NetMage Jan 16 '21 at 00:11
  • 3
    You can also write code in "My Extensions" (Shift+Ctrl+Y) which is visible to all queries. You could define your CurrentEnvironmentConfig class there. – Joe Albahari Jan 16 '21 at 23:58
  • LINQPad can also be run in a portable mode which allows you to set different configs, queries, and My Extensions. We use it to clone a Git repo and run separate queries to allow working on different code branches. – Enigmativity Feb 04 '21 at 08:37

0 Answers0