Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

Abstract class as ServiceContract

 
 
Thread Tools Display Modes
Old 08-09-2006   #1 (permalink)
=?Utf-8?B?RENCYXNz?=
Guest


 

Abstract class as ServiceContract

Is there any way to use a pure abstract class rather than an interface as a
ServiceContract? I get runtime errors when I do so, but I'm not really
understanding the difference since in either case I am only defining the
abstract methods I want to expose as OperationContract elements.
Old 08-10-2006   #2 (permalink)
Arkady Frenkel
Guest


 

Re: Abstract class as ServiceContract

From MSDN
a.. An abstract class is permitted (but not required) to contain abstract
members.

As you can see " (but not required)" make the difference

Arkady

"DCBass" <DCBass@discussions.microsoft.com> wrote in message
news:9BE6C1F4-2E93-47A5-80AB-F496D1AF88BA@microsoft.com...
> Is there any way to use a pure abstract class rather than an interface as
> a
> ServiceContract? I get runtime errors when I do so, but I'm not really
> understanding the difference since in either case I am only defining the
> abstract methods I want to expose as OperationContract elements.



Old 08-10-2006   #3 (permalink)
=?Utf-8?B?RENCYXNz?=
Guest


 

Re: Abstract class as ServiceContract

I realize what an abstract class is, but I don't understand why that actually
makes a difference since in either case you are defining the interface
(method signatures, etc) of that class. I'm talking about a "pure" abstract
class where there is no implementation. This is a C++ concept but applies to
C# as well (see
http://en.wikibooks.org/wiki/Program...tract_Classes).

If the purpose of a ServiceContract is to define the interface to the WCF
service, why does it matter if it is specified in an abstract class or an
interface? It seems that it should really only matter that the
OperationContract attribute is only applied to abstract methods (whether they
are defined in an interface or an abstract class).

Is there any way to use an abstract class as a ServiceContract? If not,
what is the reasoning behind limiting this attribute to interfaces?

"Arkady Frenkel" wrote:

> From MSDN
> a.. An abstract class is permitted (but not required) to contain abstract
> members.
>
> As you can see " (but not required)" make the difference
>
> Arkady
>
> "DCBass" <DCBass@discussions.microsoft.com> wrote in message
> news:9BE6C1F4-2E93-47A5-80AB-F496D1AF88BA@microsoft.com...
> > Is there any way to use a pure abstract class rather than an interface as
> > a
> > ServiceContract? I get runtime errors when I do so, but I'm not really
> > understanding the difference since in either case I am only defining the
> > abstract methods I want to expose as OperationContract elements.

>
>
>

Old 08-10-2006   #4 (permalink)
Arkady Frenkel
Guest


 

Re: Abstract class as ServiceContract

Pure abstruct class of C++ is interface in C#. Abstruct class in C# can in
moment be changed to not so pure ( when you add the code ), that's why
interface demanded
Arkady

"DCBass" <DCBass@discussions.microsoft.com> wrote in message
news:C5901068-F2B5-45E1-A8C3-86EE2610BFEE@microsoft.com...
>I realize what an abstract class is, but I don't understand why that
>actually
> makes a difference since in either case you are defining the interface
> (method signatures, etc) of that class. I'm talking about a "pure"
> abstract
> class where there is no implementation. This is a C++ concept but applies
> to
> C# as well (see
> http://en.wikibooks.org/wiki/Program...tract_Classes).
>
> If the purpose of a ServiceContract is to define the interface to the WCF
> service, why does it matter if it is specified in an abstract class or an
> interface? It seems that it should really only matter that the
> OperationContract attribute is only applied to abstract methods (whether
> they
> are defined in an interface or an abstract class).
>
> Is there any way to use an abstract class as a ServiceContract? If not,
> what is the reasoning behind limiting this attribute to interfaces?
>
> "Arkady Frenkel" wrote:
>
>> From MSDN
>> a.. An abstract class is permitted (but not required) to contain abstract
>> members.
>>
>> As you can see " (but not required)" make the difference
>>
>> Arkady
>>
>> "DCBass" <DCBass@discussions.microsoft.com> wrote in message
>> news:9BE6C1F4-2E93-47A5-80AB-F496D1AF88BA@microsoft.com...
>> > Is there any way to use a pure abstract class rather than an interface
>> > as
>> > a
>> > ServiceContract? I get runtime errors when I do so, but I'm not really
>> > understanding the difference since in either case I am only defining
>> > the
>> > abstract methods I want to expose as OperationContract elements.

>>
>>
>>



 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Class not Registered eldonstuhr Vista music pictures video 3 05-30-2007 10:45 PM
PowerShell Class Hayato Iriumi PowerShell 4 11-02-2006 11:18 PM
Having a window extend an abstract class Jason Dolinger Avalon 1 01-31-2006 07:00 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50