Esempio n. 1
0
        public static T Load <T>(this T source, EntityContext context, params Expression <Func <T, object> >[] includedFields)
            where T : class, IEntity, new()
        {
            var whereClause = GetIdentityWhereClause(source);

            context.CreateQuery <T>().LoadRelated(includedFields).Where(whereClause).ToArray();
            return(source);
        }
Esempio n. 2
0
        public static T LoadInCollection <T, TCollection>(this T source, EntityContext context,
                                                          Expression <Func <T, IEnumerable <TCollection> > > collectionSelector, params Expression <Func <TCollection, object> >[] includedFields)
            where T : class, IModelEntity, new()
        {
            var whereClause = GetIdentityWhereClause(source);

            context.CreateQuery <T>().LoadRelatedInCollection(collectionSelector, includedFields).Where(whereClause).ToArray();
            return(source);
        }