Spring.net+nhibenate+asp.net MVC +extjs Series 5----asp.net Mvc+extjs

Source: Internet
Author: User
Tags json

In the previous series, we have completed the database design, data access, and business logic, and then we'll complete the front desk MVC and ExtJS interface sections.

During this time, Spring.net has released version 1.2, asp.net mvc has also been updated to RC1 refresh.nhibernate update to 2.0. The entire demo program has also been updated accordingly.

The entire architecture from ASP.net mvc to the background of the business and the foreground interface, in controller invoke business logic to complete the front call, complete the corresponding view forwarding and so on. There are two questions:

How does controller invoke the business logic?

It is best not to invoke the business logic object directly, according to the interface-oriented programming principle, here the IOC dependency injection function is used to inject the actual business object into the controller, so that in the controller, it is only for the business interface programming, but not for the specific implementation. If two development has been modified, Just add the corresponding business logic implementation and modify the configuration file.

Do you use NHibernate entity objects directly in the controller?

NHibernate's entity objects contain many complex one-to-many, many-to-many mappings, which can easily result in recursive calls, and many attributes are added for programmatic purposes only. Developers who do not need other layers to know. and NHibernate complex entity objects are not easy to serialize, often resulting in circular references, if the use of lazy loading may also cause session shutdown problem.

So here is a DTO (Data Transfer object) that is used to convert to and from the back-end business objects. Because of the ExtJS client, the foreground uses the JSON object, which completes the conversion of the JSON and the DTO to each other. Then complete the conversion of the DTO and nhibernate entities.

Let's take user users as an example to complete the Control Layer section.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.