[fluent-nhib] Re: Automapping Read Only Properties

2011-05-01 Thread James Gregory
Automapping is really going to struggle to make sense of your DisplayTitle 
property. As it's a getter only, it'll try to find a backing field that 
matches; off the top of my head, I don't know what it'll do if it doesn't 
find one.

The Access.ReadOnlyProperty() method looks suspiciously broken. I'm under 
the impression you need to supply a "naming strategy" to go with nosetter, 
which that method definitely does not do. Try one of the 
ReadOnlyPropertyThroughXXX() methods instead. I think this is a badly 
implemented method.

Really though, I don't think this property should be mapped at all. It 
doesn't seem relevant to NHibernate. I'd use an override or change your 
automappingConfiguration to skip this member.

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



Re: [fluent-nhib] Re: Automapping Read Only Properties

2011-04-30 Thread Paul Batum
The API might have changed a little but this blog post covers the approach
that most people use:

http://blog.overridethis.com/blog/post/2010/06/04/FluentNHibernate11-RTW-and-ReadOnly-Properties.aspx

On Fri, Apr 29, 2011 at 11:12 PM, Mohamed Meligy wrote:

> No, I didn't. Jose told me I should be able to do this and he is doing it
> in his confORM example.
>
> Note that this different from the other "private setter" problem arising in
> .NET 3.2.
>
> Anyway, after a chat with Jose we agreed this is fine to use in Override
> and this is how I completed the sample and put on
>
> http://gurustop.net/blog/2011/04/17/nh-nhibernate-mapping-jose-romaniello-ef-conform-domain-using-fnh-fluentnhibernate/
>
>
> Thanks a lot,
>
> Regards,
>
> *Mohamed Meligy
> *Readify | Senior Developer
>
> M:+61 451 835006 | W: readify.net
> [image: Description: Description: Description: Description: 
> rss_16]
> [image: Description: Description: Description: Description:
> cid:image003.png@01CAF81D.6A076510]   
> [image:
> Description: Description: Description: Description:
> cid:image005.png@01CAF81D.6A076510] 
>  
> 
>
>
>
> On Sat, Apr 30, 2011 at 3:46 AM, tclay  wrote:
>
>> Have you tried using a protected empty setter?
>>
>> public virtual string DisplayTitle
>> {
>>get
>>{
>>return Name;
>>}
>> protected set
>>{
>>;
>> }
>> }
>>
>>
>> On Apr 8, 12:46 am, Mohamed Meligy  wrote:
>> > I am trying to map read only properties (property with getter and no
>> setter)
>> > via automapping.
>> >
>> > Normally I'd expectthe default behavior of FluentNHibernate to map this
>> > directly as Access -> Read Only (since they don't even have private
>> fields)
>> > But it doesn't, and it's OK, because it's hard to tel whether I'm using
>> a
>> > backing field or not, and also to assume that I don't.
>> >
>> > Let's say I add
>> >  public virtual string DisplayTitle
>> >  {
>> >  get
>> >  {
>> >  return Name;
>> >  }
>> >  }
>> > To the Product class in FluentNHibernate source Automapping project.
>> >
>> > Problem *1*:: When running, I get an incomplete invalid or incomplete
>> > configuration as per: Could not find a setter for 'DisplayTitle'
>> > ...
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Fluent NHibernate" group.
>> To post to this group, send email to fluent-nhibernate@googlegroups.com.
>> To unsubscribe from this group, send email to
>> fluent-nhibernate+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/fluent-nhibernate?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to fluent-nhibernate@googlegroups.com.
> To unsubscribe from this group, send email to
> fluent-nhibernate+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>

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



Re: [fluent-nhib] Re: Automapping Read Only Properties

2011-04-29 Thread Mohamed Meligy
No, I didn't. Jose told me I should be able to do this and he is doing it in
his confORM example.

Note that this different from the other "private setter" problem arising in
.NET 3.2.

Anyway, after a chat with Jose we agreed this is fine to use in Override and
this is how I completed the sample and put on
http://gurustop.net/blog/2011/04/17/nh-nhibernate-mapping-jose-romaniello-ef-conform-domain-using-fnh-fluentnhibernate/


Thanks a lot,

Regards,

*Mohamed Meligy
*Readify | Senior Developer

M:+61 451 835006 | W: readify.net
[image: Description: Description: Description: Description:
rss_16]
[image: Description: Description: Description: Description:
cid:image003.png@01CAF81D.6A076510]
  [image:
Description: Description: Description: Description:
cid:image005.png@01CAF81D.6A076510] 
 




On Sat, Apr 30, 2011 at 3:46 AM, tclay  wrote:

> Have you tried using a protected empty setter?
>
> public virtual string DisplayTitle
> {
>get
>{
>return Name;
>}
> protected set
>{
>;
> }
> }
>
>
> On Apr 8, 12:46 am, Mohamed Meligy  wrote:
> > I am trying to map read only properties (property with getter and no
> setter)
> > via automapping.
> >
> > Normally I'd expectthe default behavior of FluentNHibernate to map this
> > directly as Access -> Read Only (since they don't even have private
> fields)
> > But it doesn't, and it's OK, because it's hard to tel whether I'm using a
> > backing field or not, and also to assume that I don't.
> >
> > Let's say I add
> >  public virtual string DisplayTitle
> >  {
> >  get
> >  {
> >  return Name;
> >  }
> >  }
> > To the Product class in FluentNHibernate source Automapping project.
> >
> > Problem *1*:: When running, I get an incomplete invalid or incomplete
> > configuration as per: Could not find a setter for 'DisplayTitle'
> > ...
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to fluent-nhibernate@googlegroups.com.
> To unsubscribe from this group, send email to
> fluent-nhibernate+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>
>

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



[fluent-nhib] Re: Automapping Read Only Properties

2011-04-29 Thread tclay
Have you tried using a protected empty setter?

public virtual string DisplayTitle
{
get
{
return Name;
}
protected set
{
;
}
}


On Apr 8, 12:46 am, Mohamed Meligy  wrote:
> I am trying to map read only properties (property with getter and no setter)
> via automapping.
>
> Normally I'd expectthe default behavior of FluentNHibernate to map this
> directly as Access -> Read Only (since they don't even have private fields)
> But it doesn't, and it's OK, because it's hard to tel whether I'm using a
> backing field or not, and also to assume that I don't.
>
> Let's say I add
>  public virtual string DisplayTitle
>  {
>      get
>      {
>          return Name;
>      }
>  }
> To the Product class in FluentNHibernate source Automapping project.
>
> Problem *1*:: When running, I get an incomplete invalid or incomplete
> configuration as per: Could not find a setter for 'DisplayTitle'
> ...
>

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