1

probably you have a solution. First of all its just a thought of mine, but I guess we will run in some problems in the future: We have a businessfacade, which handles the context call with an filter expression, let's say this:

    List<INDIVIDUAL> IIndividual.GetIndividuals(Expression<Func<INDIVIDUAL, bool>> filterExpression)
    {
        List<INDIVIDUAL> result = null;
        this.FacadeAction(ctx =>
            {
                result = (filterExpression != null
                              ? ctx.INDIVIDUALs.Where(filterExpression)
                              : ctx.INDIVIDUALs).ToList();
                result.StartTracking();
            });
        return result;
    }

Nothing to special: if there is a expression, get all individuals with this filter, otherwise return all. The problem now: I wanna include another table for ONE case. So my thoughts: There should be an optional parameter, which I can add tables I wanna include with. So I dont need x functions for the same entitiyset but can dynamically add all the tables I want to include.

Do you think something like this is possible? Does this even makes sense? Or is it better to call the facade for each entitiy I need?

Thanks for your response!

Matthias Müller

4

1 回答 1

1

每次您需要数据库时,我都会直接调用实体框架,而不是使用外观。否则你最终会添加 Order, Take 函数作为参数,你的小方法最终会变得越来越大。

只是感兴趣,你为什么还要使用 Facade?将来您更改数据访问层是否会发生一些变化?

于 2013-09-11T06:35:49.983 回答