[seasar-dotnet:2137] [S2Dxo]DxoExceptionが発生する

寺嶋 千晴 [E-MAIL ADDRESS DELETED]
2012年 4月 2日 (月) 16:44:51 JST


お世話になっております。寺嶋です。

先日はDBFluteの対応をして頂きありがとうございました。
大変助かりました。今後ともよろしくお願い致します。
今回はS2Dxo.netについて教えていただきたいことがあり、投稿させて頂きました。

DBFluteで検索した結果をS2Dxo.netを利用してDTOにコピーするとDxoExceptionが
発生する現象が起きてしまっています。

発生条件としましては、コピー元にList型プロパティがあり(件数は0件)、コピー先に
同じ名前のプロパティが存在しないと発生します。
コピー元のList型プロパティがNullですと発生しないのですが、件数が0件であっても
同じ動きとしたいのですがどのように対処すればよろしいでしょうか?
皆様お忙しい中、お手数をお掛け致しますが何か情報があればご教授ください。

------- エラー内容 -------
[TargetParameterCountException: パラメーター カウントが一致しません。]
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +9348302
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28
   System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) +63
   System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) +19
   Seasar.Dxo.Interceptor.DxoInterceptor._TryExchangeSameNameProperty(PropertyInfo sourceInfo, Object source, Object dest, Type destType, Int32 cnt) +460

[DxoException: パラメーター カウントが一致しません。]
   Seasar.Dxo.Interceptor.DxoInterceptor._TryExchangeSameNameProperty(PropertyInfo sourceInfo, Object source, Object dest, Type destType, Int32 cnt) +952
   Seasar.Dxo.Interceptor.DxoInterceptor.AssignTo(Object source, Object dest, Int32 cnt) +185
   Seasar.Dxo.Interceptor.DxoInterceptor._TryExchangeSameNameProperty(PropertyInfo sourceInfo, Object source, Object dest, Type destType, Int32 cnt) +566

[DxoException: パラメーター カウントが一致しません。]
   Seasar.Dxo.Interceptor.DxoInterceptor._TryExchangeSameNameProperty(PropertyInfo sourceInfo, Object source, Object dest, Type destType, Int32 cnt) +952
   Seasar.Dxo.Interceptor.DxoInterceptor.AssignTo(Object source, Object dest, Int32 cnt) +185
   Seasar.Dxo.Interceptor.DxoInterceptor.Invoke(IMethodInvocation invocation) +1863
   Seasar.Framework.Aop.Impl.InterceptorAdapter.Intercept(IInvocation invocation) +222
   Castle.DynamicProxy.AbstractInvocation.Proceed() +462
   Castle.Proxies.ITestDxoProxy.ConvertToPageBean(ABean aBean) +152
   WebApplication1._Default.Page_Load(Object sender, EventArgs e) in C:\Users\cterash\Documents\Visual Studio 2010\Projects\WebApplication1\WebApplication1\Default.aspx.cs:28
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207



------- サンプルソース(呼び元) -------
    public partial class _Default : System.Web.UI.Page {
        protected ITestDxo iTestDxo;
        protected void Page_Load(object sender, EventArgs e) {
            QuillInjector.GetInstance().Inject(this);
            ABean aBean = new ABean();
            aBean.Hoge = "hoge";
            // ↓をコメントにするとExceptionは発生しない
            aBean.HogeList = new List<string>();

            BBean bBean = iTestDxo.ConvertToPageBean(aBean);
        }
    }

------- サンプルソース(ITestDxo) -------
    [Implementation]
    [Aspect(typeof(DxoInterceptor))]
    public interface ITestDxo {
        BBean ConvertToPageBean(ABean aBean);
    }

------- サンプルソース(ABean) -------
    public class ABean {
        private string hoge;
        public string Hoge {
            get { return hoge; }
            set { hoge = value; }
        }
        private List<string> hogeList;
        public List<string> HogeList {
            get { return hogeList; }
            set { hogeList = value; }
        }
    }

------- サンプルソース(BBean) -------
    public class BBean {
        private string hoge;
        public string Hoge {
            get { return hoge; }
            set { hoge = value; }
        }
    }


seasar-dotnet メーリングリストの案内