IDataErrorInfo override

Posts   
 
    
Posts: 29
Joined: 05-Sep-2005
# Posted on: 20-Dec-2006 12:52:27   

I have sucessfully implemented using the IDataErrorInfo interface in my entities for VB using the methods presented by prog posted on 16-nov-2005 (Implementin IDataErrorInfo and using ErrorProvider) thread 4766.

However, when I add a custom implementation of the IDataErrorInfo.Item property, I get a warning in VS 2005 saying the 'item' property is already implemented by the base class, EntityBase, re-implementation is assumed. See the following code I inserted:


Public ReadOnly Property Item(ByVal columnName As String) As String Implements IDataErrorInfo.Item
   Get
      Return foobar
   End Get
End Property

My questions are,

1) what does the EntityBase Item (and Error) property return? (i.e., do I really need to 're-implement' it?

2) if I do need to reimplement it, how do I turn off the nagging error b/c I will re-implement it for every entity?

In my code above, foobar represents the validator class for the entity and returns the column name of the error.

Walaa avatar
Walaa
Support Team
Posts: 14987
Joined: 21-Aug-2005
# Posted on: 20-Dec-2006 15:05:45   

Are you using LLBLGen Pro v.2.0? Cause IDataErrorInfo is already implemented there in the EntityBase class. The following is copied from the LLBLGen Pro v.20 docs (Using the generated code -> SelfServicing/Adapter -> Using the entity classes):

IDataErrorInfo implementation The .NET interface IDataErrorInfo is now implemented on EntityBase. Two methods have been added to the entities: SetEntityError and SetEntityFieldError, which allows external code to set the error of a field and/or entity. If append is set to true with SetEntityFieldError, the error message is appended to an existing message for that field using a semi-colon as separator.

Entity field validation, which is triggered by the entity's method SetNewFieldValue() (which is called by a property setter), sets the field error if an exception occurs or when the custom field validator fails. The error message is appended to an existing message.

Posts: 29
Joined: 05-Sep-2005
# Posted on: 23-Dec-2006 13:46:03   

Are you using LLBLGen Pro v.2.0?

Yes

Cause IDataErrorInfo is already implemented there in the EntityBase class. The following is copied from the LLBLGen Pro v.20 docs (Using the generated code -> SelfServicing/Adapter -> Using the entity classes):

Yes, I am aware of the SetError methods. The problem is there is no public access to anything but setting the errors. I cannot find a way to read the errors afterwards and clear them when they are fixed.

I have created a set of custom templates to generate in VB.NET for NET 2.0 to accomplish the validation at the field level. I use the Validator files (which are not set by default) and include code to override the ValidateFiledValue method. I also add a partial class to each entity under a separte EntityPartialClass directory that extends the entity to use more specific IDataErrorInfo methods. I have created detailed documenation in the readme file and examples of how specifically to hook into the UI forms.

I would like to make them available for everyone's use. How do I do that??

Walaa avatar
Walaa
Support Team
Posts: 14987
Joined: 21-Aug-2005
# Posted on: 25-Dec-2006 07:44:20   

I would like to make them available for everyone's use. How do I do that??

If you want to share your code with every one, please attach your code to this thread, and we will have a look at it and then we will add it to the third-party downloads.

Markiemac
User
Posts: 132
Joined: 25-Apr-2006
# Posted on: 27-Feb-2007 19:29:37   

I have created a set of custom templates to generate in VB.NET for NET 2.0 to accomplish the validation at the field level. I use the Validator files (which are not set by default) and include code to override the ValidateFiledValue method. I also add a partial class to each entity under a separte EntityPartialClass directory that extends the entity to use more specific IDataErrorInfo methods. I have created detailed documenation in the readme file and examples of how specifically to hook into the UI forms.

I would like to make them available for everyone's use. How do I do that??

David,

Did you ever make these available?

Regards