Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread Oskar Berggren
2016-08-11 14:05 GMT+01:00 mwpowellhtx : > > > On Thursday, August 11, 2016 at 8:47:18 AM UTC-4, Oskar Berggren wrote: >> >> >> >> 2016-08-11 13:33 GMT+01:00 mwpowellhtx : >> >>> >>> >>> On Thursday, August 11, 2016 at 8:22:07 AM UTC-4, Oskar Berggren

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread mwpowellhtx
On Thursday, August 11, 2016 at 8:47:18 AM UTC-4, Oskar Berggren wrote: > > > > 2016-08-11 13:33 GMT+01:00 mwpowellhtx : > >> >> >> On Thursday, August 11, 2016 at 8:22:07 AM UTC-4, Oskar Berggren wrote: >>> >>> >>> >>> 2016-08-11 12:33 GMT+01:00 mwpowellhtx

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread Oskar Berggren
2016-08-11 13:33 GMT+01:00 mwpowellhtx : > > > On Thursday, August 11, 2016 at 8:22:07 AM UTC-4, Oskar Berggren wrote: >> >> >> >> 2016-08-11 12:33 GMT+01:00 mwpowellhtx : >> >>> >>> >>> On Thursday, August 11, 2016 at 7:23:35 AM UTC-4, Rasmoo wrote:

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread mwpowellhtx
On Thursday, August 11, 2016 at 8:35:32 AM UTC-4, Oskar Berggren wrote: > > > > 2016-08-11 13:25 GMT+01:00 mwpowellhtx : > >> >> >> On Thursday, August 11, 2016 at 8:05:04 AM UTC-4, Oskar Berggren wrote: >>> >>> >>> >>> 2016-08-11 12:59 GMT+01:00 Oskar Berggren

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread Oskar Berggren
2016-08-11 13:25 GMT+01:00 mwpowellhtx : > > > On Thursday, August 11, 2016 at 8:05:04 AM UTC-4, Oskar Berggren wrote: >> >> >> >> 2016-08-11 12:59 GMT+01:00 Oskar Berggren : >> >> >>> >>> 2016-08-11 11:47 GMT+01:00 mwpowellhtx :

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread mwpowellhtx
On Thursday, August 11, 2016 at 8:22:07 AM UTC-4, Oskar Berggren wrote: > > > > 2016-08-11 12:33 GMT+01:00 mwpowellhtx : > >> >> >> On Thursday, August 11, 2016 at 7:23:35 AM UTC-4, Rasmoo wrote: >>> >>> That's exactly Oskar's trick: You call the proxy, into the proxied >>>

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread mwpowellhtx
On Thursday, August 11, 2016 at 8:05:04 AM UTC-4, Oskar Berggren wrote: > > > > 2016-08-11 12:59 GMT+01:00 Oskar Berggren >: > >> >> >> 2016-08-11 11:47 GMT+01:00 mwpowellhtx >> : >> >>> >>> >>> On Wednesday, August 10, 2016 at 1:20:15 PM UTC-4,

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread Oskar Berggren
2016-08-11 12:33 GMT+01:00 mwpowellhtx : > > > On Thursday, August 11, 2016 at 7:23:35 AM UTC-4, Rasmoo wrote: >> >> That's exactly Oskar's trick: You call the proxy, into the proxied object >> and get it to cast itself. >> > > No, that's not what Oskar wrote, one the one

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread mwpowellhtx
On Thursday, August 11, 2016 at 8:08:10 AM UTC-4, Oskar Berggren wrote: > > > > 2016-08-11 13:04 GMT+01:00 mwpowellhtx : > >> >> >> On Thursday, August 11, 2016 at 7:59:46 AM UTC-4, Oskar Berggren wrote: >>> >>> >>> >>> 2016-08-11 11:47 GMT+01:00 mwpowellhtx

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread Oskar Berggren
2016-08-11 13:04 GMT+01:00 mwpowellhtx : > > > On Thursday, August 11, 2016 at 7:59:46 AM UTC-4, Oskar Berggren wrote: >> >> >> >> 2016-08-11 11:47 GMT+01:00 mwpowellhtx : >> >>> >>> >>> On Wednesday, August 10, 2016 at 1:20:15 PM UTC-4, Oskar Berggren

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread Oskar Berggren
2016-08-11 12:59 GMT+01:00 Oskar Berggren : > > > 2016-08-11 11:47 GMT+01:00 mwpowellhtx : > >> >> >> On Wednesday, August 10, 2016 at 1:20:15 PM UTC-4, Oskar Berggren wrote: >>> >>> You can put something like this in relevant base class: >>> >>>

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread mwpowellhtx
On Thursday, August 11, 2016 at 7:59:46 AM UTC-4, Oskar Berggren wrote: > > > > 2016-08-11 11:47 GMT+01:00 mwpowellhtx : > >> >> >> On Wednesday, August 10, 2016 at 1:20:15 PM UTC-4, Oskar Berggren wrote: >>> >>> You can put something like this in relevant base class: >>>

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread mwpowellhtx
On Thursday, August 11, 2016 at 7:43:27 AM UTC-4, Rasmoo wrote: > > You can't cast the proxy. You can cast the proxied object. Therein lies > the difference. > You haven't told me anything I don't already know, and/or learned about the nature of NHibernate and the proxied domain objects. I

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread Rasmus Hansen
You can't cast the proxy. You can cast the proxied object. Therein lies the difference. I try to avoid casting anyways. I'd rather use a visitor pattern as it maintains completeness. On Thu, Aug 11, 2016 at 1:33 PM, mwpowellhtx wrote: > > > On Thursday, August 11, 2016

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread mwpowellhtx
On Thursday, August 11, 2016 at 7:23:35 AM UTC-4, Rasmoo wrote: > > That's exactly Oskar's trick: You call the proxy, into the proxied object > and get it to cast itself. > No, that's not what Oskar wrote, one the one hand; see below: public TCastTarget As() { return (TCastTarget)this; }

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread Rasmus Hansen
That's exactly Oskar's trick: You call the proxy, into the proxied object and get it to cast itself. cup.Juice.As() Try it. :-) Alternative, you can return the inner, unproxied object, by adding a method like this to the base class: public virtual object UnproxiedObject { get { return this; }

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-11 Thread mwpowellhtx
On Wednesday, August 10, 2016 at 1:20:15 PM UTC-4, Oskar Berggren wrote: > > You can put something like this in relevant base class: > > public TCastTarget As() > { > return (TCastTarget)this; > } > Do you understand what's going on with Proxying? You don't see it in your code, but what

Re: [fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-10 Thread Oskar Berggren
You can put something like this in relevant base class: public TCastTarget As() { return (TCastTarget)this; } Then you don't have to turn off proxying. /Oskar 2016-08-10 18:02 GMT+01:00 Michael Powell : > On Wed, Aug 10, 2016 at 11:55 AM, Michael Powell

[fluent-nhib] Re: [Proxy] Class hierarchy casting issue

2016-08-10 Thread Michael Powell
On Wed, Aug 10, 2016 at 11:55 AM, Michael Powell wrote: > Hello, > > I have a use case where I'd like to cast an abstract base class to a > child class in order to verify one of the child class properties. In my joining table mapping, in this case the reference from Cup to