Reputation: 3057
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
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