首先我们说明一下ORM是什么。

微软官方提供的ORM工具,ORM让开发人员节省数据库访问的代码时间,将更多的时间放到业务逻辑层代码上。开发人员使用Linq语言,对数据库操作如同操作Object对象

一样省事。EF有三种使用场景,1. 从数据库生成Class,2.由实体类生成数据库表结构,3.通过数据库可视化设计器设计数据库,同时生成实体类。

ORM (对象关系型映射)是将数据存储从域对象自动映射到关系型数据库的工具。ORM主要包括3个部分:域对象、关系数据库对象、映射关系。ORM使类提供自动化CRUD,使

开发人员从数据库API和SQL中解放出来。以前是使用ADO.NET来进行对数据库中得数据表进行操作,现在,使用ORM直接对对象进行操作,操作对象就等于操作数据库表,

那怎么让对象和数据库表一一对应起来?这个过程就是通过ORM框架来完成的,操作对象就是操作数据库也是通过ORM来完成的。ORM框架就是做对象和数据库的映射的。

那么EntityFramework的作用是什么?

我的理解就是大大简化数据库操作的,举个例子:在没有使用EF前,我们要编写复杂的SQL语句,而使用了EF之后,将会减少编写复杂的SQL语句过程。

最终都是转化为SQL语句来执行。

下面说一下EF的使用,新建一个解决方案,添加一个项目EntifyFrameWork----->在项目下添加一个ADO.NET实体数据模型

然后选择一个数据库,测试连接没有问题后就可以了。

生成这样四个文件

数据库中的表就全部生成了

//------------------------------------------------------------------------------
// <auto-generated>
// 此代码是根据模板生成的。
//
// 手动更改此文件可能会导致应用程序中发生异常行为。
// 如果重新生成代码,则将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------ namespace EntityFrameWork
{
using System;
using System.Collections.Generic; public partial class Admins
{
public int LoginId { get; set; }
public string LoginPwd { get; set; }
public string AdminName { get; set; }
}
}

......

