Skip to content

Instantly share code, notes, and snippets.

@HeathHopkins
Created January 8, 2013 14:56
Show Gist options
  • Save HeathHopkins/4484370 to your computer and use it in GitHub Desktop.
Save HeathHopkins/4484370 to your computer and use it in GitHub Desktop.
Demo of extending EF classes and adding metadata.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using DataAnnotationsExtensions;
namespace MobileAPI.Models
{
[MetadataType(typeof(FeedbackMetadata))]
public partial class Feedback
{
}
public class FeedbackMetadata
{
[DisplayName("Name")]
[PlaceHolder("Name")]
[Required(ErrorMessage = "*")]
public string name { get; set; }
[Email]
[DisplayName("Email")]
[PlaceHolder("Email")]
[Required(ErrorMessage = "*")]
public string email { get; set; }
[AllowHtml]
[DisplayName("Comment")]
[PlaceHolder("Comment")]
[Required(ErrorMessage = "*")]
public string comment { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment