Silverlight MVVM Business Application : Where to place the resource files ?

Jul 26, 2010 at 3:13 PM

Hi Nik,

Thank you for your quick and helpful answer on my previous questions.

I've another question on stackoverflow which is about where to place the different resource files and where to define the Display from an attribute.


I've defined the following validation on my User entity in the server-domain layer:


public partial class User
    internal class UserMetadata
        // Metadata classes are not meant to be instantiated.
        protected UserMetadata()

        [Display(Name = "UserNameLabel", ResourceType = typeof(MyResources))]
        [Required(ErrorMessageResourceName = "ValidationErrorRequiredField", ErrorMessageResourceType = typeof(ValidationErrorResources))]
        [RegularExpression("^[a-zA-Z0-9_]*$", ErrorMessageResourceName = "ValidationErrorInvalidUserName", ErrorMessageResourceType = typeof(ValidationErrorResources))]
        public string Name { get; set; }


My questions are:

  • Is it correct to define the DisplayName in the server-domain layer ? (Domain defines how a property is shown on the Silverlight-Presentation-layer ?)
  • Where to define the other resource strings which need to be localized ? (Multiple pages use the string "Username", should this defined on the Silverlight-Presentation-layer resource file, or in the service domain layer ?

Best regards,








Aug 11, 2010 at 5:28 AM
This is a matter of opinion ultimately. I personally think you're assigning additional semantics to a model. It is the UI/presentation tier that is interpreting those additional semantics/hints to determine how to best process them. Semantics/intent vs. presentation ... subtle distinction. Do you buy that?