tags:

views:

66

answers:

1

Hi All,

I am working on WCF Data service which imported stored procedure, as below.

    [WebGet]
    public List<GetMTSearchResultTest_Result> GettMTSearchResultTest()
    {
        MediaMarketResearch_PRODEntities ent = new MediaMarketResearch_PRODEntities();
        return ent.GetMTSearchResultTest().ToList();
    }

when i consuming this in my client application it says error as "The closed type MMRClient.MMRServiceReference.GetMTSearchResultTest_Result does not have a corresponding element settable property."

I am getting this error while bind to the grid view as below.

    DataServiceContext context = new DataServiceContext(new Uri("http://localhost:4131/MMRDataService.svc/"));
    IEnumerable<GetMTSearchResultTest_Result> empResult = context.Execute<GetMTSearchResultTest_Result>(new Uri("http://localhost:4131/MMRDataService.svc/GettMTSearchResultTest"));
    GridView1.DataSource = empResult;
    GridView1.DataBind();

Note: I imported this stored proc as complex type.

Please advice me on this.

Regards,

Jaydeep

A: 

I think this link may help you (see the selected answer).

Essentially, what the solution may be is to create a partial class for GetMTSearchResultTest_Result and decorate it with a DataServiceKey attribute, providing a non-nullable column that acts as a primary key (although I don't think it has to be unique).

So your partial class would look something like:

[DataServiceKey("YourKeyColumnName")]
public partial class GetMTSearchResultTest_Result {
}

If you're just doing reads, I don't think you'll need any implementation.

Hopefully this works. Let me know if there are issues/questions and I'll update accordingly.

David Hoerster