//------------------------------------------------------------------------------
// <auto-generated>
// 此代码是根据模板生成的。
//
// 手动更改此文件可能会导致应用程序中发生异常行为。
// 如果重新生成代码,则将覆盖对此文件的手动更改。
// </auto-generated>
//------------------------------------------------------------------------------ namespace EFDBDemo
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure; public partial class EFDBEntities : DbContext
{
public EFDBEntities()
: base("name=EFDBEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
} public DbSet<Admins> Admins { get; set; }
public DbSet<ScoreList> ScoreList { get; set; }
public DbSet<StudentClass> StudentClass { get; set; }
public DbSet<Students> Students { get; set; }
}
}
using System;
using System.Collections.Generic; using System.Linq;
using System.Text; using System.Data;
using System.Data.SqlClient; namespace EFDBDemo
{
class Program
{
#region EF的基本使用
//查询
static void Main(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
Students objStudent = efdb.Students.SingleOrDefault(s => s.StudentName == "冯小强");
if (objStudent != null)
{
Console.WriteLine(objStudent.StudentId + " " + objStudent.StudentName);
}
//用where()方法查询符合条件的数据
IQueryable<Students> query = efdb.Students.Where(s => s.StudentId > 100002);
Console.WriteLine("学号\t姓名\t年龄");
foreach (var item in query)
{
Console.WriteLine("{0}\t{1}\t{2}", item.StudentId, item.StudentName, item.Age);
}
Console.ReadKey();
} //添加
static void test01(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
efdb.Students.Add(new Students()
{
StudentAddress = "北京海淀区28号",
StudentName = "白富美",
StudentIdNo = 130223199210111213,
ClassId = 1,
Gender = "女",
Birthday = Convert.ToDateTime("1992-10-11"),
Age = 24,
PhoneNumber = "010-55662233"
});
int result = efdb.SaveChanges();
if (result == 1)
Console.WriteLine("添加成功!");
Console.ReadKey();
}
//修改
static void test02(string[] args)
{
EFDBEntities efdb = new EFDBEntities(); Students objStudent = efdb.Students.FirstOrDefault(s => s.StudentId == 100006);
objStudent.StudentAddress = "北京昭阳区";
objStudent.PhoneNumber = "13600000000";
int result = efdb.SaveChanges(); if (result == 1)
Console.WriteLine("修改成功!");
Console.ReadKey();
}
//删除
static void test03(string[] args)
{
EFDBEntities efdb = new EFDBEntities(); Students objStudent = efdb.Students.FirstOrDefault(s => s.StudentId == 100010);
efdb.Students.Remove(objStudent);//从集合中删除学员对象
int result = efdb.SaveChanges(); if (result == 1)
Console.WriteLine("删除成功!");
Console.ReadKey();
} #endregion #region Linq to Object //Linq to 字符串
static void test04(string[] args)
{
string strTest = "we are studying linq to object";
//定义查询表达式
var query = from c in strTest
select c;
//遍历查询结果并输出
foreach (char ch in query)
{
Console.WriteLine(ch);
}
Console.ReadLine();
} //Linq to List<T>
static void test05(string[] args)
{
List<Students> students = new List<Students>
{
new Students(){ StudentName="张浩明",Gender="男",Birthday=DateTime.Parse("1990-09-10")},
new Students(){ StudentName="李晓燕",Gender="女",Birthday=DateTime.Parse("1992-03-12")},
new Students(){ StudentName="郝云霄",Gender="女",Birthday=DateTime.Parse("1991-09-15") }
};
var stuList = from s in students where s.Gender == "女" select s;
foreach (var item in stuList)
{
Console.WriteLine(item.StudentName);
}
Console.ReadLine();
} //查询语句和查询方法对比
static void test06(string[] args)
{
string strTest = "We are studying Linq To Object"; //var query = from c in strTest
// where char.IsUpper(c)
// select c; var query = strTest.Where(c => char.IsUpper(c)); foreach (char ch in query)
{
Console.WriteLine(ch);
}
Console.ReadLine();
}
static void test07(string[] args)
{
List<Students> students = new List<Students>
{
new Students(){ StudentName="张浩明",Gender="男",Age=21},
new Students(){ StudentName="李晓燕",Gender="女",Age=23},
new Students(){ StudentName="张云霄",Gender="男",Age=20}
};
//查询姓张的男学生,并且按年龄升序排列
var stuList = from stu in students
where stu.StudentName.StartsWith("张") && stu.Gender == "男"
orderby stu.Age ascending
select stu;
//var stuList = students.Where(stu => stu.StudentName.StartsWith("张")
// && stu.Gender == "男")
// .OrderBy(stu => stu.Age); foreach (var item in stuList)
{
Console.WriteLine(item.StudentName + "\t" + item.Age);
}
Console.ReadKey();
}
//查询方法和查询语句综合使用
static void test08(string[] args)
{
List<Students> students = new List<Students>
{
new Students(){ StudentName="张浩明",Gender="男",Birthday=DateTime.Parse("1990-09-10")},
new Students(){ StudentName="李晓燕",Gender="女",Birthday=DateTime.Parse("1992-03-12")}//,
// new Students(){ StudentName="郝云霄",Gender="女",Birthday=DateTime.Parse("1991-09-15") }
};
//获取集合中“第一个”对象
Students objStudent = (from s in students select s).FirstOrDefault();
//输出第一个对象张浩明
Console.WriteLine(objStudent.StudentName); //删除一个对象
students.Remove(objStudent);
//获取集合中“唯一的”对象
objStudent = (from s in students select s).SingleOrDefault();
//输出唯一对象
Console.WriteLine(objStudent.StudentName);
Console.ReadLine();
} #endregion #region 使用Linq to Entities查询数据 static void test09(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
var query = from s in efdb.Students
where s.StudentId == 100002
select s;
Console.WriteLine("学号\t姓名\t年龄");
foreach (var item in query)
{
Console.WriteLine("{0}\t{1}\t{2}", item.StudentId, item.StudentName, item.Age);
}
Console.ReadKey();
} //从Linq to Objects 到 Linq to Entitis
static void test10(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
//查询姓张的男学生,并且按年龄升序排列
var stuList = from stu in efdb.Students
where stu.StudentName.StartsWith("张") && stu.Gender == "男"
&& stu.Birthday > Convert.ToDateTime("1990-01-01")
orderby stu.Age ascending
select stu;
foreach (var item in stuList)
{
Console.WriteLine(item.StudentId + "\t" + item.StudentName + "\t" + item.Age);
}
Console.ReadKey();
} static void test11(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
DateTime birthday = Convert.ToDateTime("1990-01-01");
//查询姓张的男学生,并且按年龄升序排列
var stuList = from stu in efdb.Students
where stu.StudentName.StartsWith("张") && stu.Gender == "男"
&& stu.Birthday > birthday
orderby stu.Age ascending
select stu;
foreach (var item in stuList)
{
Console.WriteLine(item.StudentId + "\t" + item.StudentName + "\t" + item.Age);
}
Console.ReadKey();
} //单表查询和数据投影
static void test12(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
var stuList = from stu in efdb.Students
where stu.StudentName.Contains("小")
orderby stu.Age descending
select new { stu.StudentId, stu.StudentName, stu.StudentIdNo, stu.Gender, stu.Age }; foreach (var item in stuList)
{
Console.WriteLine(item.StudentId + "\t" + item.StudentName + "\t" + item.Age);
}
Console.ReadKey();
} //使用Find方法实现简单查询
static void test13(string[] args)
{
EFDBEntities efdb = new EFDBEntities(); Students objStudent = efdb.Students.Find(100005); Console.WriteLine(objStudent.StudentId + "\t" +
objStudent.StudentName + "\t" + objStudent.Age);
Console.ReadKey();
} // 使用 “导航属性” 查询多表的数据
static void test14(string[] args)
{
EFDBEntities efdb = new EFDBEntities(); var stuList = from s in efdb.Students
where s.Age > 22
select new { s.StudentName, s.Age, s.StudentClass.ClassName }; foreach (var item in stuList)
{
Console.WriteLine(item.StudentName + "\t" + item.Age + "\t" + item.ClassName);
}
Console.ReadKey();
} static void test15(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
var stuList = from score in efdb.ScoreList
select new
{
score.StudentId,
score.SQLServerDB,
score.Students.StudentName,
score.Students.StudentClass.ClassName
};
foreach (var item in stuList)
{
Console.WriteLine("{0}\t{1}\t{2}\t{3}",
item.StudentId, item.StudentName, item.SQLServerDB,
item.ClassName);
}
Console.ReadKey();
} //join联接查询
static void test16(string[] args)
{
EFDBEntities efdb = new EFDBEntities(); var stuList = from score in efdb.ScoreList
join s in efdb.Students on score.StudentId equals s.StudentId
join c in efdb.StudentClass on s.ClassId equals c.ClassId
where s.Gender == "男"
select new { s.StudentId, s.StudentName, score.SQLServerDB, c.ClassName }; foreach (var item in stuList)
{
Console.WriteLine("{0}\t{1}\t{2}\t{3}",
item.StudentId,
item.StudentName,
item.SQLServerDB,
item.ClassName);
}
Console.ReadKey();
} //嵌套查询
static void test17(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
//查询班级编号为1的学员
var query = from s in efdb.Students
where s.ClassId == 1 || s.ClassId == 2
select new { s.StudentClass.ClassName, s.StudentName, s.StudentId };
//在上一个查询基础上查询年龄大于22的学员
var subQuery = from s in (query) where s.StudentId > 100002 select s;
//执行查询
var stuList = subQuery.ToList();
foreach (var item in stuList)
{
Console.WriteLine("{0}\t{1}\t{2}",
item.StudentId,
item.StudentName,
item.ClassName);
}
Console.ReadKey();
}
//子查询
static void test18(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
//使用子查询
var subQuery = from s in
(from s in efdb.Students
where s.ClassId == 1 || s.ClassId == 2
select new { s.StudentClass.ClassName, s.StudentName, s.StudentId })
where s.StudentId > 100002
select s;
//执行查询
var stuList = subQuery.ToList(); foreach (var item in stuList)
{
Console.WriteLine("{0}\t{1}\t{2}",
item.StudentId,
item.StudentName,
item.ClassName);
}
Console.ReadKey();
} //在select子句中使用子查询
static void test19(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
var query = from s in efdb.Students
select new
{
Name = s.StudentName,
Subject = from score in s.ScoreList
select new { sql = score.SQLServerDB, cs = score.CSharp }
}; //执行查询
var stuList = query.ToList();
foreach (var item in stuList)
{
Console.Write(item.Name);
foreach (var s in item.Subject)
{
Console.Write("\t{0},{1}", s.sql, s.cs);
}
Console.WriteLine();
}
Console.ReadKey();
} //聚合查询
static void test20(string[] args)
{
EFDBEntities efdb = new EFDBEntities(); //计算所有的学生总数
var query = from s in efdb.Students select s;
int stuCount = query.Count();
Console.WriteLine("学生总数:" + stuCount); //计算参考考试的学生考试总分
var scoreQuery = from s in efdb.Students
where s.ScoreList.Count() > 0//参加考试的学生
select new
{
Name = s.StudentName,
Total = (from score in s.ScoreList
select (score.SQLServerDB + score.CSharp)).Sum()
}; foreach (var item in scoreQuery)
{
Console.WriteLine("{0}\t{1}", item.Name, item.Total);
}
Console.ReadKey();
}
#endregion #region 处理关联数据 //添加对象的同时关联实体操作
static void test20(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
Students stu = new Students()
{
StudentAddress = "北京海淀区",
StudentName = "王慧慧",
StudentIdNo = 130223198910121213,
Gender = "男",
Birthday = Convert.ToDateTime("1990-10-12"),
Age = 25,
PhoneNumber = "010-88996655",
ClassId = (from c in efdb.StudentClass where c.ClassName.Equals("软件1班") select c.ClassId).SingleOrDefault(),
};
efdb.Students.Add(stu);
Console.WriteLine(efdb.SaveChanges());
Console.ReadKey();
} //通过嵌套查询获取外键对象的值
static void test21(string[] args)
{
EFDBEntities efdb = new EFDBEntities(); Students stu = new Students()
{
StudentAddress = "北京海淀区",
StudentName = "李慧慧",
StudentIdNo = 130223198910131213,
Gender = "女",
Birthday = Convert.ToDateTime("1990-10-13"),
Age = 26,
PhoneNumber = "010-88996699"
}; //查询班级实体,然后使用导航数据添加数据
(from c in efdb.StudentClass where c.ClassName.Equals("软件2班") select c).SingleOrDefault().Students.Add(stu); efdb.Students.Add(stu);
Console.WriteLine(efdb.SaveChanges());
Console.ReadKey();
} //级联删除
static void test22(string[] args)
{
EFDBEntities efdb = new EFDBEntities(); //找到软件2班
var stuClass = (from c in efdb.StudentClass where c.ClassId == 2 select c).SingleOrDefault(); //删除软件2班的学生
for (int i = 0; i < stuClass.Students.Count; i++)
{
efdb.Students.Remove(stuClass.Students.FirstOrDefault());
}
//删除软件2班
efdb.StudentClass.Remove(stuClass);
Console.WriteLine(efdb.SaveChanges());
Console.ReadKey(); //efdb.Set<Students>().Attach(stu);
// efdb.Entry<Students>(stu).State = EntityState.Deleted; } #endregion #region 状态跟踪与管理 static void test23(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
var stuList = from stu in efdb.Students
where stu.StudentId > 100002
select stu;
string sql = stuList.ToString();
Console.WriteLine(sql);
Console.ReadLine();
}
static void test24(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
int stuId = 100002;
var stuList = from stu in efdb.Students
where stu.StudentId > stuId
select stu;
string sql = stuList.ToString();
Console.WriteLine(sql);
Console.ReadLine();
}
//状态跟踪
static void test25(string[] args)
{
EFDBEntities efdb = new EFDBEntities(); StudentClass stuClass = new StudentClass() { ClassId = 10, ClassName = "软件10班" };
Console.WriteLine(efdb.Entry(stuClass).State.ToString()); //输出当前对象的状态 efdb.StudentClass.Add(stuClass);
Console.WriteLine(efdb.Entry(stuClass).State.ToString()); efdb.SaveChanges();
Console.WriteLine(efdb.Entry(stuClass).State.ToString()); Console.ReadLine();
} //无状态跟踪
static void test26(string[] args)
{
EFDBEntities efdb = new EFDBEntities(); //状态跟踪查询
var stu1 = (from s in efdb.Students select s).FirstOrDefault();
Console.WriteLine(efdb.Entry(stu1).State.ToString()); //无状态跟踪查询
var stu2 = efdb.Students.AsNoTracking().Select(s => s).FirstOrDefault();
Console.WriteLine(efdb.Entry(stu2).State.ToString());
Console.ReadLine();
} //关闭状态管理
static void test27(string[] args)
{
EFDBEntities efdb = new EFDBEntities(); efdb.Configuration.AutoDetectChangesEnabled = false;//禁用 for (int i = 20; i < 25; i++)
{
StudentClass stuClass = new StudentClass() { ClassId = i, ClassName = string.Format("软件{0}班", i) };
efdb.StudentClass.Add(stuClass);
}
Console.WriteLine(efdb.SaveChanges()); Console.ReadLine();
} #endregion #region EF优化后: 基于Linq查询的CRUD //添加
static void test28(string[] args)
{
Students stu = new Students()
{
StudentAddress = "天津南开区狮子林大街28号",
StudentName = "李超阳",
StudentIdNo = 130223198910111213,
ClassId = 2,
Gender = "男",
Birthday = Convert.ToDateTime("1990-10-11"),
Age = 24,
PhoneNumber = "022-55662232"
}; using (EFDBEntities efdb = new EFDBEntities())
{
efdb.Entry<Students>(stu).State = EntityState.Added;//显示告诉变化
// efdb.Students.Add(stu);
Console.WriteLine(efdb.SaveChanges());
} Console.ReadLine();
} static void test29(string[] args)
{
Students stu = new Students()
{
StudentAddress = "天津南开区狮子林大街29号",
StudentName = "王超阳",
StudentIdNo = 130223198911111219,
ClassId = 1,
Gender = "男",
Birthday = Convert.ToDateTime("1990-11-19"),
Age = 28,
PhoneNumber = "022-5566888888"
};
Console.ReadLine();
} //修改
static void test30(string[] args)
{
Students stu = new Students()
{
StudentAddress = "2222",
StudentName = "2222",
StudentIdNo = 130223198910111222,
ClassId = 2,
Gender = "男",
Birthday = Convert.ToDateTime("1990-10-11"),
Age = 24,
PhoneNumber = "88888888",
StudentId = 100007//注意:这个应该改成你数据库的具体值
};
using (EFDBEntities efdb = new EFDBEntities())
{
efdb.Entry<Students>(stu).State = EntityState.Modified;//显示告诉变化
Console.WriteLine(efdb.SaveChanges());
} Console.ReadLine();
} //删除
static void test30(string[] args)
{
Students stu = new Students()
{
StudentId = 100019 //根据主键删除
};
using (EFDBEntities efdb = new EFDBEntities())
{
efdb.Set<Students>().Attach(stu);//将给定实体添加到上下文
efdb.Entry<Students>(stu).State = EntityState.Deleted;
Console.WriteLine(efdb.SaveChanges());
};
Console.ReadLine();
} static void test31(string[] args)
{
Students stu = new Students()
{
StudentId = 100012 //根据主键删除
};
using (EFDBEntities efdb = new EFDBEntities())
{
efdb.Set<Students>().Attach(stu);
efdb.Students.Remove(stu);
efdb.SaveChanges();
};
Console.ReadLine();
} //查询
static void test32(string[] args)
{
EFDBEntities efdb = new EFDBEntities();
var stuList = from stu in efdb.Students
where stu.StudentId > 100002
select stu; foreach (var item in stuList)
{
Console.WriteLine(item.StudentId + "\t" + item.StudentName);
}
Console.ReadLine();
} //使用缓存
static void test33(string[] args)
{
using (EFDBEntities efdb = new EFDBEntities())
{
var stuList = from stu in efdb.Students select stu;
foreach (var item in stuList)
{
Console.WriteLine(item.StudentId + "\t" + item.StudentName);
} //查询学生总数
// Console.WriteLine("学生总数:{0}", efdb.Students.Count()); //使用缓存查询学生总数
Console.WriteLine("学生总数:{0}", efdb.Students.Local.Count()); Console.ReadLine();
}
}
#endregion #region 从实体框架回归到SQL
static void test34(string[] args)
{
string sql1 = "update Students set StudentName='张新宇' where StudentId=100002";
string sql2 = "update Students set StudentName=@StudentName where StudentId=@StudentId";
SqlParameter[] param = new SqlParameter[]
{
new SqlParameter("@StudentName","刘莉"), new SqlParameter("@StudentId",100004)
}; using (EFDBEntities efdb = new EFDBEntities())
{
int result1 = efdb.Database.ExecuteSqlCommand(sql1);
int result2 = efdb.Database.ExecuteSqlCommand(sql2, param);
Console.WriteLine(result1 + " " + result2);
} Console.ReadLine();
} static void test35(string[] args)
{
string sql1 = "select count(*) from Students";
string sql2 = "select * from Students where Gender=@Gender";
SqlParameter[] param = new SqlParameter[]
{
new SqlParameter("@Gender","男")
}; using (EFDBEntities efdb = new EFDBEntities())
{ int stuCount = efdb.Database.SqlQuery<int>(sql1).ToList()[0];
var stuList = efdb.Database.SqlQuery<Students>(sql2, param); Console.WriteLine("学生总数:" + stuCount);
foreach (var stu in stuList)
{
Console.WriteLine("{0}\t{1}\t{2}", stu.StudentId, stu.StudentName, stu.Age);
}
};
Console.ReadLine();
}
//调用存储过程
static void test36(string[] args)
{
SqlParameter[] param1 = new SqlParameter[]
{
new SqlParameter("@StudentName","王大彪"), new SqlParameter("@StudentId",100004)
};
SqlParameter[] param2 = new SqlParameter[]
{
new SqlParameter("@ClassId",1)
};
using (EFDBEntities efdb = new EFDBEntities())
{
int result = efdb.Database.ExecuteSqlCommand("execute usp_updateStu @StudentName,@StudentId", param1);
var stuList = efdb.Database.SqlQuery<Students>("execute usp_selectStu @ClassId", param2);
Console.WriteLine(result);
foreach (var stu in stuList)
{
Console.WriteLine("{0}\t{1}\t{2}", stu.StudentId, stu.StudentName, stu.Age);
}
}; Console.ReadLine();
}
#endregion
}
}

