Hi Marc,
I must admit that I was a bit sceptical when I first read your
messsage but I desparately needed this thing to work.
I have not the faintest idea what an Interface is ( but I will now
learn ).
Instead of creating the partial classes you suggested, I just added
the Interface to the end of the ORG and ORGScopy classes of the dbml
file
public partial class ORG : INotifyPropertyChanging,
INotifyPropertyChanged, IOrg
public partial class ORGScopy : INotifyPropertyChanging,
INotifyPropertyChanged, IOrg
I copied the rest of your suggestion to the letter, and all worked
perfectly, although I have no idea why.
I am extremely happy - thank you very much for taking the time to
help.
I can't thank you enough,
Regards,
Pete
>> I forgot to mention that the using statement you suggestion did not
>> work. error:Cannot implicitly convert type 'ORGScopy' to 'ORG'
[quoted text clipped - 38 lines]
>
>Any problems, post back...
Marc Gravell - 02 Mar 2008 10:29 GMT
> I just added the Interface to the end of the ORG and ORGScopy classes
> of the dbml file
*important*:
You shouldn't edit the generated code (from the dbml) - it is quite
likely (i.e. guaranteed) to be randomly destroyed when the compiler
decides it wants to update the generated class files.
Partial classes are simply a way of getting around this, by separating
the /user/ code and the /generated/ code into separate files. Hence
the "partial" bit I quoted does exactly the same as adding ": IOrg" to
the generated class, but without the risk of losing your change at the
worst possible moment.
> (interfaces)
Interfaces are a way of describing the signature of an object, without
having to know the implementation details. In particular, it allows us
to describe the common features of ORG and ORGScopy (i.e. that they
both have a few properties such as OrgName), without forcing them to
be the same thing. I'm probably not describing it right; I recommend
finding a good "OO" book?
> thank you very much for taking the time to help.
You are more than welcome; I'm glad it worked ;-p
If you get any problems, post back (but you might want to start a new
topic if it is an unrelated issue).
Marc