子晴的编程日记

记录我的编程日记

导航

2019年7月15日 #

c#传入类名插入多条数据

摘要: public int Insert<T>(IReadOnlyCollection<T> models) where T : class, new() { int sucess = 0; if (models.Count > 0) { foreach (var model in models) { s 阅读全文

posted @ 2019-07-15 16:11 子晴的编程日记 阅读(438) 评论(0) 推荐(0) 编辑

c#传入类名添加类对应的表数据

摘要: 添加方法: public int Insert<T>(T model) where T : class, new() { int sucess = 0; if (model is TempInfo) { TempInfo temp = (TempInfo)(object)model; sucess 阅读全文

posted @ 2019-07-15 16:07 子晴的编程日记 阅读(436) 评论(0) 推荐(0) 编辑

c#类生成表

摘要: 第一步: 创建MyContext类 public class MyContext:DbContext { public MyContext():base() { } public DbSet<User> User { get; set; } public DbSet<Temp> Temp { get 阅读全文

posted @ 2019-07-15 15:51 子晴的编程日记 阅读(664) 评论(0) 推荐(0) 编辑