EntityFramework介绍的更多相关文章

  1. ORM框架之EntityFramework介绍

    ORM框架之EntityFramework介绍 1. 简介 大家好!我是高堂. 作为一位伪前端程序猿,我给大家介绍一下微软的自家的 ORM框架. ADO.NET Entity Framework 以下 ...

  2. C#+JQuery+.Ashx+百度Echarts实现全国省市地图和饼状图动态数据图形报表的统计

    在目前的一个项目中,需要用到报表表现数据,这些数据有多个维度,需要同时表现出来,同时可能会有大量数据呈现的需求,经过几轮挑选,最终选择了百度的echarts作为报表基础类库.echarts功能强大,界 ...

  3. Entity Framework 新手入门友好实例

    起因 因为实习的原因,程序之中用到了较多的数据库操作逻辑.如果每一处数据库操作都手写的话,工作量较大且后期不易于维护,所以希望能通过 ORM 框架来解决这两个问题. 在昨天之前,对于 ORM 这个词汇 ...

  4. [01]从零开始学 ASP.NET Core 与 EntityFramework Core 课程介绍

    从零开始学 ASP.NET Core 与 EntityFramework Core 课程介绍 本文作者:梁桐铭- 微软最有价值专家(Microsoft MVP) 文章会随着版本进行更新,关注我获取最新 ...

  5. EntityFramework ,ef 介绍

    EntityFramework之领域驱动设计实践 分层架构 在引入实例以前,我们有必要回顾,并进一步了解分层架构.“层”是一种体系结构模式[POSA1],也是被广大软件从业人员用得最为广泛而且最为灵活 ...

  6. EntityFramework数据持久化 Linq介绍

    一.LINQ概述与查询语法 二.LINQ方法语法基础(重点) 三.LINQ聚合操作与元素操作(重点) 四.数据类型转换(重点) 一.LINQ概述与查询语法 1.LINQ(Language Integr ...

  7. 采用EntityFramework.Extended 对EF进行扩展(Entity Framework 延伸系列2)

    前言 Entity Framework 延伸系列目录 今天我们来讲讲EntityFramework.Extended 首先科普一下这个EntityFramework.Extended是什么,如下: 这 ...

  8. 介绍,介绍我的底层支持库 Net.Sz.CFramework

    Net.Sz.CFramework  是我自己的底层库,是经过验证的底层库. 包含: socket tcp协议,socket http协议线程池,线程模型,任务模型,定时器模型,日志模块脚本模块一些辅 ...

  9. 监视EntityFramework中的sql流转你需要知道的三种方式Log,SqlServerProfile, EFProfile

    大家在学习entityframework的时候,都知道那linq写的叫一个爽,再也不用区分不同RDMS的sql版本差异了,但是呢,高效率带来了差灵活性,我们 无法控制sql的生成策略,所以必须不要让自 ...

随机推荐

  1. 10_Linux基础-SHELL入门1

    @ 目录 10_Linux基础-SHELL入门1 一. 输入输出重定向 二. 2个特殊文件 三. here document 四. tee命令 五. 清空文件内容 六. SHELL入门 SHELL的变 ...

  2. KingbaseES R6 集群主库网卡down测试案例

    数据库版本: test=# select version(); version ------------------------------------------------------------ ...

  3. 【SQLServer】max worker threads参数配置

    查看和设置max worker threads USE master; //选中你想设置max worker threads的数据库.master表示在实例级别进行设置 GO EXEC sp_conf ...

  4. vivo 公司 Kubernetes 集群 Ingress 网关实践

    文章转载自:https://mp.weixin.qq.com/s/qPqrJ3un1peeWgG9xO2m-Q 背景 vivo 人工智能计算平台小组从 2018 年底开始建设 AI 计算平台至今,已经 ...

  5. 第二章:视图层 - 10:动态生成PDF文件

    可以通过开源的Python PDF库ReportLab来实现PDF文件的动态生成. 一.安装ReportLab ReportLab库在PyPI上提供,可以使用pip来安装: $ pip install ...

  6. 第五章:Admin管理后台 - 2:自定义Admin actions

    通常情况下,admin的工作模式是"选中目标,然后修改目标",但在同时修改大量目标的时候,这种模式就变得重复.繁琐. 为此,admin提供了自定义功能函数actions的手段,可以 ...

  7. Beats processors

    文章转载自:https://elasticstack.blog.csdn.net/article/details/111321105 我们通常的做法是使用 Elasticsearch 的 ingest ...

  8. 05_Java基础知识

    Java基础知识 一. Java的语言特点 面向对象(贴近人类思维模式,模拟现实世界,解决现实问题) 简单性(自动内存管理机制,不易造成内存溢出:简化流程处理.语义清晰) 跨平台(操作系统.服务器.数 ...

  9. flutter系列之:深入理解布局的基础constraints

    目录 简介 Tight和loose constraints 理解constraints的原则 总结 简介 我们在flutter中使用layout的时候需要经常对组件进行一些大小的限制,这种限制就叫做c ...

  10. Activiti7基本介绍

    官方地址 官方地址 官方最新用户文档-V6.0.0 码云镜像-activiti-7-developers-guide 关于BPMN BPMN(Business Process Model AndNot ...