SV: [nhusers] Re: component with a non default .ctor

2009-09-27 Thread Roger Kratz

Wasn't that what you were looking for?
http://www.nhforge.org/doc/nh/en/index.html#components-dependentobjects

The component element allows a parent subelement that maps a property of 
the component class as a reference back to the containing entity. 


Från: nhusers@googlegroups.com [nhus...@googlegroups.com] f#246;r Jan Limpens 
[jan.limp...@gmail.com]
Skickat: den 27 september 2009 03:18
Till: nhusers@googlegroups.com
Ämne: [nhusers] Re: component with a non default .ctor

???


2009/9/26 Roger Kratz roger.kr...@teleopti.com:

 How could I pass
 a reference of it's owner to the component?

 parent

 
 Från: nhusers@googlegroups.com [nhus...@googlegroups.com] f#246;r Jan 
 Limpens [jan.limp...@gmail.com]
 Skickat: den 26 september 2009 00:45
 Till: nhusers@googlegroups.com
 Ämne: [nhusers] Re: component with a non default .ctor

 I am not sure how this could be mapped ... does nh behave like a di
 container in this situation? even though, how would nh know which
 instance is the right one? How could I pass
 a reference of it's owner to the component?

 2009/9/25 Fabio Maulo fabioma...@gmail.com:
 when you will upload from NH, NH will inject it through property or field
 (depending on your mapping)

 2009/9/25 Jan Limpens jan.limp...@gmail.com

 yes, but how does Discounts get the reference to IHaveDiscounts?

 2009/9/25 Fabio Maulo fabioma...@gmail.com

 protected DiscountOrder(){}

 2009/9/25 Jan Limpens jan.limp...@gmail.com

 I have

 class Order:IHaveDiscounts
public Order(){
   discounts = new DiscountContext(this);
}
DiscountContext Discounts
get { return discounts ;}

 and

 class DiscountOrder(IHaveDiscounts discounted)
 ...

 Order is a mapped entity and I want to use DiscountOrder as a
 component to strip Order from behaviour it should not really own, it's
 becoming WAY to big, anyway. But when I try this NH complains about
 it:
 No default constructor for entity: DiscountContext

 Is there an easy way around this? Currently I seem to hit my head on
 NH all the time when I try to keep my domain as I think it should be
 :(

 --
 Jan





 --
 Fabio Maulo





 --
 Jan





 --
 Fabio Maulo

 




 --
 Jan


 




--
Jan


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
nhusers group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~--~~~~--~~--~--~---



[nhusers] Re: DateTime2 SQL2008 millisecond bug?

2009-09-27 Thread Graham Bunce

Dario,

I've updated NH-1973 with the latest version of the test case.

I'll have a look in the NH code to see if I can work out how to fix
it, but I've only just downloaded the codebase and haven't even got it
to compile yet ;)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
nhusers group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~--~~~~--~~--~--~---



[nhusers] Re: DateTime2 SQL2008 millisecond bug?

2009-09-27 Thread Fabio Maulo
Graham,If you copypaste the explication you have sent to the dev-list in
the NH-1973 ticket would be fine.
Don't worry about the fix (it is easy for us).

2009/9/27 Graham Bunce grahambu...@hotmail.com


 Dario,

 I've updated NH-1973 with the latest version of the test case.

 I'll have a look in the NH code to see if I can work out how to fix
 it, but I've only just downloaded the codebase and haven't even got it
 to compile yet ;)
 



-- 
Fabio Maulo

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
nhusers group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~--~~~~--~~--~--~---



[nhusers] Re: component with a non default .ctor

2009-09-27 Thread Jan Limpens

Yes it was - it was just for the brevity of you first answer that I
was unable to put it into context.
Great! Thanks!

