2

I'm sending a DTO over wire (WCF) which has on one property the DisplayName atribute from System.ComponentModel and on a other one the ScaffoldColumn attribute. On the client I have a ASP.NET MVC 2 app and I use the Html.EditorFor(x=>x.DTO) extension method.When the page is rendered it looks like the attributes wasn't there.

The DTO

[Serializable]
public class ProjektDTO : IDTO
{
    public decimal Id { get; private set; }

    public string Poznamka { get; set; }

    [DisplayName("Tralal")]
    public string Oz { get; set; }

    [ScaffoldColumn(false)]
    public string Name { get; set; }
}

Is this even possible ?

EDIT

I found the problem.It works now. But anyway,is this a ok or should I avoid doing this ??

user137348
  • 10,166
  • 18
  • 69
  • 89
  • 2
    heelo, I want to enable this feature too... what did you do to enable this feature? –  Feb 18 '11 at 16:42

1 Answers1

0

Personally, I would avoid this route. The DAL should stay as basic as possible to define that model. Data annotations usually define how the UI should be displayed (more so in MVC) and as such should be kept in the presentation/UI layer (e.g. client side). What if you want to reuse that model in another project but don't want the data annotations?

eth0
  • 4,977
  • 3
  • 34
  • 48