开发短期的基于 Web 的数据输入 UI
假设您必须快速构建一个在 Web 浏览器中工作的数据输入 UI,它必须与业务层交互,业务层必须与数据层交互。
您只想连接到业务对象,而不是直接连接到数据库。
大多数 UI 视图都是简单的 CRUD 操作,编辑/更新发生在网格内。
但有些屏幕会更复杂,代表多对多关系。
在 ASP.NET 中实现此目的最快的方法是什么?
(注:开发速度优先,代码质量和可重用性优先。)
Say you had to quickly build a data-entry UI that works in a web browser, which must interface with a business layer, which must interface with a data layer.
You want to connect only to business objects, not directly to the database.
Most of the views of the UI will be simple CRUD operations, with edit/update happening within a grid.
But some of the screens will be more complex, representing many-to-many relationships.
What's the fastest way to achieve this in ASP.NET?
(Note: speed of development is high priority, code quality and re-usability are low priority.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
实体框架 + ASP.NET 动态数据?
Entity Framework + ASP.NET Dynamic Data?
如果开发速度是首要任务,那么就使用您所知道的。
例如,如果您知道 ado.net/enterprise 库,那么就使用它。如果您了解实体框架或 LINQ,那么就走这条路。
如果没有对您的技能进行总结,任何人都不可能告诉您启动和运行某些东西的最快方法。
If speed of development is the main priority, then go with what you know.
For example, if you know ado.net/enterprise library then go with that. If you know Entity Framework or LINQ, then go that route.
Without a summary of your skills, it's going to be impossible for anyone to tell you the fastest way to get something up and running.
我给我的公司写了很多这样的小商业编辑器,都是同样的方式,让它快速发挥作用,如果用到了或者需要改进,我稍后再处理。
启动一个新的 ASP.NET 项目。将类库添加到解决方案并从 asp.net 应用程序引用它。
Asp.Net 应用程序
类库
I've written a lot of little business editors like this for my company in the same manner, get it to work quickly, if it's used or needs to be improved, I deal with that later.
Start up a new asp.net project. Add a class library to the solution and reference it from the asp.net application.
Asp.Net Application
Class Library
为了简单起见,您可以使用一些经过时间考验的控件和对象:
用户界面层:GridView 用于显示和提供用于编辑和删除数据的链接。单击“编辑”链接可能会打开一个新的 Asp.net 网页,其中包含用于插入和更新记录的 FormView。使用 ObjectDataSource 链接业务逻辑层的方法以创建/读取/更新/删除记录。
业务逻辑层:除了创建 CRUD 方法之外,您可能还需要使用轻量级可序列化数据传输对象在不同层之间传递数据,并使用自定义映射器将数据从其他层传输到其他层。
数据访问层:Linq to Sql 可以使数据访问和操作快速、轻松。
数据访问
To make it simple, you could use the some of the time tested controls and objects:
User Interface Layer: GridView for displaying and providing links for editing and deleting data. Clicking on Edit link may open up a new Asp.net web page that holds FormView for inserting and updating records. Use ObjectDataSource to link methods at the Business Logic Layer to Create/Read/Update/Delete records.
Business Logic Layer: Apart from creating CRUD methods, you might need to use light weight serializable data transfer objects to pass data between different layers and a custom mapper to trnaslate data from and to other layers.
Data Access Layer: Linq to Sql might make the data access and manipulation quick and easy.
这取决于应用程序的复杂性。我会选择 Linq to Sql。但是使用 Linq to Sql 并不需要在业务层和数据访问层之间提供良好的抽象。但我发现使用 Linq to Sql 可以快速从存储中检索数据并将其显示在屏幕上。
另外,如果您想要快速的用户界面,请查看动态数据网站。它还使用 Linq to Sql 或实体框架。
你必须思考的一个问题是,你是否需要好的设计或 RAD。
It depends on the complexity of the application. I would go with Linq to Sql. But then using Linq to Sql does not necessary provide a good abstraction between the business layer and the data access layer. But I find that using Linq to Sql you can quickly retrieve the data out of the storage and display it on the screen.
Also, if you want fast UI then take a look at dynamic data website. That also uses Linq to Sql or Entity Framework.
One question you must think is that if you need good design or RAD.