2

エンティティ「UserProfile」を返すことになっている Web サービスを作成しました。ほとんどの操作は期待どおりの結果を返しますが、生成されたクラスを直接返すと空の応答が返されます。

サービス:

List<UserProfile> IMusicOwnerService.getProfiles()
    {
        return context.UserProfileSet.ToList();
    }

リクエスト

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:getProfiles/>
   </soapenv:Body>
</soapenv:Envelope>

Model.tt ファイルを変更し (この回答に従って)、このクラスが生成されました:

    using System;
    using System.Collections.Generic;
    using System.Runtime.Serialization;  //Template modification test
    [DataContract]//Template modification test
    public partial class UserProfile
    {

        public UserProfile()
        {
            this.LoginSession = new HashSet<LoginSession>();
            this.Playlist = new HashSet<Playlist>();
            this.Friends = new HashSet<UserProfile>();
            this.Song = new HashSet<Song>();
        }

        [DataMember]//Template modification test
        public int Id { get; set; }
        [DataMember]//Template modification test
        public string UserName { get; set; }
        [DataMember]//Template modification test
        public string Email { get; set; }
        [DataMember]//Template modification test
        public string Password { get; set; }
        [DataMember]//Template modification test
        public string Salt { get; set; }

}

リクエストを送信しても応答がありません。

http://imgur.com/AvtTmNE (写真を投稿するには評判が足りない)

4

0 に答える 0