locked
dataannotations coditional web.config appsettings RRS feed

  • Question

  • User749469198 posted

    Hi,

    in my webapp i use dataannotations validation in partial metadata class.
    in web.config i have appsetttings - key customer
    how can i change validation based on the key customer in web.config

    or can i assign different partial class to my entity e.g. computer
    something like

    if customer = "c1" then
    partial class computermetadatac1
    else
    partial class computermetadatac2

    Thanks

    Saturday, February 1, 2014 12:19 PM

Answers

  • User-330204900 posted

    You should be able to just use the

    var test = Convert.ToBoolean(ConfigurationManager.AppSettings["TEST"]);

    to get a value from the web.config

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, February 2, 2014 12:05 PM