Ah ok... 

 

So how do you add a  property which doesn’t get persisted? I’m using 
auto-mapping at the moment, is there some kind of convention I can use?

 

Thanks !!

 

From: [email protected] 
[mailto:[email protected]] On Behalf Of Mikael Henriksson
Sent: 04 August 2009 23:52
To: [email protected]
Subject: [fluent-nhib] Re: Helper Properties

 

Just add a virtual property to your entity. You don't have to persist every 
property of a class you know so what you have there should work fine too. Or if 
you wan't you could add a method for retrieving it in the entity class but that 
would feel less right to me.

2009/8/5 Paul Hinett <[email protected]>

Hi again!

 

Sorry about the bombardment of questions! I’m not sure if this is the best 
place to ask this question but i’ll throw it out there anyway.

 

In my legacy web application I used to include read only properties to help 
return a value, the property contained a small amount of logic. A good example 
would be a members profile image from my database.

 

Here is an example from simple a LINQ to SQL project I done recently:

 

Public ReadOnly Property ProfileImageUrl() As String

        Get

            Dim imgUrl As String

 

            If profileImageStatus = Enums.ProfileImageStatus.Active Then

                imgUrl = String.Format("/images/artists/{0}/profileMain{1}", 
accountId, profileImageExt)

            Else

                imgUrl = "/images/defaults/profileMain.gif"

            End If

            Return imgUrl

 

        End Get

    End Property

 

 

I want to display a list of members on my site with either an image they have 
uploaded or the default one if they haven’t uploaded one.  

 

Instead of performing this check in my view to display the correct image can I 
add a property to the Member.cs entity object? Or is there somewhere else i 
should be performing this operation?

 

Thank you very much for your time!!

 

Regards,

Paul Hinett

 

w: http://www.ukcreativedesigns.com | e: [email protected] | t: 07958 
552 157

 

 

 





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to