DataTypeAttribute not working RRS feed

  • Question

  • User819964165 posted
    I use the following property with attributes in my MetaData class: 

    [DisplayName("Contact Email")]
    DataType(DataType.EmailAddress, ErrorMessage="Invalid contact email address")]
    public string ContactEmail { get; set; }

    But I can input any invalid email address with no problem. I don't get an error message or anything. Why?

    Monday, January 12, 2009 10:07 PM

All replies

  • User-1005219520 posted

    In the RTM release, the DataType.EmailAddress is only used to mark the type of data for your own use. See How to: Customize Data Field Appearance and Behavior For Non-Intrinsic Data Types in the Data Model for sample code using DataType.EmailAddress.

    The DDFutures samples do have support for email types, altho I don't know that they have a regEx to check for email addresses - - if not it's simple to annotate with your own RegEx.

     Also see Tips on getting your ASP.NET Dynamic Data questions answered quickly 

    Monday, January 12, 2009 10:18 PM
  • User819964165 posted

    Sometimes I don't understand Microsoft. They input example code on how to customize how to do things, why don't they just include the functionality in there in the first place?

     Don't get me wrong, this Dynamic Data framerwork is impressive, but it seems like small little things which could've taken the team a combined extra day or two, they left out.

    Monday, January 12, 2009 10:22 PM
  • User819964165 posted

    Oh shoot... didn't realize I was replying to someone on the asp.net team [:$]

    Monday, January 12, 2009 10:23 PM
  • User-1005219520 posted

    no worries - we have thick skins [:P]

    >>small little things which could've taken the team a combined extra day or two, they left out

    You're exactly right - but there are literally hundreds of little things and only a few developers, testers and doc folks. It's a matter of priority. We try to prioritize on what customers request and what will be most beneficial. Take for instance the new enum feature. As a DB purist I campaigned against the feature, as it violates fundamental DB entity rules - applying field values in the meta model when they belong in the schema with constraints. But many customers asked for the feature so it will be in the next version. My favorite feature (hide columns in specific templates) got cut.

    Monday, January 12, 2009 10:36 PM
  • User819964165 posted

    As a developer, I know how you feel. I've had a custom ORM solution that I developed years ago and built upon over the years. So when I first saw Linq to Sql and even EDM, it still wasn't enough to move away from the custom solution that I created. However, now with the Dynamic Data Framework and EDM and Linq to Sql intriniscally working together, I can happily say that I can move away from my ORM solution that I've been using since .Net 1.1

     I'm very impressed with this framework and .Net 3.5 SP 1 in general, but you know how it is... we want you guys at MS to do all the work for us and make our lives easier [:D].

     By the way, the hide columns in specific templates is one of those features that would've definitelly been nice to have in there.

     Do you know of any estimated time frames when an updated version of Dynamic Data will be released?

    Tuesday, January 13, 2009 1:58 PM
  • User-330204900 posted

    By the way, the hide columns in specific templates is one of those features that would've definitelly been nice to have in there

    I have a solution here: Dynamic Data - Hiding Columns in selected PageTemplates see what you think [:D]

    Tuesday, January 13, 2009 6:19 PM
  • User819964165 posted

    I actually already read that in another one of your other posts, sjnaughton. It's a great article and solution. One that I will most likeley implement.

    The thing is, however, that we're all implementing these custom solutions and Microsoft is going to end up releasing their own solutions to these problems. So when they do, I'm going to have to go back and refactor all the code up to that point to use their solution. That's why I asked ricka6 when does he think the next update to Dynamic Data will be?

    Tuesday, January 13, 2009 6:53 PM
  • User-1005219520 posted

    We will have a beta release in a few months.  It won't have the hide column stuff, but enum support should be completed. Keep in mind it will be a beta release not intended for production use.

    Tuesday, January 13, 2009 7:10 PM
  • User660823006 posted

    We will continue to update the version of Dynamic Data on Codeplex probably about once a month or so. There will be an upcoming beta of .NET 4.0 and Visual Studio 2010 that will contain the new bits as well.

    Wednesday, January 14, 2009 3:27 PM