使用Linq.Expressions来动态生成映射方法 1.我们先写个简单的类Test,包含一个ID和Name. public class Test { public int? ID { get; set; } public string Name { get; set; } } 2.需要手工写简单映射代码,暂时不考虑大小写等问题,代码如下. /// <summary> /// 设置属性 /// </summary> static void Set(Test t,string na…
model.py from django.db import models # Create your models here. class Book(models.Model): nid = models.AutoField(primary_key=True) title = models.CharField(max_length=64) publishDate = models.DateField() price = models.DecimalField(max_digits=5, dec…