码迷,mamicode.com
首页 >  
搜索关键字:dbcontext    ( 400个结果
EF6 SQL Logging – Part 2: Changing the content/formatting | One Unicorn
In part 1 we saw how DbContext.Database.Log can be used to easily log SQL to the console or some other TextWriter. This post covers how the context an... ...
分类:数据库   时间:2016-05-21 14:26:03    阅读次数:302
EF6 SQL Logging – Part 3: Interception building blocks | One Unicorn
In parts 1 and 2 of this series we looked at how to use DbContext.Database.Log to log the SQL generated by EF. But this code is actually a relatively ... ...
分类:数据库   时间:2016-05-21 14:25:27    阅读次数:286
ReportViewer技巧汇总
在MVC项目中使用ReportViewer 创建WebForm,向Webform中添加ReportViewer控件,通过CodeBehind设置报表参数并填充数据,测试通过后在MVC的View中iFrame新创建的WebForm 在MVC项目中使用使用DbContext作为ReportViewer的 ...
分类:其他好文   时间:2016-05-19 14:40:47    阅读次数:136
使用Entity Framework通过code first方式创建数据库和数据表
开发环境 WIN10 Entity Framework6.0 MVC5.0 开发工具 VS2015 SqlServer2012 1.创建上下文Context继承DbContext,并创建其他的业务类,这些业务类会创建对应的数据表。 2.在web.config配置文件的entityFramework节 ...
分类:数据库   时间:2016-05-13 17:04:29    阅读次数:1035
单元测试 mock EF 中DbContext 和DbSet
现在EF越来越流行了,很多时候业务成都是直接访问DbContext 和DbSet来操作数据的。 那么我们测试的时候如何来mock这2个对象了?现在时间很晚了, 就直接贴code吧:首先建一个帮助类: public class MockedDbContext : Mock where T : DbContext { public Dictionarystring, o...
分类:数据库   时间:2016-05-12 20:41:05    阅读次数:950
FluentData -Micro ORM with a fluent API that makes it simple to query a database
Code samples Create and initialize a DbContextThe connection string on the DbContext class can be initialized either by giving the connection string n ...
分类:数据库   时间:2016-05-03 12:23:08    阅读次数:251
EntityFramework之一对多关系(三)
上篇介绍了一对一关系,下面介绍下一对多关系代码编写。 1、新建model实体,Product是产品类,Order是订单,一个产品对应多个订单 2、创建一个EntityContext并继承自DbContext 3、在web.config文件中添加数据库连接字符串 4、接着创建实体映射 5、我们写一些操 ...
分类:其他好文   时间:2016-05-02 15:34:29    阅读次数:197
EntityFramework之多对多关系(四)
上篇介绍了一对多关系,下面介绍下多对多关系代码编写。 1、新建model实体,User是用户类,Role是角色类,由于是多对多关系,必须得有一个中间类,所以产生了UserRole类 2、创建一个EntityContext并继承自DbContext 3、在web.config文件中添加数据库连接字符串 ...
分类:其他好文   时间:2016-05-02 15:29:05    阅读次数:229
EntityFramework之一对一关系(二)
下面新建两个实体,关系为一对一 Product为产品类,WarrantyCard为保修卡类,一个产品对应一个保修卡,一个保修卡对应一个产品。 1、新建实体类 2、创建EntityContext类并继承DbContext 3、在web.config文件中添加数据库连接字符串 4、创建表映射类 HasO ...
分类:其他好文   时间:2016-05-02 15:28:13    阅读次数:118
EF 如何code first
首先配置连接数据、sql server 改写自动生成的代码拍段。因为他全部都继承DbContext类。 public class Employe { public int EmployId { get; set; } public string name { get; set; } public i ...
分类:其他好文   时间:2016-04-25 22:45:49    阅读次数:187
400条   上一页 1 ... 23 24 25 26 27 ... 40 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!