Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - Abstract class as ServiceContract

 
 
Old 08-09-2006   #1 (permalink)
=?Utf-8?B?RENCYXNz?=


 
 

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.

My System SpecsSystem Spec
Old 08-10-2006   #2 (permalink)
Arkady Frenkel


 
 

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.



My System SpecsSystem Spec
Old 08-10-2006   #3 (permalink)
=?Utf-8?B?RENCYXNz?=


 
 

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.

>
>
>

My System SpecsSystem Spec
Old 08-10-2006   #4 (permalink)
Arkady Frenkel


 
 

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.

>>
>>
>>



My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
When a class is both an inherited class of another, and alsoimplements an interface method .NET General
win32_pingstatus class / dns class PowerShell
Using a C# Class Library with VB6 .NET General


Vista Forums 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 Ltd

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