How to use the value from one validation in another validation #1136
-
We have an extension to configuration[MyKeyName] I need to check for one parameter name, and, if not empty, use that value as part of other keys to look up other parameters. For example, in imperative code I might have: var env = configuration[MyKeyName];
var dbHostName = configuration[$"{DbHostNameKey}-{env}"];
var dbName = configuration[$"{DbNameKey}-{env}"];
var port = configuration[$"{DbPortKey}-{env}"];
var user = configuration[$"{DbUserKey}"];
var pass = configuration[$"{DbPasswordKey}"]; Notice that the I would like to approach this more functionally, such that I get a validation error if the value from private sealed class DbAuthInfo
{
public string DbHost { get; set; }
public string DbName { get; set; }
public uint DbPort { get; set; }
public string DbUser { get; set; }
public string DbPass { get; set; }
} Thanks for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Just put them in a LINQ expression:
|
Beta Was this translation helpful? Give feedback.
Just put them in a LINQ expression: