Skip to content

Simple Validation Rule

Ali Yousefi edited this page Dec 22, 2018 · 1 revision

Validation rules let you validate incoming values from client without writing hard codes,that is working with attributes you can use on class properties , methods parameters.

Example:

        public string Login([EmptyValidation]string userName, [EmptyValidation] string password)
        {
            return $"method called,validation is ok userName:{userName} password:{password}";
        }

you can see EmptyValidation class next to your method parameters, when signalgo want to call your service methods first check validations, if parameter value was not valid signalgo skip to call your service method and send error to client.

validation rule full sample: https://github.com/SignalGo/signalgo-samples/tree/master/CsharpValidationRulesSample