MSMQ メッセージを読み取るときに、次のエラー メッセージが表示されます...
タイプ 'System.ServiceModel.MsmqIntegration.MsmqMessage`1[MSMQLibrary.MyEvents+Dashboard_Message]' のオブジェクトをタイプ 'Dashboard_UserDetail' にキャストできません。
ここでエラーが発生...
MyEvents.Dashboard_UserDetail messageTest =
(MyEvents.Dashboard_UserDetail)dashboardMessage;
どうしてこれなの?
[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
public void ProcessMSMQMessage(MsmqMessage<MyEvents.Dashboard_Message> msg)
{
switch (msg.Body.GetType().Name)
{
case "DashboardTest":
MyEvents.Dashboard_UserDetail messageTest =
(MyEvents.Dashboard_UserDetail)dashboardMessage;
using (UpdateDashboardQueriesDataContext updateDashboardQueriesDataContext = new UpdateDashboardQueriesDataContext())
{
updateDashboardQueriesDataContext.UpdateData(messageTest.ID, messageTest.StartDate);
}
break;
}
}
public class MyEvents
{
[Serializable]
[DataContract]
public class Dashboard_Message
{
public Dashboard_Message();
}
[Serializable]
[DataContract]
public class Dashboard_UserDetail : DashboardEvents.Dashboard_Message
{
public Dashboard_UserDetail();
public Dashboard_UserDetail(string thisID, DateTime thisPeriod);
public DateTime Period { get; set; }
public string ID{ get; set; }
}
}