私は最近、TIBCO 開発を行っていますが、TIBCO メッセージとの間で変換するための最良の方法は何だろうか?
これは私が現在行っていることですが、これを行うためのより良い方法があるはずです。しかし、私の脳は現時点では揚げられており、Bing/Google や SO で検索しても何も返されません。
public static Envelope ParseEnvelope(Message msg)
{
try
{
var field = msg.GetField("Envelope");
if(field == null) throw new ArgumentException("msg does not contain Envelope field", "msg");
var envMsg = field.Value as Message;
if(envMsg == null) throw new ArgumentException("msg.Envelope field is null or not a Message", "msg");
var envTypeField = envMsg.GetField("EnvelopeEventId");
if (envTypeField == null) throw new ArgumentException("msg.Envelope does contain EnvelopeEventId field");
var envType = envTypeField.Value as String;
if (envType == null) throw new ArgumentException("msg.Envelope.EnvelopeEventId field is null or not a String", "msg");
var env = new Envelope(envType);
}
任意のヘルプ、またはポインタをいただければ幸いです!
現在、TIBCO メッセージのルートにある特定の「フィールド」を調べて変換先のクラスを取得し、リフレクションを使用する To/From メッセージを変換するための独自のタイプの AutoMapper を作成することを考えています (初めて、キャッシュにない場合) そのクラスのプロパティのツリーに対して再帰的に (いずれかのプロパティが値型でない場合)