tags:

views:

27

answers:

1

The problem is simple, finding the answer is not (for me at least).

I'm trying to make a WCF service that queries MapPoints FindAddressResults() and returns the answer which I then fetch with Ajax and Javascript.

The problem however is that now I'm getting a FindResults result from FindAddressResults() and I don't know how to expose that as a contract. So I made a wrapper result class.

How can I expose FindResults as a service contract when I don't have access to the source?

[ Edit ]

FindResults is defined as this:

namespace MapPoint
{
    [TypeLibType(4288)]
    [Guid("188084CF-DB96-482B-97A6-2571DF9BEF81")]
    public interface FindResults : IEnumerable
    {
        [DispId(100663313)]
        Application Application {get; }
        [DispId(100663321)]
        int Count {get; }
        [DispId(-803)]
        Map Parent {get; }
        [DispId(100672001)]
        GeoFindResultsQuality ResultsQuality {get; }

        [DispId(0)]
        object this[ref object Index] {get; }

        [TypeLibFunc(64)]
        [DispId(-4)]
        IEnumerator GetEnumerator();
    }
}
A: 

Can you just extend the class you want and add the contract attribute?

[ServiceContract]
public MyFindResults : FindResults
{
  [DataMember]
  public new string String1
  {
    get
    {
      return base.String1;
    }
  }
}
Chris Arnold
But don't I need to add [DataMember] to all the members?
blueblood
Override / 'new' all of those as well (I've edited my answer to illustrate).
Chris Arnold