如图:
组合效果:
LEFT JOIN 效果:
this.HasOptional(t => t.子表) .WithMany(t => t.主表) .HasForeignKey(d => d.关联条件字段); this.Property(t => t.关联条件字段) .HasMaxLength(64);
INNER JOIN 效果:
this.HasRequired(t => t.OrganizationMst) .WithMany(t => t.ObservationRequests) .HasForeignKey(d => d.OrganizationID); this.Property(t => t.关联条件字段) .IsRequired() .HasMaxLength(64);
此外,left join,inner join,left join,left join,order by类似这样的顺序结构SQL语句在MSSQL中使用一条语句要查询10分钟,在百万级数据的基础上,只有全部改为left join或者去掉order by才可以很快,这是为什么,求解