问题描述:

For proper separation of concerns on a domain/business assembly/layer it seems to me that a good practice would be to go ahead and system.ComponentModel.DataAnnotations mark up my fields in the domain assembly.

Since most of these validations/annotations would be useful no matter what project type I wanted this domain to be usable in: Windows App, silverlight, asp.net, asp.net MVC, etc..

While some of them are a presentation concern, they would be consistent between all presentation types; so there would be no harm in them going in the domain assembly as far as I can envision.

However using the System.Web.Mvc annotation of [hiddeninput] would be inappropriate as that would only be proper for mvc projects.Also,this would require any assembly utilizing this domain assembly to also have a reference to System.Web.Mvc right?

So which tags if any are appropriate in the domain model?

Can I layer on an additional layer of metadata in my mvc project for this tag? Could the attributes be added in the interface for the domain object so that both the DTO and the actual business object would inherit them?

相关阅读:
Top