Sukesh Chand
Sukesh Chand

Reputation: 3057

Creating complex validations using microsoft Enterprise library validation block

I want to implement the following type of validations using Validation block. I am using EntLib 5.0 and in SQL Server database I am storing the validation rules. How to create the following validations using EntLib 5.0 Designer tool.

If(PaymentType == 'CreditCard')
{
     if(BilledAmount<100)
     {
         ErrorMsg = "Bill amount should greater than or equal to 100";
     }
     else if (BillAmount + TaxAmount > CreditCardMaxLimit)
     {
         ErrorMsg= "Credit card Max Amount limit is " + CreditCardMAxLimit;
     }
}

Upvotes: 1

Views: 1316

Answers (1)

jeff.eynon
jeff.eynon

Reputation: 1326

I don't think you're going to be able to use the designer, because that only works with pre-built validation options (Required, max length, etc). You're using custom logic.

I would recommend using Self Validation. Mark your object with the [HasSelfValidation] attribute and then mark your validation method with the [SelfValidation] attribute. See here:

http://www.codeproject.com/Articles/256355/Microsoft-Enterprise-Library-5-0-Introduction-to-V

Upvotes: 1

Related Questions