ASP.NET Podcast Show #127 - Dynamic Data

Subscribe to All!

Subscribe to WMV.

Subscribe to M4V (iPod).

Subscribe to MP3.

Download WMV.

Download M4V (iPod).

Download MP3.

Original Url:

Show Notes:

Source Code:


model.RegisterContext(typeof(db35sp1Entities), new ContextConfiguration() { ScaffoldAllTables = true });

Metadata class:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace Dynamic_Data
    public partial class tbItem
        private class tbItemMetaData
            [DisplayName("Item Display Name")]
            [Required(ErrorMessage="Item name is required.")]
            public object Name { get; set; }

            [Range(0, 500, ErrorMessage="Standard Cost should be between {1} and {2}.")]
            public object Price { get; set; }

        // Note the naming convention of On X Changing and the nullable value.
        partial void OnPriceChanging(decimal? value)
            if (value < 0)
                throw (new ValidationException("Price must be positive, afterall we aren't paying you to take it."));

    public partial class tbOrder
        private class tbOrderMetaData
            [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}")]
            public object DateUpdated { get; set; }

No Comments