views:

247

answers:

1

Hi, i continue with a MVC Web App, and now im between the concepts of DRY (dont repeat yourself) and decoupling (be independent), the question is i divided my big Web Site in diferent projects within a Solution, and as you may already now in MVC the Validations are done in the Model or Service Layer, that in my case its in a diferent project than the one holding the App_GLobalResources, and here is the thing how can i access the GLobalResources from a different project so a can access the strings to set the errors on the model in the service layer. So far i created a new project like a stand alone resx files and complied them to set the reference to the dll but it doesnt work, because the main resx files are internals or privates, i tried one of those custom tools to make resx files public (cross assembly avaible) but it didnt work either, because it throws "No matching culture found". The best aproach so far is to create a resx file just for the Model Project and it work good, but im repeating the same strings twice, one for the Views (to set the jQuery string validation errors on client side) and another one for the Model Validations (server side), these give me the benefit of decoupling, but what happen with DRY in this case? Any advise or tips?

+1  A: 

Well i have decided to follow two separetes resx (for strings), one for the Views & Controllers and another for the Model->Service layer, Im using a service layer for validation, so i isolate that layer, in that way i can reuse the layer "Service" or (BLL), in a way that i can reuse it later in somthing like a WPF app, with out any reference to the resx of the Views or Controller. SO decoupling won here ... =)

Omar