Probably the bytecode implemented inside the Framework Spring.NET has a different ProxyValidator. In NH, by default, all bytecode implementations are sharing the same DefaultProxyValidator using the NH default behaviour where the parameterless ctor is required.
If you don't want the default behaviour you can inject your own. If you don't want work with an IoC you don't need to touch the bytecode provider for Proxy stuff and you can use a custom Tuplizer. Now... if you have an Entity with a NO default parameterless ctor and you don't want use an IoC nor a Tuplizer you should explain me how NH should understand how use your ctor with parameter and how we can create a Proxy of your class. Can you send an example ? 2009/11/23 Nik Govorov <[email protected]> > Fabio, this is clear, but creating own factory is overhead(if I dont > want use any IOC). > In my ByteCodeProvider(exactly in > ReflectionOptimizer.CreateCreateInstanceMethod) I want to use: > return () => FormatterServices.GetUninitializedObject(type); > instead of : > ThrowExceptionForNoDefaultCtor(type); > and that works fine with linfu and spring proxies(but their factories > should have validator without checking default ctor). > Or I have something wrong? > Thank for reply. > > On 23 ноя, 15:36, Fabio Maulo <[email protected]> wrote: > > If you don't like the ProxyValidator you can: > > 1) disable it <property name="use_proxy_validator">false</property> > > 2) override the bytecode provider > > <property > > > name="proxyfactory.factory_class">YourOwn.ByteCode.XYZ.ProxyFactoryFactory, > > YourOwn.ByteCode.XYZ</property> > > and provide your own validation. > > > > In order to use entities without default parameterless ctor: > http://fabiomaulo.blogspot.com/2008/11/entities-behavior-injection.html > > > > Part of that code now is available directly in Spring.NET+NH integration. > > > > 2009/11/22 Nik Govorov <[email protected]> > > > > > > > > > > > > > Hi. > > > I think that ProxyFactoryFactory(from NHibernate.ByteCode.LinFu and > > > NHibernate.ByteCode.Spring) should returns thier own implementations > > > of IProxyValidator without checking default constructor: > > > > > using CommonDynProxyTypeValidator = > > > NHibernate.Proxy.DynProxyTypeValidator; > > > > > namespace NHibernate.ByteCode.Castle > > > { > > > public class DynProxyTypeValidator : CommonDynProxyTypeValidator > > > { > > > protected override void CheckHasVisibleDefaultConstructor > > > (System.Type type) > > > { > > > > > } > > > } > > > } > > > Now, for using entities without default ctor(apart from implementing > > > BytecodeProvider), I have to disable proxy validation > > > (use_proxy_validator), but there are some other important checks in > > > DynProxyTypeValidator(also it's possible to create own > > > ProxyFactoryFactory basen on LinFu or Spring factory, but I dont like > > > this way). > > > Thanks. > > > > > -- > > > > > You received this message because you are subscribed to the Google > Groups > > > "nhusers" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]>> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/nhusers?hl=. > > > > -- > > Fabio Maulo > > -- > > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=. > > > -- Fabio Maulo -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=.
