Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8992617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:59:50+00:00 2026-06-15T22:59:50+00:00

I have several WCF service contracts, all of which contain exactly the same method

  • 0

I have several WCF service contracts, all of which contain exactly the same method StopOperation, having the same signature:

[ServiceContract]
public interface IMyServiceA
{
    [FaultContract(typeof(ServiceAError))]
    [OperationContract]
    void StopOperation(TaskInformation taskInfo);

    // other specific methods
}

What I’d like to be able to do is to extract StopOperation into an interface, IStoppable, and have all my services inherit this operation. However, I have a problem with the FaultContract definition, as it defines a concrete fault type.

Is it possible to have FaultContract refer to an abstract ErrorBase type, and have the concrete ones specified by KnownContract somehow? Kind of like:

[ServiceContract]
public interface IStoppable
{
    [FaultContract(typeof(ErrorBase))]
    [OperationContract]
    void StopOperation(TaskInformation taskInfo);
}

No matter where I tried specifying KnownContract, it didn’t seem to take.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:59:52+00:00Added an answer on June 15, 2026 at 10:59 pm

    Have you tried using a generic type ?

    For instance:

    [ServiceContract]
    public interface IStoppable<T> where T : ErrorBase
    {
        [FaultContract(typeof(T))]
        [OperationContract]
        void StopOperation(TaskInformation taskInfo);
    }
    

    Then you’d say

    [ServiceContract]
    public interface IMyServiceA : IStoppable<ServiceAError>
    {
        // other specific methods
    }
    

    Haven’t tested this, but I don’t see any reason why this shouldn’t work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several service contracts exposed over WCF, which use multiple datacontracts. The service
My program is a WCF service which publishes several methods and have multiple client.
I have a WCF Ria service which invokes several wcf services (non Ria). I'm
We have a WCF routing service which (obviously) routes to several WCF services. We
I have a WCF Service (several, actually) called by a WPF application, all under
I have several wcf services which are hosted using ServiceHost class. Now , I
Background I have inherited a project which relies on several different WCF "mex" endpoints
I have created several WCF services. In order to avoid adding service references in
I have a WCF Service that maintains several connections to various databases. I am
I have a WCF web service that exposes several business methods. I also have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.