C# 不使用Newtonsoft,但我可以按照你的建议命名这个类。谢谢你的建议。谢谢你的建议。 "getProfilesByImisidResponse": { "getProfilesByImisidResult": { "profil
C# 不使用Newtonsoft,但我可以按照你的建议命名这个类。谢谢你的建议。谢谢你的建议。 "getProfilesByImisidResponse": { "getProfilesByImisidResult": { "profil,c#,asp.net,json,rest,C#,Asp.net,Json,Rest,不使用Newtonsoft,但我可以按照你的建议命名这个类。谢谢你的建议。谢谢你的建议。 "getProfilesByImisidResponse": { "getProfilesByImisidResult": { "profileResponse": [ "RegisteredOwner": [ [ { "AVRRProfileId": "AVRRP000000169", "ESBTransactionGuId": "d28cb710-9ff5
不使用Newtonsoft,但我可以按照你的建议命名这个类。谢谢你的建议。谢谢你的建议。
"getProfilesByImisidResponse": {
"getProfilesByImisidResult": {
"profileResponse": [
"RegisteredOwner": [
[
{
"AVRRProfileId": "AVRRP000000169",
"ESBTransactionGuId": "d28cb710-9ff5-45f8-a5a6-e779aaf07151",
"ErrorMessage": null,
"Transaction": null,
"RegisteredOwners": [
{
"FirstName": "Kevin",
"LastName": " Dunn"
},
{
"FirstName": "Elaine",
"LastName": " Dunn"
}
]
},
{
"AVRRProfileId": "AVRRP000000170",
"ESBTransactionGuId": "d28cb710-9ff5-45f8-a5a6-e779aaf07151",
"ErrorMessage": null,
"Transaction": null,
"RegisteredOwners": [
{
"FirstName": "Kevin",
"LastName": " Dunn"
},
{
"FirstName": "Elaine",
"LastName": " Dunn"
}
]
}
]
{
"getProfilesByImisidResponse": {
"getProfilesByImisidResult": {
"profileResponse": [
{
"AVRRProfileId": "AVRRP000000169",
"ESBTransactionGuid": null,
"ErrorMessages": null,
"Transaction": null,
"RegisteredOwners": {
"RegisteredOwner": [
{
"FirstName": "Kevin",
"LastName": " Dunn"
},
{
"FirstName": "Elaine",
"LastName": " Dunn"
}
]
}
},
{
"AVRRProfileId": "AVRRP000000170",
"ESBTransactionGuid": null,
"ErrorMessages": null,
"Transaction": null,
"RegisteredOwners": {
"RegisteredOwner": [
{
"FirstName": "Kevin",
"LastName": " Dunn"
},
{
"FirstName": "Elaine",
"LastName": " Dunn"
}
]
}
}
]
}
}
}
using System;
...
namespace AXWCFLINQ
{
public class AVRRService : IAVRRService
{
private daoAVRR daoAVRR = new daoAVRR();
public List<profileResponse> getProfilesByImisid(IMISIdRequest imisIdRequest)
{
return daoAVRR.getProfilesByImisid(imisIdRequest);
}
}
}
using System;
...
namespace AXWCFLINQ
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IAVRRService" in both code and config file together.
[OperationContract]
[WebInvoke
(UriTemplate = "/getProfilesByImisid",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json, Method = "POST")]
List<profileResponse> getProfilesByImisid(IMISIdRequest imisIdRequest);
}
}
public List<profileResponse> getProfilesByImisid(IMISIdRequest imisIdRequest)
{
List<profileResponse> AVRRList = null;
string IMISId = "";
IMISId = imisIdRequest.imisId;
try
{
var aVRRInfo = from a in db.AMA_AVRR_PROFILEs
where (a.IMISID == IMISId && a.ACTIVE == 1)
select new profileResponse
{
AVRRProfileId = a.AVRRPROFILEID,
ESBTransactionGuId = a.ESBTRANSACTIONGUID,
ImisId = a.IMISID,
RegisteredOwners = GetRegisteredOwnerList(a.REGISTEREDOWNER1, a.REGISTEREDOWNER2),
ErrorMessage = "",
Transaction = GetTransactionByAVRRProfileId(a.AVRRPROFILEID)
};
AVRRList = aVRRInfo.ToList();
}
catch (Exception e)
{
string ex = e.ToString();
}
return AVRRList;
}
public class profileResponse
{
public string AVRRProfileId { get; set; }
public string ESBTransactionGuId { get; set; }
public string ErrorMessage { get; set; }
public List<RegisteredOwner> RegisteredOwners { get; set; }
public Transaction Transaction { get; set; }
}
public class RegisteredOwners : List<RegisteredOwner>
{
}
public class profileResponses : List<profileResponse>
{
}
public class ProfileResponse
{
public string AVRRProfileId { get; set; }
public string ESBTransactionGuId { get; set; }
public string ErrorMessage { get; set; }
public RegisteredOwners RegisteredOwners { get; set; }
public Transaction Transaction { get; set; }
}
public class ProfileResponseWrapper
{
[JsonProperty(Name = "getProfilesByImisidResponse")]
public ProfilesByImisResponse response;
}
public class ProfilesByImisResponse
{
[JsonProperty(Name = "getProfilesByImisidResult")]
public ProfilesByImisResult result;
}
public class ProfilesByImisResult
{
[JsonProperty(Name = "profileResponse")]
public List<ProfileResponse> ProfileResponses;
}
public class RegisteredOwners
{
public List<RegisteredOwner> RegisteredOwner; //You should consider naming these differently as this isn't ideal for clarity
}