You are probably better off just putting a comment on the property name or a
note in the class then going to all that work to change a name. Work with
the tools not against them.

- Robert

On Sat, Mar 27, 2010 at 5:14 PM, Mohamed Meligy <[email protected]>wrote:

> Because there is nothing special about the use of the property, you can
> use the property just like any other local (default) DateTime object you'd
> instantiate, so, it's nothing special.
> This is different in the case of the field because it's not a local
> DateTime object, but a UTC DateTime, which needs to be expressed.
>
> I thought it'd be some XML attribute in the mapping where I define the
> identifier of the field. Thanks for telling about property accessor.
>
> Regards,
> --
> Mohamed Meligy
> Senior Developer, Team Lead Backup (.Net Technologies - TDG - Applications)
> Injazat Data Systems
> P.O. Box: 8230 Abu Dhabi, UAE.
>
> Phone:  +971 2 6992700
> Direct:   +971 2 4045385
> Mobile:  +971 50 2623624, +971 55 2017 621
>
> E-mail: [email protected]
> Weblog: http://gurustop.net
>
>
> On Sat, Mar 27, 2010 at 11:16 PM, Fabio Maulo <[email protected]>wrote:
>
>> yes it is.
>> You should implements your custom IPropertyAccessor and use it in the
>> mapping.
>> After do that try to ask yourself why the private field should "express
>> the use" and the public property shouldn't.
>>
>>
>> 2010/3/27 Mohamed Meligy <[email protected]>
>>
>>>  I want to have a property like:
>>>
>>> private DateTime *_tweetUtcDate*;
>>>> public DateTime *TweetDate*
>>>> {
>>>>     get
>>>>     {
>>>>         return _tweetUtcDate.ToLocalTime();
>>>>     }
>>>>     set
>>>>     {
>>>>         _tweetUtcDate = value.ToUniversalTime();
>>>>     }
>>>> }
>>>>
>>>
>>> I do this in order to do the UTC change as you see in the getter/setter.
>>> That's why I want to keep the field name like this.
>>>
>>> I can easily map only the field like:
>>>
>>> <property access="field" name="_tweetUtcDate" type="System.DateTime">
>>>>   <column name="TweetUtcDate" sql-type="smalldatetime" not-null="true"
>>>> />
>>>> </property>
>>>>
>>>
>>> But I still want to use the property "TweetDate" in queries, you know,
>>> like when I call LINQ queries, I want to be able to include the property
>>> name in select/where/orderby, etc..
>>>
>>> Again, I could use something like "field.camelcase-underscore", but,
>>> again, I want to keep the naming to express the use.
>>>
>>> So, is that doable? Can I use a backing field with a specific field name,
>>> not following specific naming convention?
>>>
>>> * * Or is there a better way to achieve this easily ?
>>>
>>> Regards,
>>> --
>>> Mohamed Meligy
>>> Senior Developer, Team Lead Backup (.Net Technologies - TDG -
>>> Applications)
>>> Injazat Data Systems
>>> P.O. Box: 8230 Abu Dhabi, UAE.
>>>
>>> Phone:  +971 2 6992700
>>> Direct:   +971 2 4045385
>>> Mobile:  +971 50 2623624, +971 55 2017 621
>>>
>>> E-mail: [email protected]
>>> Weblog: http://gurustop.net
>>>
>>> --
>>> 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]<nhusers%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/nhusers?hl=en.
>>>
>>
>>
>>
>> --
>> 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]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>  --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>

-- 
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.

Reply via email to