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

  • SEARCH
  • Home
  • 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 7740605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:49:24+00:00 2026-06-01T08:49:24+00:00

i have two data classes which hold only data members(no functions). One is CallTask

  • 0

i have two data classes which hold only data members(no functions). One is CallTask the other is SmsTask. These two classes have some common properties like ID, Tel. I put these common properties in a seperate interface class and i use this interface class in my project whenever appropriate.
Now i added a WCFService to my project to share data between clients and server. Consider the following class design:

public interface IGsmTask : IComparable
{
    string TaskID { get; set; }
    string SessionID { get; set; }
    string Tel { get; set; }
}

class CallTask : IGsmTask
{
    #region IGsmTask Members

    public string TaskID { get; set; }

    public string SessionID { get; set; }

    public string Tel { get; set; }

    #endregion        
}

class SmsTask : IGsmTask
{
    #region IGsmTask Members

    public string TaskID { get; set; }

    public string SessionID { get; set; }

    public string Tel { get; set; }

    #endregion

    public string SmsText { get; set; }
}

in this design, i want to host CallTask, SmsTask, and IGsmTask to the clients to use these in service methots like the following;

    [OperationContract]
    public void AddTask(IGsmTask task)
    {

    }

i tried to mark [DataContract] on IGsmTask but it gives me complition error. Isnt there any methot that i can use interfaces as DataContracts? Or how should i use KnownAttributes types in this synerio?
Thanks.

  • 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-01T08:49:25+00:00Added an answer on June 1, 2026 at 8:49 am

    As far as I know using interfaces as datacontracts is not possible. You may use a base class and add knowntype attributes on the otherhand.

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

Sidebar

Related Questions

I have two arraylists, one contains Strings and the other contains Classes that have
Actually I have two java classes of which one is an activity class. Now
I have two classes, one is Post and the other is Category, with a
I have two classes, one has a lot of properties and the other has
I have two QDialogs stacked on top of each other, with some data is
I have two data sources: a legacy one (web service) and a database one.
i have two data tables with the same structure the first one has one
I am trying to have two data series plotted in one graph as boxes
I have these two data structures that I continually find myself choosing between when
I have two types of classes: BaseUser < ActiveRecord::Base and User < BaseUser which

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.