Search code examples
wcflinqentity-frameworkwcf-data-services

When i want to retrieving the image from database ,It showing me a ApplicationName and WCFService Name and Class name why?


In WCF Service I am making

[ServiceContract]
public interface IService1
{
    [OperationContract]
    CompositeType QuestionRetrieve(String email);
}

[DataContract]
public class CompositeType
{
   private String imageName;
    public string ImageName
    {
        get { return imageName; }
        set { imageName= value; }
    }

In Service1.cs

public CompositeType QuestionRetrieve(String email)
{
    context = new myEntities();
    Profile aProfile= new Profile();


    aProfile= (from c in context.Questions
                 where c.QuestionId == email
                 select c).First();

    CompositeType aCompositeType = new CompositeType();
    aCompositeType.imageName= aProfile.ImageName;


    return aCompositeType;
}

In Other WindowForm I tried to retrieving the value but it show me WindowApplicationName, ServiceName and Class name "CompositeType"

In WindowForm we are doing on PageLoad:

 Service aService = new Service();
 Label1.Text = aService.QuestionRetrieve("gh@gmail.com").ToString();

It showing me

  WindowFom.Service.CompositeType

Can you tell where is my error I am working with Entity.


Solution

  • You're executing the ToString() of the CompositeType object. Do this in stead:

    Label1.Text = aService.QuestionRetrieve("gh@gmail.com").ImageName;