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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:51:30+00:00 2026-05-21T05:51:30+00:00

I am trying to use Generic DataContract class so that I don’t have to

  • 0

I am trying to use Generic DataContract class so that I don’t have to implement several types for a collection of different objects.

Exp :

I have a Profile object which contains a collection of objects.

So I want to have one Profile<Foo> and Profile<Foo1> where profile contains a collection of Foo or Foo1 objects.

I have been reading that WCF does not support generic classes and actually the error that I get is the following.

Type 'GL.RequestResponse.ProfileResponse1[T]’ cannot be exported as a schema type because it is an open generic type. You can only export a generic type if all its generic parameter types are actual types.`

Now the ProfileResponse is this Profile object that I am trying to use.

Now in my host I am doing the following. :

 ServiceConfig(typeof(ProfileHandler<EducationResponse>).Assembly, 
               typeof(ProfileRequest).Assembly,
               typeof(Container)).Initialize();

This is dhe definition of the handler with the datacontract.

   public class ProfileHandler<T> : RequestHandler<ProfileRequest,
                                                   ProfileResponse<T>> 

The Container is using Windsor Container to register the objects.

The registration works fine but after I instantiated the Service Host for WCF processor, and call Open Method of the host I get the above error.

Is there really no way for me to write generic response requests for wcf with agatha ?
It feels like such a waste to have to define a Profile container class for each type being contained in that collection.

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-05-21T05:51:31+00:00Added an answer on May 21, 2026 at 5:51 am

    One cannot have open generic handlers, because the server side needs to know what the type is.
    One can use so called closed generic methods. This way the server side knows the types for witch to load the handler.

    Also, one could potentially configure Agatha so that it allows to receive extra information related to the request. In this case, it would be the type wrapped in the response.

    One could do this by defining a a BaseRequest class and having all the request extend this class. This class can have a property which takes the type of the response. Or the type to be wrapped in the response.

    In the process, when examining the request, the process can get the type to be wrapped in the Response, so that i knows how to load the class.

    I have not implemented this, since it would take too much time and I am not sure I want to be responsible for maintaining Agatha for our application, but this is how I would do it.

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

Sidebar

Related Questions

I'm trying to use a generic List as a property on a ServicedComponent class...
While trying to use LINQ to SQL I encountered several problems. I have table
Im trying to use generic types for the first time in Java , as
I am trying to use Generic Types in Windows.Resources section in XAML code. To
I'm trying to implement generic method to put in a class a calculated value
I'm struggling with some Generic constraint issues when trying to implement a library that
I'm trying to use a generic list as a property of the users profile.
I am trying to use a Generic Linked List to hold some WorkFlow steps
I am trying to use the boost generic image library to convert CYMK images
Trying to use an excpetion class which could provide location reference for XML parsing,

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.