Introduce composite Web Application Block in SharePoint Development

Source: Internet
Author: User

Composite Web Application Block is a framework used to develop Web applications in the Web Client software factory. It can helpProgramMembers can use the MVP mode more conveniently. For more information about cwab, see here.

When developing the SharePoint interface, for example, creating a Web part, you can introduce cwab if you want to use the MVP mode. This document explains how to use cwab in Sharepoint, but some steps in this document are not necessarily the best. For example, the document tells you to put each assembly in the/bin directory of the Web application, but I suggest deploying them in the GAC, you do not need to change the web of the Web application. <trust> node in config, SetCodeThe default trust level is increased.

Well, in short, we can use cwab to easily develop Web parts based on the MVP mode, as shown in the project structure:

"Kbsample. siteuser. Module" in is a module project in cwab, which contains the business module separated from the UI. The "views" directory contains the interface defining the view and presenter class:

The "services" directory contains service classes related to business operations:

"Kbsample. siteuser is a dedicated SharePoint Project (you can choose to use vsewss or other tools you are used to), which includes the view implementation used to define the Web Part interface.

The following service interface defines a service used to interact with the SharePoint object model to obtain data:

When the module is initialized, register the above service to the container:

View Interface Definition:

In the presenter, [servicedependency] is used to inject the dependent service object (cwab uses objectbuilder To Do This) and define the operation when the view is loaded:

View is implemented through a user control, which implements the View Interface and injects a new presenter object through [createnew:

Do not forget to execute the Loading Method in presenter when the view is loaded:

If you are familiar with Web client software factory, it is not difficult to introduce cwab in SharePoint development. However, templates and recipe provided by wcsf cannot be used. The project structure needs to be manually maintained (which gives us a lot of Freedom :).

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.