예제 #1
0
    public static IDb4oLinqQuery <TObjectType> ObjectByID <TObjectType, TIdType>(this IObjectContainer db,
                                                                                 Expression <Func <TObjectType, TIdType> > idPath,
                                                                                 params TIdType[] ids)
    {
        if (0 == ids.Length)
        {
            return(db.Cast <TObjectType>().Where(o => false));
        }
        var orCondition = BuildOrChain(ids, idPath);
        var whereClause = Expression.Lambda(orCondition, idPath.Parameters.ToArray());

        return(db.Cast <TObjectType>().Where((Expression <Func <TObjectType, bool> >)whereClause));
    }