http://code.google.com/p/unhaddins/source/browse/uNhAddIns/uNhAddIns/UserTypes/EncryptedString.cs

On Mon, Mar 14, 2011 at 4:34 PM, Huseyin Tufekcilerli <[email protected]>wrote:

> On some of the string properties of my entities, I am doing some text
> encoding/decoding as seen here (this entities are mapped to a legacy
> database, so I don't have the option to fix this on DB side)
>
> private static Encoding western = Encoding.GetEncoding(1252);
> private static Encoding turkish = Encoding.GetEncoding(1254);
>
> private string foo;
> public virtual string Foo
> {
>     get { return turkish.GetString(western.GetBytes(this.foo)); }
>     set { this.foo = western.GetString(turkish.GetBytes(value)); }
> }
>
> Actually this conversion code has been placed to lots of the string
> properties all over the project by the previous (naïve?) dev. This makes me
> sick whenever I see and I decided to fix this once and for all. What's the
> most elegant way to solve this kind of an issue in NHibernate? How can I
> apply such a cross-cutting behavior to my string properties on some of the
> selected entities? IInterceptor comes to my mind...any other suggestions?
> How would you mark those selected entity and properties to be
> encoded/decoded?
>
> Thanks and kind regards.
>
> --
> 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.
>



-- 
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].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to