2009/9/27 Roger Kratz roger.kr...@teleopti.com:

 Wasn't that what you were looking for?
 http://www.nhforge.org/doc/nh/en/index.html#components-dependentobjects

 The component element allows a parent subelement that maps a property of 
 the component class as a reference back to the containing entity. 

 
 Från: nhusers@googlegroups.com [nhus...@googlegroups.com] f#246;r Jan 
 Limpens [jan.limp...@gmail.com]
 Skickat: den 27 september 2009 03:18
 Till: nhusers@googlegroups.com
 Ämne: [nhusers] Re: component with a non default .ctor

 ???


 2009/9/26 Roger Kratz roger.kr...@teleopti.com:

 How could I pass
 a reference of it's owner to the component?

 parent

 
 Från: nhusers@googlegroups.com [nhus...@googlegroups.com] f#246;r Jan 
 Limpens [jan.limp...@gmail.com]
 Skickat: den 26 september 2009 00:45
 Till: nhusers@googlegroups.com
 Ämne: [nhusers] Re: component with a non default .ctor

 I am not sure how this could be mapped ... does nh behave like a di
 container in this situation? even though, how would nh know which
 instance is the right one? How could I pass
 a reference of it's owner to the component?

 2009/9/25 Fabio Maulo fabioma...@gmail.com:
 when you will upload from NH, NH will inject it through property or field
 (depending on your mapping)

 2009/9/25 Jan Limpens jan.limp...@gmail.com

 yes, but how does Discounts get the reference to IHaveDiscounts?

 2009/9/25 Fabio Maulo fabioma...@gmail.com

 protected DiscountOrder(){}

 2009/9/25 Jan Limpens jan.limp...@gmail.com

 I have

 class Order:IHaveDiscounts
    public Order(){
       discounts = new DiscountContext(this);
    }
    DiscountContext Discounts
    get { return discounts ;}

 and

 class DiscountOrder(IHaveDiscounts discounted)
     ...

 Order is a mapped entity and I want to use DiscountOrder as a
 component to strip Order from behaviour it should not really own, it's
 becoming WAY to big, anyway. But when I try this NH complains about
 it:
 No default constructor for entity: DiscountContext

 Is there an easy way around this? Currently I seem to hit my head on
 NH all the time when I try to keep my domain as I think it should be
 :(

 --
 Jan





 --
 Fabio Maulo





 --
 Jan





 --
 Fabio Maulo

 




 --
 Jan


 




 --
 Jan


 




-- 
Jan

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
nhusers group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~--~~~~--~~--~--~---



[nhusers] Duplicate Class/Entity Mapping Error

2009-09-27 Thread Roger

I have this domain hierarchy:

User - EntityWithAuditDate - Entity

Here is the domain: (simplified)

public class User : EntityWithAuditDate
{
public User(){}

public virtual string Name { get; set; }

}

public abstract class EntityWithAuditDate : Entity
{
public EntityWithAuditDate() { }

public virtual DateTime? CreatedAt { get; set; }
}

And the mapping(simplified):

class name=User table=Users abstract=false
id name=Id type=Int32 column=UserId
generator class=identity /
/id
property name=Name type=String/
property name =CreatedAt/
/class

When I ran a mapping integration unit test (http://ayende.com/Blog/
archive/2006/08/09/NHibernateMappingCreatingSanityChecks.aspx), I got
this error:

--
Tests.AltNetTime.Data.NHibernateMaps.MappingIntegrationTests.CanConfirmDatabaseMatchesMappings:
FluentNHibernate.Cfg.FluentConfigurationException : An invalid or
incomplete configuration was used while creating a SessionFactory.
Check PotentialReasons collection, and InnerException for more detail.

  * Database was not configured through Database method.

   FluentNHibernate.Cfg.FluentConfigurationException : An invalid
or incomplete configuration was used while creating a SessionFactory.
Check PotentialReasons collection, and InnerException for more detail.

  * Database was not configured through Database method.

   NHibernate.MappingException : Could not compile the mapping
document: (XmlDocument)
   NHibernate.DuplicateMappingException : Duplicate class/entity
mapping AltNetTime.Core.User
TearDown : System.Reflection.TargetInvocationException : Exception has
been thrown by the target of an invocation.
   System.Collections.Generic.KeyNotFoundException : The given
key was not present in the dictionary.


The unit test passed if the User class inherits from Entity instead.
Also, I had to remove the CreatedAt property from the mapping file.
Apparently, there was something wrong with the EntityWithAuditDate
class. I am not sure what caused the duplicate class/entity mapping.
Any ideas?

Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
nhusers group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~--~~~~--~~--~--~---



[nhusers] Re: DateTime2 SQL2008 millisecond bug?

2009-09-27 Thread Dario Quintana
Thanks !
I will have a look soon.

Cheers ;)

On Sun, Sep 27, 2009 at 7:24 AM, Graham Bunce grahambu...@hotmail.comwrote:


 Dario,

 I've updated NH-1973 with the latest version of the test case.

 I'll have a look in the NH code to see if I can work out how to fix
 it, but I've only just downloaded the codebase and haven't even got it
 to compile yet ;)
 



-- 
Dario Quintana
http://darioquintana.com.ar

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
nhusers group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~--~~~~--~~--~--~---



[nhusers] Re: Proxy Validator changes in 2.1

2009-09-27 Thread Fabio Maulo
internal virtual can't be intercepted.If you want you can simply turn off de
proxy validator and manage any kind of surprise by yourself.
property name=use_proxy_validatorfalse/property

2009/9/27 Brendan Kowitz brendan.kow...@gmail.com


 Hi,

 Can someone please help me understand the following:

 In the previous version of NH (2.0.1) the following property will
 validate and is compatible with the Castle Proxies:

 internal virtual BusinessObject Parent
 {
  get { /*code*/ }
 }

 However, in 2.1 it errors saying that the types should be virtual
 'public/protected' or 'protected internal'.
 I have issues with this because marking a property with 'protected
 internal' exposes the property to inherited types in OTHER assemblies
 (effectively protected OR internal). Given that this was never a
 requirement before, it feels like a bit of a bad requirement to impose
 now.

 Can someone please explain why this requirement is now there and what
 it is trying to enforce so I can at least understand what it is
 intending to achieve.

 If this restriction is not entirely needed, and I am 100% certain
 these types of properties will NEVER map to DB properties I am
 intending to create my own Mashup ByteCode provider using the Castle
 proxy factory and the Type Validator from 2.0.1.

 Thanks,
 Brendan
 



-- 
Fabio Maulo

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
nhusers group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~--~~~~--~~--~--~---