IDataErrorInfo

Posts   
 
    
mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 23-Feb-2009 16:36:50   

This makes me feel like I am missing some major idea about how interfaces work in .NET...why can't I directly access the members of the IDataErrorInfo interface on an entity? When I try something like:

MsgBox(myEntity.Error)

I get a compile error. But if I do:

MsgBox(CType(myEntity, IDataErrorInfo).Error)

it works fine...IDataErrorInfo is implemented in EntityBase2, so what am I missing?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 24-Feb-2009 06:36:30   

It's because the code uses Explicit interface implementation.

David Elizondo | LLBLGen Support Team
mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 24-Feb-2009 18:22:34   

daelmo wrote:

It's because the code uses Explicit interface implementation.

Right...I'm more of a VB.NET guy, so I'm not used to this.

For those out there using WPF and are trying and failing to display entity.Error (or any other explicitly implemented interface field) using XAML PropertyPath binding, here is some guidance:

http://leecampbell.blogspot.com/2008/09/generic-binding-in-wpf-through-explicit.html and http://groups.google.com/group/wpf-disciples/browse_thread/thread/57445c850a8a215f/cc65a29c9ab8ec44?show_docid=cc65a29c9ab8ec44&fwc=2&pli=1