c# - Automapper , Linq and Localizaton -


recently have been playing automapper tool populate our dtos. cool thing automapper project().to() let map queryable can select fields want according our map.

but here have scenario too.we want able translate of values of entity other representation.

suppose have string field value in db 'apparatment' , want translate language while selecting our dtos.

i think if want write in sql :

select case buidlingtype when 'appartment' 'apparatment  in langaure' when 'flat' 'flat in languate' end buildingtype buildings 

i know can define value resolvers in automapper. question ask ,can use these resolvers in project().to() scenario ? if answer yes how should use them (to return expression instead of value) , if not , there other alternative approach able translate dto on fly ?

no can't use resolvers in linq projections.

i guess i'm little confused - translations little difficult in sql have. translations stored in database, or hard code them in sql?

typically localized labels stored either in resource files or specialized tables. if they're in tables, don't returned translated data labels data. have 2 queries , translation query cached.

i start "what linq build make correct sql" , can "how can configure automapper build linq?"


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -