0
SSRSレポートを返す予定のレポートサービスが1つあります。私のプロジェクトにはいくつかのレイヤーがあります。C#Rest APIレスポンスとしてServerReportを返します。
コード:
APIの契約: IReport.cs
[ServiceContract]
[ServiceKnownType(typeof(ServerReport))]
[ServiceKnownType(typeof(ReportDTO))]
public interface IReport
{
[OperationAttribute("GetReportControls", OperationType.GET)]
List<ReportControlDTO> GetReportControls(int UserReportId, string Culture);
[OperationAttribute("GetReportNames", OperationType.GET)]
List<ReportNameDTO> GetReportNames(int RoleId);
[OperationAttribute("GetReportQuery", OperationType.GET)]
ReportQueryDTO GetReportQuery(int ReportId, string SelectedValue, string SelectedGroup, string Culture, int TimezoneOffset);
[ServiceKnownType(typeof(ServerReport))]
[OperationAttribute("GetReport", OperationType.GET)]
ReportDTO GetReport(int ReportId, string SelectedValue, string SelectedGroup, string Culture, int TimezoneOffset);
}
API:Report.cs
public partial class ReportService : IReport
{
public List<ReportControlDTO> GetReportControls(int UserReportId, string Culture)
{
//code
}
public List<ReportNameDTO> GetReportNames(int RoleId)
{
//code
}
public ReportQueryDTO GetReportQuery(int ReportId, string SelectedValue, string SelectedGroup, string culture, int TimeOffset)
{
//code
}
public ReportDTO GetReport(int ReportId, string SelectedValue, string SelectedGroup, string culture, int TimeOffset)
{
ReportDTO result =new ReportDTO();
result.SSRSReport=new ServerReport();
result.ReportId=123;
return result;
}
}
ReportDTO.cs
[DataContract]
[Serializable]
public class ReportDTO
{
[DataMember]
public ServerReport SSRSReport { get; set; }
[DataMember]
public int ReportId { get; set; }
}
私がいることを呼び出していますサービス使用して、次のコード:
var _report = PlatformAPIProxy.Report.GetReport(ReportId, SelectedVal, SelectedGroup, selectedCulture, TimezoneOffset);
私の問題は、私は_reportが、他のプロパティSSRSReport(ServerReportのタイプ)でReportIdヌル取得を取得しています。 サービスからは、SSRSReportとReportIdの両方が返されますが、結果としてSSRSReportはnullになります。 このタイプのオブジェクトを返す解決策はありますか?