http://jira.nhforge.org
2009/3/12 TigerShark <[email protected]> > > Ahh, thanks dude... Thought I was completly off-course here... Had me > going for a while ;) > > I'll create a jira as soon I'm able to connect to the site... I'm > awfully often getting timeouts here (Denmark)... > > On 12 Mar., 16:34, Fabio Maulo <[email protected]> wrote: > > Aaaaah now I understand... your preoccupation is not eliminate the > > parameter-less CTor, but only to have it as no-public. > > Sorry. > > Create a JIRA.Thanks. > > > > 2009/3/12 TigerShark <[email protected]> > > > > > > > > > > > > > But I just don't understand why..? I have just created my own result > > > transformer, simply copying the entire existing AliasToBean > > > transformer and adding 'true' to the Activator.CreateInstance method > > > call. That was it. > > > > > I understand that it "could" impose some other problems in the NH > > > core, I just can't think of any. > > > > > Would this be a huge problem to add this simple modification to NH? > > > It's the exact same code... > > > > > On 12 Mar., 15:53, Fabio Maulo <[email protected]> wrote: > > > > Well... What I said in the first response is that nobody said that > you > > > must > > > > use the build-in AliasToBeanResultTransformer. > > > > You can create your own implementation and there you can use your > Ctor > > > with > > > > parameters. > > > > The default AliasToBeanResultTransformer need a default > parameter-less > > > Ctor. > > > > > > NH3.0, may be, we can provide another build-in ResultTransformer for > > > > anonymous classes. > > > > > > The other solution, for your problem is: > > > > select new YourDTO(p.Name, p.Surname) from Person p > > > > > > 2009/3/12 TigerShark <[email protected]> > > > > > > > I did read it, but that's not my point. I'm doing a projection of > an > > > > > existing entity to a light-weight DTO. The AliasToBean transformer > > > > > requires me to provide a default _public_ parameterless constructor > to > > > > > work with it, the reason for that being it's using > > > > > Activator.CreateInstance(type) instead of Activator.CreateInstance > > > > > (type, true). > > > > > > > I'm perfectly aware that I can implement my own transformer or > > > > > tupelizer, however the problem is the behavior of AliasToBean. > > > > > > > AFAIK AliasToBean is using setters on the instance, ideally making > the > > > > > constructor irrelevant (besides the one for the activator). > > > > > > > My point is simply this: Make AliasToBean accept non-public > > > > > constructors. > > > > > > > If I'm completely of-course, please let me know. BTW: I'm on the > > > > > current NH trunk. > > > > > > > On 12 Mar., 15:22, Fabio Maulo <[email protected]> wrote: > > > > > > 2009/3/12 TigerShark <[email protected]> > > > > > > > > > Yeah I know, but still, it's kind of strange that the default > > > > > > > AliasToBean transformer doesn't support other that strict > public > > > > > > > constructors. > > > > > > > Actually I thought that one of the primary goals for NH was to > > > provide > > > > > > > transparent persistence with close to no restrictions on the > domain > > > > > > > model. Now I _have_ to provide a parameterless public > constructor, > > > > > > > even though it's never user by anything by NH... > > > > > > > > Please read the blog post.. > > > > > > "If you are working with NH you know that NH likes POCOs and you > must > > > > > have a > > > > > > default constructor without parameters. Starting from today that > is > > > the > > > > > > past."... > > > > > > > > -- > > > > > > Fabio Maulo > > > > > > -- > > > > Fabio Maulo > > > > -- > > Fabio Maulo > > > -- 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=en -~----------~----~----~----~------~----~------~--~---
