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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:26:43+00:00 2026-05-12T11:26:43+00:00

I have an application where client and server share types, and interoperability is not

  • 0

I have an application where client and server share types, and interoperability is not one of our concerns. I am planning to have a single repository for all web enabled objects, and i was thinking of a generic interface for my exposed service.

something like T GetObject(int id)

but wcf doesnt like it since its trying to expose its schema (which i dont really care about)

is it possible to do such a thing with WCF ?, i can use any type of binding doesnt have to be httpbinding or wsbinding…

  • 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-12T11:26:43+00:00Added an answer on May 12, 2026 at 11:26 am

    I suppose this is possible, though I’m not sure you’d want this. I’d take the following approach (untested, not sure if it works). First create the following project structure in your solution:

    • ServiceInterfaces
    • ServiceImplementations (references ServiceInterfaces and ModelClasses)
    • ModelClasses
    • Host (references ServiceInterfaces and ServiceImplementations)
    • Client (references ServiceInterfaces and ModelClasses)

    In ServiceInterfaces you have an interface like this (I skipped the namespaces, etc to make the example shorter):

    [ServiceContract]
    public interface IMyService<T>
    {
        T GetObject(int id);
    }
    

    In ServiceImplementations you have a class that implements IMyService<T>:

    public class MyService<T> : IMyService<T>
    {
        T GetObject(int id)
        {
            // Create something of type T and return it. Rather difficult
            // since you only know the type at runtime.
        }
    }
    

    In Host you have the correct configuration for your service in an App.config (or Web.config) file and the following code to host your service (given that it is a stand-alone app):

    ServiceHost host = new ServiceHost(typeof(MessageManager.MessageManagerService))
    host.Open();
    

    And finally in Client you use a ChannelFactory<TChannel> class to define a proxy:

    Binding binding = new BasicHttpBinding(); // For the example, could be another binding.
    EndpointAddress address = new EndpointAddress("http://localhost:8000/......");
    IMyService<string> myService =
        ChannelFactory<IMyService<string>>.CreateChannel(binding, address);
    string myObject = myService.GetObject(42);
    

    Again, I’m not sure if this works. The trick is to share your service interfaces (in ServiceInterfaces) and domain model objects (in ModelClasses) between the host and the client. In my example I use a string to return from the service method but it could be any data contract type from the ModelClasses project.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Assuming the assembly has already been defined to create the… May 12, 2026 at 1:26 pm
  • Editorial Team
    Editorial Team added an answer Well, for starters, I think you need to rewrite relative(X,Y)… May 12, 2026 at 1:26 pm
  • Editorial Team
    Editorial Team added an answer Have you tried using whenever sqlerror exit sql.sqlcode in your… May 12, 2026 at 1:26 pm

Related Questions

I'm creating the server side implementation of an AJAX based web application, where the
How to create a WPF application that can be deployed as either a XBAP
I need to get unmanaged Windows C++ clients to talk to a WCF service.
An application I wrote for a client almost 2 years ago using Flex 2

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.