模型验证
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace MVC_Controller.Models.ViewModels
{
[MetadataType(typeof(ProductMD))]
public partial class Product
{
public class ProductMD
{
public string Name { get; set; }
public string Book { get; set; }
public IEnumerable<Product> Product { get; set; }
public IEnumerable<Category> Category { get; set; }
}
}
}