是把int类型的type,转换为typename字符串的数据类型,接收返回类型。
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; // 引入 using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Entity { /// <summary> /// 3 知识文章表 Knowledge /// </summary> public class Knowledge { [Key] public int ID { get; set; } public string Title { get; set; } public string ImgUrl { get; set; } public string VideoUrl { get; set; } public string Content { get; set; } public int ViewCount { get; set; } public int Sort { get; set; } public int Type { get; set; } // 文章类型,用到枚举类 public int CateID { get; set; } public string CateName { get; set; } // 数据类型要写对的。 public int CreateID { get; set;