NBearV3 Tutorial--MVP (model/view/presenter) Chapter

Source: Internet
Author: User
Tags zip

Version

1.1 [2007-2-12]

Brief introduction

This tutorial demonstrates how to implement the Nbear-based IOC MVP model based on the NBEARV3 MVP module, based on the--IOC chapter of the NBearV3 step through step tutorial. You will see that using the NBEAR.MVP module, which encapsulates the Nbear IOC module, can not only greatly enhance the testability of the system's presentation layer, but also take full advantage of the Nbear's existing IOC modules to gain dependency injection capability and distributed service support based on IOC.

Note: Before reading this article, it is recommended that readers read the NBearV3 step by step tutorial--ioc to master the basics of ORM and IOC in NBearV3.

Goal

Through this tutorial, readers should be able to fully grasp the use of NBEARV3 MVP module to achieve the performance Layer MVP mode.

Code

This tutorial shows all the projects and code you created, contained in the Tutorials\mvp_tutorial directory in the NBearV3 latest source code ZIP package that you can download from nbear.org. Therefore, if you have any questions in the course of using this tutorial, you can refer to the code directly.

Time

<45 minutes.

Body

Step 1 Download the latest version of NBEARV3 and prepare

1.1 Access to http://nbear.org, download the latest version of NBearV3 to the local directory.

1.2 Extract the downloaded zip file to C:\, you will see that the NBearV3 directory after the compression includes: Dist, doc, cases, SRC, tutorials directory. In this tutorial, you will use the IOC basic tutorials in all releases of the compiled versions of DLLs and EXE and tutorials directories in the Dist directory.

1.3 Copy the entire ioc_tutorial directory in the tutorials directory to any other location and name it mvp_tutorial, and we will be ioc_tutorial based on the knowledge of the IOC based distributed development in NBearV3.

Step 2 defines view and presenter

2.1 Rename the Ioc_tutorial.sln in mvp_tutorial to Mvp_tutorial.sln and open in the VS2005 development environment.

2.2 We know the MVP model, there are model, view and presenter three parts. In NBEAR.MVP, in the Model section, we use the NBEAR.IOC service directly, so for the original IOC tutorial code, we just need to define the view and presenter code extra. In order to fully decouple the M, V, p three parts, we will use interface, paradigm and IOC technology.

2.3 Adds a class library project named Viewinterfaces to SLn. Add the project to the Dist\nbear.common.dll and entities engineering references. Add a ISampleView.cs file to the viewinterfaces that contains the following:

1using System;
2using Entities;
3
4namespace ViewInterfaces
5{
6  public interface ISampleView
7  {
8    int CategoryID { get; }
9    Category[] Categories { set; }
10    Product[] ProductsInCategory { set; }
11  }
12}

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.