English 中文(简体)
开始将IList <T>而不是IList <T>送回我的网页 UI /Web 2008?
原标题:Time to start returning IQueryable<T> instead of IList<T> to my Web UI / Web API Layer?

我先提出多层次的申请,从所有数据存取的储存模式开始,然后回到服务部门。 服务层面包括所有业务逻辑,将IList送回主计长(注:Im使用ASP)。 NET MVC for the UI上层。 在数据存取层中可返回的教益是,它使我的储存库非常简单,数据库的查询将推迟。 然而,我触发了我服务层的数据库问询,以便我的单位测试更加可靠,我没有给主计长灵活地重述我的询问。 然而,我最近碰到了几个情况,即推迟向主计长提出询问会大大提高业绩,因为主计长不得不对统一制度的具体数据作一些预测。 此外,随着霍塔等物品的出现,我开始问,最终点(例如,网络名称或网络皮)是否应当与可贵的线索直接合作。 你们的想法是什么? 难道应该从服务层开始恢复信道,回到信道层? 或者与IList结盟?

This thread here: To return IQueryable<T> or not return IQueryable<T> seems to vouch for returning IList to the UI layers, but I was wondering if things are changing because of new emerging technologies and techniques.

最佳回答

我愿尽可能地坚持“可贵的接口”,唯一的问题是,如果你在主计长一级完成复杂的过滤或重新排序,如果你有这样的情况:

//DATA ACCESS
    public IQueryable<T> GetStudents()
    {
    return db.Students;
    }

在你的控制人员中,由于你的客户想要过滤某些有关结果的数据,你做了一些重新捕捉工作,肯定会诱使你在控制人员一级这样做:

var result = obj.GetStudents().Where(d=>d...);

and for me its ok, but just imaging if any other module need to use that same filter, you cant call it because its on the controller level. So for me its a thing of balance between DRY, flexibility, and how scalable is the system. If you need a fully scalable system you will need to do some or several overloads to GetStudents() method and get rid of any re-sharping at the controller level.

问题回答

暂无回答




相关问题
WebForms and ASP.NET MVC co-existence

I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I ve done to make that happen is that I added a namespaces node to the WebForms web.config: <pages ...

Post back complex object from client side

I m using ASP.NET MVC and Entity Framework. I m going to pass a complex entity to the client side and allow the user to modify it, and post it back to the controller. But I don t know how to do that ...

Create an incremental placeholder in NHaml

What I want to reach is a way to add a script and style placeholder in my master. They will include my initial site.css and jquery.js files. Each haml page or partial can then add their own required ...

asp.net mvc automapper parsing

let s say we have something like this public class Person { public string Name {get; set;} public Country Country {get; set;} } public class PersonViewModel { public Person Person {get; ...

structureMap mocks stub help

I have an BLL that does validation on user input then inserts a parent(PorEO) and then inserts children(PorBoxEO). So there are two calls to the same InsertJCDC. One like this=>InsertJCDC(fakePor)...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

热门标签