之前4.1 ,杠杠的,升级成6.1 left outer 失效,用的sql server profiler跟踪,变成inner join
public class CorpMember
{
public int? CMCID { get; set; }
public virtual CorpMemberCategory category{ get; set; }
}
Dbcontext:
modelBuilder.Entity<CorpMemberCategory>().HasMany(a => a.corpmembers).WithRequired(p => p.category);
modelBuilder.Entity<CorpMember>().HasRequired(a => a.category).WithMany().HasForeignKey(a => a.CMCID);
使用可为空的外键即可实现left 效果,升级成6.1 直接变成inner join
有没哪位大侠遇到过,怎么解决的啊?
4.1没问题,
from e in mySet.Where(specification.SatisfiedBy())
join cate in base.DataContext.CorpMemberCategory on e.CMCID equals cate.CMCID into catelist
from cc in catelist.DefaultIfEmpty()
或 直接用导航属性
from e in mySet.Where(specification.SatisfiedBy())
select new { e.Address, e.category.CateName
都没问题
6.1就出问题了,该怎么设置呢?
谢谢
http://entityframework.codeplex.com/workitem/2656