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 498603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:54:01+00:00 2026-05-13T05:54:01+00:00

I have an service Interface: [ServiceContract] [ServiceKnownType(typeof(Models.ArticleImage))] public interface IPhotoManagementService { [OperationContract] bool Login(string

  • 0

I have an service Interface:

[ServiceContract]
[ServiceKnownType(typeof(Models.ArticleImage))]
public interface IPhotoManagementService
{
    [OperationContract]
    bool Login(string username, string password);

    [OperationContract]
    bool IsLoggedIn();

    [OperationContract]
    void UpdateImage(string articleID, string selectedImage);
}

As you can see I specify a typeof(Models.ArticleImage) on my ServiceContract.

So building the WSDL of this service should cause ArticleImage to pop up in the WSDL. Unfortunarly this doesn’t happen at all. Why is that?

ArticleImage has DataContract on it. And when I return an ArticleImage in my interface, then the WSDL does pick up ArticleImage.

Edit: it doesn’t even pop up in the service reference in the consuming project!


This is the result of a lot of testing:

  • The model I’m trying to add is a LINQ to SQL model.
  • When I add a normal model with ServiceKnownType it works.
  • When I use my LINQ to SQL entities in my Interface it works.
  • When I add my LINQ to SQL entity through ServiceKnownType it doesn’t pop up.
  • 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-05-13T05:54:01+00:00Added an answer on May 13, 2026 at 5:54 am

    Why would it need to? Where does your service expose something that could possibly be an ArticleImage?

    Re your comment; when using [ServiceKnownType], the extra trype is still exposed in the “mex” (consumed via “svcutil”) – but not by the WSDL. Are you using a WCF client? It should appear (I’ve just checked… it did). In general, though, returning vague data from a web-service isn’t a great idea… sub-types, sure! Dictionary<string,ArticleImage> or even Dictionary<string,SomeBaseType> (with [KnownType] etc), fine! But object, HashTable, etc – aren’t a good idea (IMO).

    You might also just return a list of your type (List<ArticleImage>) which will work in all scenarios (and be easy for WSDL etc); and let the client make the dictionary at their end.


    With regards to LINQ-to-SQL; objects for “mex” need to be decorated with [DataContract] / [DataMember]. You can do this in the designed by toggling the “serialization” property for the dbml. With this set (Serialization Mode = Unidirectional), it should work. To be honest, though, I think you be better-off just adding a dummy method that makes the type explicit on the API.

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

Sidebar

Ask A Question

Stats

  • Questions 249k
  • Answers 249k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Browing through the doxygen docs for ACE_Mutex, I don't understand… May 13, 2026 at 9:07 am
  • Editorial Team
    Editorial Team added an answer Profiling, profiling, profiling. :) Measure not only timings, but pay… May 13, 2026 at 9:07 am
  • Editorial Team
    Editorial Team added an answer Start with the docs: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIWebView_Class/Reference/Reference.html#//apple_ref/occ/cl/UIWebView Create a view based application… May 13, 2026 at 9:07 am

Related Questions

I have the following: [ServiceContract] [ServiceKnownType(typeof(ActionParameters))] [ServiceKnownType(typeof(SportProgram))] [ServiceKnownType(typeof(ActionResult<SportProgram>))] public interface ISportProgramBl { [OperationContract] IActionResult<ISportProgram>
I have few different applications among which I'd like to share a C# enum.
I encountered a problem when I tried to implement the ServiceKnownType example from MSDN.
I have a list of a custom DTO that I am trying to pass
Let's say I have a WCF contract such as [ServiceContract] public interface IContract {

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.