我在序列化对象时遇到问题。
这是我的示例代码:
服务代码:
///////////////////////
// REQUEST INTERFACE //
///////////////////////
SystemResponse IRequest.ChangeStatus(Models.RequestParameters pParameters)
{
SystemResponse response = new SystemResponse();
response = new Models.Request().ChangeStatus(pParameters);
return response;
}
Models.RequestModel IRequest.Fill(int pRequestCode)
{
return new Models.Request().Fill(pRequestCode);
}
List<Models.RequestModel> IRequest.GetList(string pUserID)
{
return new Models.Request().GetList(pUserID);
}
Models.RequestModel
[DataContract]
public class RequestModel
{
[DataMember]
public int RequestCode { get; set; }
[DataMember]
public string ModuleCode { get; set; }
[DataMember]
public Actions Action { get; set; }
[DataMember]
public string AffectedTable { get; set; }
[DataMember]
public List<Values> WhereValues { get; set; }
[DataMember]
public List<Values> NewValues { get; set; }
[DataMember]
public List<Values> OldValues { get; set; }
[DataMember]
public string Remarks { get; set; }
[DataMember]
public Status RequestStatus { get; set; }
[DataMember]
public string CreatedBy { get; set; }
[DataMember]
public DateTime CreatedOn { get; set; }
[DataMember]
public string ModifiedBy { get; set; }
[DataMember]
public DateTime? ModifiedOn { get; set; }
[DataMember]
public string CheckedBy { get; set; }
[DataMember]
public DateTime? CheckedOn { get; set; }
[DataMember]
public string ApprovedBy { get; set; }
[DataMember]
public DateTime? ApprovedOn { get; set; }
[DataMember]
public List<RequestChildModel> RequestChilds { get; set; }
}
public enum Actions
{
DELETE = 0,
UPDATE = 1,
INSERT = 2
}
public enum Status
{
NA = -1,
PENDING = 0,
CHECKED = 1,
APPROVED = 2,
REJECTED = 3,
CANCELLED = 4
}
[DataContract]
public struct Values
{
[DataMember]
public string FieldName { get; set; }
[DataMember]
public object Value { get; set; }
}
Models.RequestChild
[DataContract]
public class RequestChildModel
{
[DataMember]
public int RequestChildCode { get; set; }
[DataMember]
public int RequestCode { get; set; }
[DataMember]
public string ModuleCode { get; set; }
[DataMember]
public string AffectedTable { get; set; }
[DataMember]
public List<Values> WhereValues { get; set; }
[DataMember]
public List<Values> NewValues { get; set; }
[DataMember]
public List<Values> OldValues { get; set; }
}
序列化Models.RequestModel时。当我删除以下代码
Models.RequestModel IRequest.Fill(int pRequestCode)
{
return new Models.Request().Fill(pRequestCode);
}
List<Models.RequestModel> IRequest.GetList(string pUserID)
{
return new Models.Request().GetList(pUserID);
}
如果删除这两个功能,服务将完美运行。但是当我添加这两个方法时,我收到了此错误消息
请帮忙。我需要让GetList和Fill函数工作。 GetList将返回所有请求详细信息,Fill将返回请求详细信息。