using System;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
//View
class Program
{
static void Main(string[] args)
{
StudentBll<Student> studentBll = new StudentBll<Student>();
Student model = studentBll.GetModelByID(1);
Console.WriteLine(model.Key + " " + model.Name + " " + model.Age);
Console.WriteLine("请按下键盘任意键退出!");
Console.ReadKey();
}
}
//model
[DBTableName("connectionstring")]
public class Student
{
[DBField(true)]
public int Key { get; set; }
[DBField]
public string Name { get; set; }
[DBField]
public int Age { get; set; }
}
//control
public class StudentBll<T> where T:class,
C#反射,特性结合使用
最新推荐文章于 2025-03-27 17:35:19 发布