views:

34

answers:

1

I am using SQL Reporting services to hit a WCF web service.

My query is:

    <Query>
<Method Name="GetADTHistory" Namespace="http://tempuri.org/"&gt;
<Parameters>
       <Parameter Name="personId"><DefaultValue>7885323F-DE8D-47E5-907D-2991C838FF3E</DefaultValue></Parameter>
   </Parameters>
</Method>
<SoapAction>
http://tempuri.org/IResidentServiceFrontEnd/GetADTHistory
</SoapAction>
</Query>

My implementation is

public List<ResidentDataTypes.Person> GetADTHistory(Guid personId)
        {
            using (ResidentDataTypes.MyEntities entity = new ResidentDataTypes.MyEntities ())
            {
                var person = (from a in entity.People.Include("ResidentAdts")
                              where a.PersonId == personId
                              select a);

                if (person.Count() > 0)
                {
                    return person.ToList();
                }
                else
                {
                    return new List<Person>();
                }

            }
        }

This works fine if there are 2 or more ADT records. Reporting services correctly sees all the fields in the database. However if there is only 1 ADT record reporting services sees the 'Person' columns but none of the ADT records. Any ideas?

A: 

It looks like that you have an eager/lazy load issue. I suggest you to execute and test the query with linqpad to check if it really includes the ResidentAdts in the case of single record.

I also recommend you to check this thread: Linq to Entities Include Method Not Loading

Adding the "Linq" tag to your question would also helpful.

orka
I have verfied that ADTs load via SQL profiler and I can see the objects within a watch window of Visual studio prior to the function returning.
Biggle10
Then, it may be related to your report definition and how to use the ADT records in the report structures. I dont think it is a serialization problem but it may also worth to check if the data serialized correctly with a custom client which call the services. You may also use a tool like Fiddler to check the data recieved from server if it is not encrypted.
orka
When I use the WCF Test Client, it hangs on this method. It works for other methods on the same service. I will look into using Fiddler.
Biggle10