开发者

Learning WCF with Entity Framework 4.0

I getting the following when I try to "test" this WCF:

*This operation is not supported in the wcf test client because it uses type MFA_WCF.gridObj()*

I should note that this is my 1st attempt to learn WCF and I'm also still learning EF. So I'm sure this is something I did. I'm just wondering if someone can tell me what I'm doing incorrectly:

I have my IService1 file I have the following:

[OperationContract]
[WebInvoke(ResponseFormat = WebMessageFormat.Json,
 RequestFormat = WebMessageFormat.Json)]
gridObj exerciseGet();

In my Service1 file I have:

public gridObj exerciseGet()
{
    IList<exercise> query;
    webdad3_myFitApp_EFModel context = new webdad3_myFitApp_EFModel();

    //List<string> eList = new List<string>();
    //mfa = new webdad3_myFitApp_EFModel();
    query = (from exercise e in context.exercises select e).ToList();
    gridObj go = new gridObj();

    go.Page = 1;
    go.Records = query.Count / 100;
    go.Total = query.Count;
    go.ListE开发者_运维百科xercise = query.ToList();

    return go;
}

This code is very much bits and pieces as I'm trying to convert what I was doing using .asmx to WCF. I created the gridObj just so I can format my entity results into a JSON friendlier format (i.e. the list data).

Maybe this isn't an error but an expected result. Is there anyway I can test this using the test client? Or do I just need to call it and see what happens?


The WCF test client does not support JSON (source).

You will have to use another approach to perform your tests: you can create a small client application and add a service reference to your service.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