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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:16:20+00:00 2026-05-14T21:16:20+00:00

I just began studying WCF because i need it for a school assignment. But

  • 0

I just began studying WCF because i need it for a school assignment. But i have a problem when i am trying to send an object with some custom attributes.
The object is:

[DataContract]
public class Person
{
    [DataMember]
    [Searchable("ID")]
    public virtual String ID
    {
        get;
        set;
    }

    [DataMember]
    [Searchable("LastName")]
    public virtual String LastName
    {
        get;
        set;
    }

    [DataMember]
    [Searchable("FirstName")]
    public virtual String FirstName
    {
        get;
        set;
    }
}

The custom attribute is:

[DataContract]
[AttributeUsage(AttributeTargets.Property)]
public class Searchable:Attribute
{
    public Searchable(String PropertyName)
    {
        this.PropertyName = PropertyName;
    }

    [DataMember]
    public virtual String PropertyName
    {
        get;
        set;
    }
}

I use svcutil to generate the configuration file and the client. The communication between the client and the service is going on fine. But when I receive an object of type Person and try to search for attribute of type Searchable i can’t find any.

Is this possible? If yes could you provide any hints on how to achieve this kind of behavior?

Thanks.
Denis.

  • 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-14T21:16:21+00:00Added an answer on May 14, 2026 at 9:16 pm

    WCF is a message based service – you serialize your message on one side, send it across, and receive it on the other side. You’re not sending objects as you put it – you only send serialized messages. That’s quite an important difference!

    Your server and client are totally separate – they don’t share anything but the service description (the list of service methods), and the data contracts in the form of a XML schema.

    What you get when you create a client is a proxy for the service methods, and a copy of the data contract (looks the same, but different namespace, typically) that has the same signature in the serialized format. That’s all there is. You get a new, separate class on the client side, that will serialize into the same format as your original class on the server side.

    This means: you’ll get the same fields and properties – but that’s it. Anything else (like interfaces that are implemented, .NET attributes and more) are not replicated. They cannot be – after all, WCF is interoperable – the client could be a PHP app or a Ruby program. How are they going to handle .NET custom attributes?

    So in brief: anything that is .NET specific and goes beyond the simple XML-schema-based data representation cannot be used across a WCF service.

    There is a loop hole – if you control both ends of the communication – both server and client – and both are .NET, then you could:

    • put all your service and data contracts into a separate, shared assembly
    • reference that assembly in your service implementation on the server side
    • reference that assembly in your client side proxy

    Using this, you’ll have one assembly with the same data type on both the server and the client side – and with this “loophole”, you can preserve such .NET specifics like attributes between server and client.

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

Sidebar

Related Questions

I have just began researching services in Android. What I'm trying to do is
In learning C, I've just begun studying pointers to structures and have some questions.
I've just began learning Python and I've ran into a small problem. I need
I just began working with ASP.NET and I'm trying to bring with me some
I just began employing the figure and figcaption tag into a project, but have
I have just began to develop web applications at visual studio, with c# and
I have just began opengl programming in android and i am fairly new to
I just recently began using synthesized instance variables in my iPhone projects. The problem
I've just began using classes and would like to make some functions of a
I just began having problems with Indy. For some weird reason, even this very

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.