views:

97

answers:

1

I'm working on a legacy where some fields uses special encodings. Is it somehow possible to set an decode the fields in the linq instead of doing as I'm doing now:

XisoEncoding enc = new XisoEncoding()

var q = from b in ent.Basket
            where b.ID == 22038
            select b;

Basket basket = query.First();
basket.STOMAN_MESSAGE = enc.DecodeString(basket.STOMAN_MESSAGE);

.....
+1  A: 

Entity classes are defined as partial classes. You could add a new property to the Basket class, for example DecodedStomanMessage, which returns the decoded message.

I would not modify the STOMAN_MESSAGE property itself, since this will mark the entity as modified, and you could end up sending the decoded version back to the database.

Konamiman
Thanks a lot :)
Henrik