Hi All,
I've recently upgraded an old ActiveRecord/Monorail application to
ActiveRecord 2.0 (RTM) & Monorail trunk.
Everything went pretty smoothly - but I'm now getting some data
binding issues when using [ARDataBind] - as part of the upgrade I now
have to specify what proxy factory NHibernate should use, and it seems
like the proxy is causing some unwanted side effects when it comes to
binding? Interestingly - swapping between Linfu and Dynamic proxy
also changes the nature of the error, as below...
If I use LinFu dynamic proxy w/Nhibernate, I get an exception thrown
on invoking an action with an [ARDataBind] parameter:
Castle.MonoRail.Framework.MonoRailException: Error processing MonoRail
request. Action Save on controller Product --->
Castle.MonoRail.Framework.MonoRailException: Error building method
arguments. Last param analyzed was product with value '' --->
Castle.Components.Binder.BindingException: Unexpected item on the
stack: found Seller, expecting Product
at Castle.Components.Binder.DataBinder.PopInstance(Object instance,
String prefix)
at Castle.MonoRail.ActiveRecordSupport.ARDataBinder.PopInstance
(Object instance, String prefix)
at
Castle.Components.Binder.DataBinder.InternalRecursiveBindObjectInstance
(Object instance, String prefix, CompositeNode node)
at
Castle.Components.Binder.DataBinder.InternalRecursiveBindObjectInstance
(Object instance, String prefix, Node node)
at Castle.Components.Binder.DataBinder.InternalBindObject(Type
instanceType, String paramPrefix, Node node, Boolean& succeeded)
at Castle.Components.Binder.DataBinder.InternalBindObject(Type
instanceType, String paramPrefix, Node node)
at Castle.Components.Binder.DataBinder.BindObject(Type targetType,
String prefix, String excludedProperties, String allowedProperties,
CompositeNode treeRoot)
at Castle.MonoRail.ActiveRecordSupport.ARDataBinder.BindObject(Type
targetType, String prefix, String exclude, String allow, String
expect, CompositeNode treeRoot)
at Castle.MonoRail.ActiveRecordSupport.ARDataBindAttribute.Bind
(IEngineContext context, IController controller, IControllerContext
controllerContext, ParameterInfo parameterInfo)
at
Castle.MonoRail.Framework.SmartDispatcherController.BuildMethodArguments
(ParameterInfo[] parameters, IRequest request, IDictionary`2
actionArgs)
--- End of inner exception stack trace ---
at
Castle.MonoRail.Framework.SmartDispatcherController.BuildMethodArguments
(ParameterInfo[] parameters, IRequest request, IDictionary`2
actionArgs)
at Castle.MonoRail.Framework.ExtJSController.InvokeMethod
(MethodInfo method, IRequest request, IDictionary`2 actionArgs) in C:
\dev\Projects\Catch\EnterpriseTester\app\src\MonoRail.ModuleFramework
\ExtJS\ExtJSController.cs:line 181
at Castle.MonoRail.Framework.ActionMethodExecutorCompatible.Execute
(IEngineContext engineContext, IController controller,
IControllerContext context)
at Castle.MonoRail.Framework.Controller.RunActionAndRenderView()
at Castle.MonoRail.Framework.Controller.Process(IEngineContext
engineContext, IControllerContext context)
at Castle.MonoRail.Framework.BaseHttpHandler.Process(HttpContext
context)
--- End of inner exception stack trace ---
at Castle.MonoRail.Framework.BaseHttpHandler.Process(HttpContext
context)
at Castle.MonoRail.Framework.BaseHttpHandler.ProcessRequest
(HttpContext context)
at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute
()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)
Closest thing I could find related to this issue was:
http://markmail.org/message/zcqsbvywmjx267gg#query:Unexpected%20item%20on%20the%20stack%20castle%20project+page:1+mid:2vktx5aqxoc3j3hm+state:results
But that was related to a class where GetHashCode/Equals was
overridden, where as my ActiveRecord models don't implement either of
those methods...
Now, If instead I use Castle Dynamic Proxy w/ Nhibernate the Action
does not throw an exception, but I get a data binding error:
"NHibernate.Proxy.INHibernateProxy.HibernateLazyInitializer" => "node
is not Composite but still need to recurse to
Proxy.INHibernateProxy.HibernateLazyInitializer"
Closest thing I Could find related to this issue was:
http://markmail.org/message/6yr64gvtn65cek5x
But this was fixed in Trunk ages ago...
Any thoughts/suggestions on what my problem might be? We have other
projects running off Monorail/ActiveRecord trunk without issues.