0

私が作っているWCFサービスで

[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;
}

他の WindowForm で値を取得しようとしましたが、WindowApplicationName、ServiceName、およびクラス名「CompositeType」が表示されます

WindowForm では、PageLoad で行っています。

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

それは私を示しています

  WindowFom.Service.CompositeType

エンティティで作業している私のエラーがどこにあるのか教えてください。

4

1 に答える 1

1

オブジェクトの を実行してToString()CompositeTypeます。代わりにこれを行います:

Label1.Text = aService.QuestionRetrieve("gh@gmail.com").ImageName;
于 2013-03-30T22:26:21.293 に答える