2 つのエンティティの拡張メソッドを作成しようとしています。
最初にオブジェクトのタイプを見つけてから、inner join
別のテーブルで実行します。
A型Join
ならBと一緒、B型ならAと合流Join
。
public static C GetAllInfo<T>(this IQueryable<T> objCust)
{
if (typeof(T) == typeof(B))
{
//prepare the Object based on the Type
var objCastReg = objCust as IQueryable<B>;
//how to write join here ?????
var objUsermaster=objCastReg.GroupJoin(A,um=>um.UserId,r=>r.)
//Build the Class object from two retrieved objects.
}
if (typeof(T) == typeof(A))
{
var objCast = objCust as IQueryable<A>;
}
return null;
}
public class C
{
public A A{ get; set; }
public B B{ get; set; }
}