포럼: Open Discussion (Thread #19751)

TERASOLUNA ServerFW.NETのBLogicとのパラメータ受け渡しについて (2008-08-29 12:15 by Anonymous #38571)

機能説明書CM-04ビジネスロジックの生成の章には
BLogicParamのプロパティ、BLogicResultのプロパティとして
Itemsが記述されていますが、これを使ってパラメータを受け渡するコードを記述すると
エラー CS0200: プロパティまたはインデクサ 'TERASOLUNA.Fw.Common.BLogic.BLogicParam.Items' は読み取り専用なので、割り当てることはできません。
エラー CS0200: プロパティまたはインデクサ 'TERASOLUNA.Fw.Common.BLogic.BLogicResult.Items' は読み取り専用なので、割り当てることはできません。
というコンパイルエラーになりますが、これは正しい仕様なのでしょうか?
DataSetを使えばパラメータの受け渡しできるのは分っているのですが、いちいちデータセットを作成するのが面倒な場合もあり、IDictionaryを使った受け渡しができる機能があれば便利と思うのですが。
フレームワークが内部的に使用している?だけであれば機能説明書の記載はなくてもいいように思うのですが。。。(あれば使いたくなると思います)

Reply to #38571×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: TERASOLUNA ServerFW.NETのBLogicとのパラメータ受け渡しについて (2008-09-01 11:08 by tatsumihr #38611)

仕様通りの動作となります。
以下の例を参考に再度ご確認ください。

◆実装例
----------------------------------
// 正しい実装方法
BLogicParam param = new BLogicParam();
param.Items["key"] = "value";

// ビルドエラーになる実装方法
BLogicParam param2 = new BLogicParam();
IDictionary<string, object> items = new Dictionary<string, object>();
items["key"] = "value";
param2.Items = items;
----------------------------------

TERASOLUNAの設計方針として、基本的にIDictionary自体のインスタンスをnullにはしないという方針になっています。(一部例外もありますが)
Items自体にsetプロパティを付けてしまうと、外部からnullが設定されてしまう可能性があり、
そうするとEventController内部などでnullチェックが必要になってしまうため、getプロパティのみを公開しています。
Reply to #38571

Reply to #38611×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: TERASOLUNA ServerFW.NETのBLogicとのパラメータ受け渡しについて (2008-09-02 16:42 by Anonymous #38651)

投稿者です。
ご回答ありがとうございます。
ご指摘のとうりでうまく動かせることができました。
Reply to #38571

Reply to #38651×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login