The ASP.NET Podcast features, technical talks, interviews, news, reviews, and Wallyisms. Wallace B. (Wally) McClure, David Penton, and Paul Glavich are your hosts. We talk about ASP.NET, AJAX, Performance, Databases, WCF, Silverlight, Cloud Computing, Windows Azure, and whatever else we decide to talk about.
Subscribe to All!
Subscribe to WMV.
Subscribe to M4V (iPod).
Subscribe to MP3.
Download WMV.
Download M4V (iPod).
Download MP3.
Show Notes:
Source Code:
Global.asax:
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
{
[DisplayColumn("Name")]
[MetadataType(typeof(tbItemMetaData))]
public partial class tbItem
{
private class tbItemMetaData
{
[DisplayName("Item Display Name")]
[StringLength(30)]
[Required(ErrorMessage="Item name is required.")]
public object Name { get; set; }
[DisplayFormat(DataFormatString="{0:c}")]
[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."));
}
}
}
[MetadataType(typeof(tbOrderMetaData))]
public partial class tbOrder
{
private class tbOrderMetaData
{
[ScaffoldColumn(true)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}")]
public object DateUpdated { get; set; }
}
}
}
Anonymous comments are disabled