EF有外键的查询
modelBuilder.Entity<ActionMenu>().ToTable("ActionMenu");
modelBuilder.Entity<ActionMenu>().HasKey(s => s.Id);
modelBuilder.Entity<ActionMenu>().Property(s => s.MenuName).IsRequired().HasMaxLength(); modelBuilder.Entity<ActionMenu>().HasMany(t => t.ChildActions)
.WithMany()
.Map(m =>
{
m.ToTable("ActionMenu_ActionInfo_Mapping");
m.MapLeftKey("ActionMenuId");
m.MapRightKey("ActionInfoId");
}); modelBuilder.Entity<ActionMenu>().HasOptional(p => p.Parent).WithMany(p => p.ChildKeys); modelBuilder.Entity<ErpMember>().ToTable("ErpMember");
modelBuilder.Entity<ErpMember>().HasKey(s => s.Id);
modelBuilder.Entity<ErpMember>().Property(s => s.Email).IsRequired().HasMaxLength();
modelBuilder.Entity<ErpMember>().Property(s => s.Moblie).IsRequired().HasMaxLength();
modelBuilder.Entity<ErpMember>().Property(s => s.PassWord).IsRequired().HasMaxLength();
modelBuilder.Entity<ErpMember>().Property(s => s.UserName).IsRequired().HasMaxLength();
modelBuilder.Entity<ErpMember>().Property(s => s.LastIpAddress).HasMaxLength(); //modelBuilder.Entity<ErpMember>().HasMany(b => b.ChildKeys).WithRequired(p => p.Parent);
modelBuilder.Entity<ErpMember>().HasOptional(p => p.Parent).WithMany(p => p.ChildKeys); modelBuilder.Entity<BillLoanApply>().ToTable("BillLoanApply");
modelBuilder.Entity<BillLoanApplyDetail>().ToTable("BillLoanApplyDetail");
modelBuilder.Entity<BillRepayment>().ToTable("BillRepayment");
modelBuilder.Entity<DictEnum>().ToTable("DictEnum");
modelBuilder.Entity<MapSignInTask>().ToTable("MapSignInTask"); // BillLoanApply 贷款申请表
modelBuilder.Entity<BillLoanApply>().ToTable("BillLoanApply");
modelBuilder.Entity<BillLoanApply>().HasKey(b => b.Id);
EF有外键的查询的更多相关文章
- .netcore2.1 ef 使用外键关联查询
//实体类 [Table("invoiceinfo", Schema = "obs")] public class invoice { [Key] public ...
- 基于EF的数据外键关联查询
现在很多ORM不自带外键关联的实体查询,比如我查询用户,用时将关联的角色信息查询出来,那么就要进行2次查询,很麻烦.而我现在要做的就是基于EF的外键关联查询.很方便的. 首先,创建基础查询的BaseS ...
- pythonのsqlalchemy外键关联查询
#!/usr/bin/env python import sqlalchemy from sqlalchemy import create_engine from sqlalchemy.ext.dec ...
- ef core 使用include进行外键连接查询
在entity framework core中,如果两个实体涉及到外键连接,查询的时候默认是只查自身而不会去查询外键表的.如果想要让查询结果包含外键实体,则需要使用include方法来让查询结果包含外 ...
- Django ORM - 001 - 外键表查询主表信息
开始用Django做web开发,我想大家都会遇到同样的问题,那就是如何高效快速的查询需要的数据,MVC都很简单,但是ORM折腾起来就有些费时间,我准备好好研究下Django ORM,所以会有一个系列的 ...
- mysql给表添加外键并查询
CREATE TABLE `heart` ( `heart_ID` ) NOT NULL AUTO_INCREMENT, `heart_name` ) CHARACTER SET utf8 NOT N ...
- hibernate的findByExample 外键参数查询解决方案
用了这么长时间的hibernate/spring,如果不是今天用的findByExample方法到现在还不知道findByExample的机制.惭愧 Class User{String usernam ...
- HIbernate基于外键的查询
此文以个人开发记录为目的,笔拙勿喷 项目是背景是公司的E签宝平台VIP频道项目进行关联账户增加后,需要做删除时的,联合查询 当前主要表结构账户表Account. CREATE TABLE `accou ...
- postgreSQL外键引用查询 查询外键被那些表占用
根据一个表名,查询所有外键引用它的表,以及那些外键的列名key_column_usage(系统列信息表),pg_constraint(系统所有约束表) SELECT x.table_name, x.c ...
随机推荐
- IOS 客户端测试入门.pdf
IOS 客户端测试入门 http://www.open-open.com/doc/view/42d1257bf67946f595e843bfdbdfeabf
- LeetCode_Minimum Path Sum
iven a m x n grid filled with non-negative numbers, find a path from top left to bottom right which ...
- 微软CEO史蒂夫·鲍尔默(Steve Ballmer)在12个月内退休
Microsoft CEO Steve Ballmer to retire within 12 months Aug. 23, 2013 Board of directors initiates su ...
- 响应头location 页面跳转
登陆:http://192.168.32.161/DEVOPS/index.php/Index/do_login Cache-Control no-store, no-cache, must-reva ...
- perl post 请求相关参数
$ua->post( $url, \%form ) $ua->post( $url, \@form ) $ua->post( $url, \%form, $field_name =& ...
- BOT、BT、PPP形式介绍(1)
BOT.BT.PPP形式介绍 BOT1.什么是BOT BOT是英文Build-Operate-Transfer的缩写,即“建设-经营-转让”.实质上是基础设施投资.建设和经营的一种方式,以政府 ...
- 关于static静态
静态属性与方法可以在不实例化类的情况下调用,直接使用类名::方法名的方式进行调用.静态属性不允许对象使用->操作符调用. class Car { private static $speed = ...
- hdu 4983 Goffi and GCD(欧拉函数)
Problem Description Goffi is doing his math homework and he finds an equality on his text book: gcd( ...
- java.lang.NoSuchFieldError: deferredExpression解决
java.lang.NoSuchFieldError: deferredExpression这个问题的出现是在的lib下面有多个版本的jstl.jar包,解决办法很简单,只留下一个版本的jstl ...
- Building bridges_hdu_4584(排序).java
Building bridges Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) ...