Search code examples
asp.net-mvc-3separation-of-concerns

ASP.NET MVC 3 RemoteAttribute and Separation of concerns


Isn't it a violation of separation of concerns principle when you use the RemoteAttribute on your model's property to indicate what action and controller to call? It makes you tie your model to a specific controller via string arguments.


Solution

  • Yes it does, but so does using all the other DataAnnotations attributes.

    Fortunately the model metadata system in MVC is pluggable so you could write your own metadata provider that's not tied to attributes on a model class.