[code=C///] <summary>
    /// Business entity used to model a product
    /// </summary>
    [Table(Name = "Product")
    public class ProductInfo {        private EntityRef<CategoryInfo> _category;        /// <summary>
        /// Default constructor
        /// </summary>
        public ProductInfo() { }        /// <summary>
        /// Constructor with specified initial values
        /// </summary>
        /// <param name="id">Product Id</param>
        /// <param name="name">Product Name</param>
        /// <param name="description">Product Description</param>
        /// <param name="image">Product image</param>
        /// <param name="categoryId">Category Id</param>
        public ProductInfo(string id, string name, string description, string image, string categoryId) {
            this.Id = id;
            this.Name = name;
            this.Description = description;
            this.Image = image;
            this._category = new EntityRef<CategoryInfo>();
            this._category.Entity.Id = categoryId;
        }        // Properties
        [Column(Name = "ProductId", IsPrimaryKey = true, DbType = "varchar(10)")]
        public string Id { get; set; }        [Column(Name = "Name", DbType = "varchar(80)")]
        public string Name { get; set; }        [Column(Name = "Descn", DbType = "varchar(255)")]
        public string Description { get; set; }        [Column(Name = "Image", DbType = "varchar(80)")]
        public string Image { get; set; }        [Column(Name = "CategoryId", DbType = "varchar(10)")]
        public string CategoryId { get; set; }        [Association(IsForeignKey = true, ThisKey = "CategoryId", Storage = "_category")]
        public CategoryInfo Category
        {
            get 
            {
                return this._category.Entity;
            }
            set 
            { 
                this._category.Entity = value;
                value.Products.Add(this);
            }
        }
    }[/code][Table(Name = "Product")]
[Column(Name = "CategoryId", DbType = "varchar(10)")]
[Association(IsForeignKey = true, ThisKey = "CategoryId", Storage = "_category")]这3个都是什么意思呢前两个难道是在构建一张表结构?还能往里面插数据

解决方案 »

  1.   

    映射到数据库的表,你去看看LINQ TO SQL的相关内容就知道怎么回事了。
      

  2.   

    这是 Attribute。自行Google下,基本的C#语法。
      

  3.   

    http://www.cnblogs.com/dudu/articles/4449.html
      

  4.   


                Dictionary<List<int>, List<byte>> dicbyte = new Dictionary<List<int>, List<byte>>();
                // 前面是个整数数组,表示 List<byte>值的索引,根据索引来指定List<byte>的子数组
                List<byte> list = new List<byte> { 1, 2, 3, 4, 5, 6 };
                List<int> list1 = new List<int> { 1, 2, 3, 4, 5 };
                List<int> list2 = new List<int> { 2, 3, 4, 5 };
    近仅仅是个思路