Hi, only the derived class has self-validation methods.
The base class allows us to call ent lib validation without client code needing a reference to ent lib. Each derived class could implement its own Validate method, but I have 80 derived classes and each one would need to
do exactly the same thing, ie. call ent lib validation and then adapt the results.
What I'm not clear about is why the type parameter ("T") needs to be explicitly defined in the Validation.Validate call for self validation to work.
If I didn't need to specify "T" my base business object wouldn't need to be generic.
public class BaseBusinessObject<T>
where T : BaseBusinessObject<T>, new()
public virtual BusinessObjectValidationResultCollection Validate(string ruleSet)
// Validate it
ValidationResults entLibResults = Validation.Validate<T>(this, ruleSet);
// 'Adapt' the results into our non-EntLib results
= new BusinessObjectValidationResultCollection(entLibResults);
public class SomeClass
ValidationResult result = new ValidationResult("Error...", this, "", "", null);
SomeClass sc = new
Hope this clarifies my issue.
16 April 2010 10:57
Stevens, Jason (I&I SD&T Distributed Developements)
Re: Ent Lib 3.1 Self Validation [entlib:209543]
Could you post the definition of your base class and subclass together with the self validation methods? I'm confused if both have self validation methods.
Global Technology & Solutions
Lloyds TSB Bank plc. Registered Office: 25 Gresham Street, London EC2V 7HN. Registered in England and Wales, number 2065. Telephone: 020 7626 1500.
Bank of Scotland plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland, number 327000. Telephone: 0870 600 5000
Lloyds TSB Scotland plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95237. Telephone: 0131 225 4555. Cheltenham & Gloucester plc. Registered Office: Barnett Way, Gloucester GL4 3RL. Registered
in England and Wales, number 2299428. Telephone: 01452 372372.
Lloyds TSB Bank plc, Lloyds TSB Scotland plc, Bank of Scotland plc and Cheltenham & Gloucester plc are authorised and regulated by the Financial Services Authority. Halifax is a division of Bank of Scotland plc. Cheltenham & Gloucester Savings is a division
of Lloyds TSB Bank plc. HBOS plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland, number 218813. Telephone: 0870 600 5000
Lloyds Banking Group plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland, number 95000. Telephone: 0131 225 4555
This e-mail (including any attachments) is private and confidential and may contain privileged material. If you have received this e-mail in error, please notify the sender and delete it (including any attachments) immediately. You must not copy, distribute,
disclose or use any of the information in it or any attachments.
Telephone calls may be monitored or recorded.