ef core 简介 ORM:object relational mapping 让开发者用对象操作的形式操作关系型数据库 有那些orm:efcore dapper sqlsuger freesql ef core 搭建 安装:install-package microsoft.entityframeworkcore.sqlserver 搭建:建立实体类 建立DbContext 安装:package microsoft.entityfra
正常情况下,都是通过EF先取出entity,再修改或删除。 这样会生成一条select和一条update或delete语句,但是通过update/delete sql可以一句就完成。 使用以下代码,通过欺骗EF的方式,使得一句sql完成目标。 using (MyDbContext ctx = new MyDbContext()) { Student a1 = n
尽量使用EF的异步调用 await ctx.Students.ToListAsync() await foreach (var s in ctx.Students.AsAsyncEnumerable()) FormattableString使用 int a = 111; string world = "www"; FormattableString s = @$"hello {world}, {a}"; Console.WriteL
测试一下EF core 的操作 蛀牙总是用导航属性有的时候有点不理解 写个例子给自己用 class Program { static void Main(string[] args) { MyDbContext myDbContext = new MyDbContext(); try {
asp.net core Mvc 增删改查 1.创建项目 创建Data文件夹 创建实体类Students/cs public class Students { public Guid Id { get; set; } public string Name { get; set; } public int Age { get; set; } } 创建MyDbContext
测试一下EF core 的操作 蛀牙总是用导航属性有的时候有点不理解 写个例子给自己用 class Program { static void Main(string[] args) { MyDbContext myDbContext = new MyDbContext(); try {