Fireasy Development through example learning (previous)

Source: Internet
Author: User

Fireasy has been releasing the new version, but how to use, in the end, it is not good, it is estimated that everyone has such doubts. So, take some time today to introduce the use of fireasy in a simple example step-by-step.

First of all, it is necessary to introduce the component composition of Fireasy:

Fireasy.common public component library, including cache management, log management, serialization, dynamic compilation, extension methods and so on.

Fireasy.data database component library, provide database operation, syntax, batch insert, database framework, etc.

Fireasy.Data.Entity Entity Component library, Ormapper, LINQ parsing, data context, tree entity persistence, and so on.

Fireasy.web Web component libraries, HTTP services, HTML extensions, and more.

Using these components provided by fireasy, we can quickly develop ASP.

OK, let's get started.

I. Build a Web application, install the Fireasy package

Create a new ASP. NET empty Web application, add another class library as the data tier, and have the WebApplication1 project reference the Webapplication1.data project.

Right-click on the WebApplication1 project and select Manage NuGet packages. Search online for Fireasy, then click Install.

Introduce the required JS and CSS files in WebApplication1, JS includes jquery, Easyui and Lhgdialog and so on.

The Webapplication1.data project introduces Fireasy.common, Fireasy.data, and Fireasy.Data.Entity three components from the packages location.

Ii. designing the database and generating the entity model

Design two tables with PowerDesigner and use the Navicat tool to generate a SQLite library, which is stored in the WebApplication1 data directory and created in the library.

Open the Codebuilder, open the PDM file directly, generate the code using the template, Copy the class files and DbContext files from the Model folder to the Webapplication1.data project and copy the files in the page folder to the WebApplication1 project.

Since the Fireasy.portal component is not published, the Fireasy.Portal.Web.Common reference needs to be removed and the Easyuihelper class is missing from the generated code, and the class is used as a Easyui helper, and we create it directly (skip, see Sample Code).

Third, application configuration

To avoid the clutter caused by the Web. config content, we use a separate configuration file specifically for Fireasy. Create a new portal.config configuration file, and use My-config-file in the appsettings section of Web. config to specify a custom profile.

Now, let's describe the contents of the Fireasy configuration in detail:

1 Datainstances DB Instance

You can configure multiple instance, and then switch between different instances by specifying the default property. ProviderType represents the type of provider, you can choose MSSQL (or SQL Server), SQLite, MySQL, Oracle, OLE DB, the following ConnectionString will not have to say, |datadirectory| is the path to the current domain.

2 Bundles Resource Packaging

The advantage of grouping JS and CSS resources is that they are introduced on demand, so a reasonable grouping is required.

Iv. preparations that need to be made

Without the introduction of the Fireasy.portal component, there is also a need to create a Bundlehelper class that reads the above configuration and packages and renders the resources on the page. The System.Web.Optimization component is used in the Bundlehelper class to search for Microsoft.AspNet.Web.Optimization and install it directly in the NuGet manager (you don't know why you're relying on that much).

Add Global.asax in Application_Start to join:

        protected voidApplication_Start (Objectsender, EventArgs e) {            //Resource Packaging ConfigurationBundlehelper.config (); //The default is to use the MEF Export service instead of using the ASPX-corresponding class file as the serviceHttpConfiguration.Default.ServiceFactory =Newasppageservicefactory (); //Configure the routing of the HTTP service, depending on the progression of the sub-directoryHttpconfiguration.maphttproute ("{service}.ajx/{action}"); Httpconfiguration.maphttproute ("{p1}/{service}.ajx/{action}"); Httpconfiguration.maphttproute ("{p1}/{p2}/{service}.ajx/{action}"); Httpconfiguration.maphttproute ("{p1}/{p2}/{p3}/{service}.ajx/{action}"); }

The routing path for the HTTP service is configured here, and in the generated ASPX page you can see that you are using a similar AJAX request.

In addition, you need to copy the System.Data.SQLite component to the bin or install it through NuGet.

OK, pre-preparation work to complete this, click Deptlist.aspx Right button to browse in the browser, see whether the page is out, and then change the URL to deptlist.ajx/getdepts, see can not return JSON data (now or empty data), Look at the WebApplication1 directory there is no Log\error log folder, there is no word that the database is also connected successfully.

I'm sorry, it's too late, I have to talk about this, tomorrow's next article will introduce the specific business function development through the page.

Fireasy Development through example learning (previous)

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.