How to quickly build your enterprise application through agileeas. Net (1) -- how to build a solution

Source: Internet
Author: User

The main purpose of this series is to make a. netProgramDevelopers can quickly and professionally build their own. NET Enterprise applications by using the SOP middleware provided by the platform. I will begin with the composition of the EAS framework and the establishment of the solution. The ultimate goal is to provide a solution for connecting to the database through distributed communication, as a summary and summary of my previous achievements in the blog community and my learning experience.

1. Preparations

First of all, you certainly need to download the latest agileeas. NET development package, which looks like MB and will soon be ready. Let's take a look at the content:

The following describes what each folder is: (the outermost part is the release Step written by Li Ge. If you want to see how to release the folder, please download it and then Alt + F4)

Agilelab. CN is a case of using agileeas to develop a web platform. The content is the official website of agileeas. Because I am focusing on the winform solution of CS architecture, pass

Appserver, this is very important. This will be the only and most important content you put on your server, whether the configuration is correct or not will directly affect your ability to implement distributed communication and automatic update of smartupdate. Please put it in a safe place and save it for backup.

Bin, like the above, can be understood as this folder will host your client, it can also be said that it is the place where your project debugging, release, and other functions are implemented, the content is composed of all dependent DLL files and SOP middleware (quick development tools). Likewise, it will be useful after backup.

The data and EAS platforms need a database to support their normal operations. log on to your server and execute corresponding SQL statements in your database, after an eas basic database is created, nothing is available here (recovery is not counted ...), The database content is nothing more than some accounts, roles, permissions, menus, procedures, approval, modules, and so on. The EAS platform uses modular loading methods here, that is, in the end, all the winform pages (usercontrol) You developed will be referenced and loaded by the platform in the form of modules. Therefore, your reference assembly must be centralized in a unified location, where? I didn't have a backup folder for Bin just now.

DLL, please ignore

The documents are detailed descriptions of drug store system cases. The details are terrible. If you want to use drugshop as a learning reference, please study it carefully, many of the cases and skills used in this article are summarized through drugshop learning. If you cannot understand them, congratulations. Come back and continue.

Drugshop-Src: source code of the pharmacy system. The reference value is 100 million.

WF. Demo, just ignore the following (I did it)

2. Create a project

After learning about the content of the package, we need to build our own case. First of all, believe me. In order to save your mind in the future, please follow the illustration below to create your project composition:

Find a comfortable place to create your own solution based on the above figure. ironmes is my own project. You can do it yourself, but there is something in the source code folder, right? Otherwise, it would be difficult to establish a simple project quickly. For the sake of convenience, the case will be explained by the solution in my project, skip steps are inevitable in the middle. Please forgive me!

First, open the bin folder -- dotnet4.0 (Silverlight ignores it) and find such an object. This is called the ORM designer. The function is to use a database (usually a database) create an object class library that carries all the crud operations on the data table. You are not mistaken. Through EAS, all crud operations can be directly obtained from the object class, it allows you to focus more time and energy on the conception and design of complex businesses.

Open the ORM designer and it doesn't matter if everything comes up. Click the tool-generate from the database,

What kind of intimacy do you see? Isn't it when we draw a report in vs to create a dataset?Select sql2005 (an error will be reported when I use 2008 ),Write your link string for speed. Next Step

Select the data table you need here (you can select a view, but you cannot add, delete, or modify an object class produced by the view). Then, next,PS: To take care of the versatility of data, EAS uses the string format when processing guids. Therefore, if you use uid in the MSSQL database, change it to varchar (36) create your own ORM class library!

Data Tables are usually created as your project progresses. Therefore, the SDM file saved by the ORM generator must exist in the sdms folder for ease of management, finally, your SDM should be like this.

Ignore the words "model" below.

Let's open an object class. Let's take a look.

The content is similar to what we saw when creating a database table.CodeThe DDL and document tabs correspond to the item content of the data table structure. You can click it to understand it. The document is very convenient for you to use when writing the database manual, of course, careful friends can change the "title" column to the Chinese DESC of the corresponding field. I have never changed this lazy one... Remember to save the changes.

Next, right-click the "solution" node to set the basic parameters of the project, this must be consistent with your own project (if there is no project, it is easy to master it). The standard namespace can save you the time to modify it later.

You can see that all the output code in the data directory is put in the assets folder for sorting, so it is easier to find out when necessary.

After setting, right-click the "solution" node to generate the code and the generated code folder.

Copy the entities folder to the folder where the source code is stored at the beginning, and create an empty solution or other solution to add the project to the solution to form such an effect.

Okay... I admit that I am lazy. This is my current project. You can see that the red circle is the class library. The structure of this solution is the same as that of drugshop, this structure is the standard structure built by the EAS project. Now, let's take a look at the composition and functions of these projects (ironmes), and the services above ....

Bll. contract this is an interface class library, which is detailed during distributed communication.

Bll. Host service class library, inherited interface, distributed communication details,I personally think it is not necessary to use servicecontainer to implement database services without using distributed communication.(For details about what servicecontainer is ...)

Entities is the core. The EAS object class library can directly implement the insert (), update (), and delete () methods through these object class libraries synchronized with the database.

Entities. XXX: different entity classes generated by connecting to different databases (easy to manage)

Asposeexceltools is an operation class for exporting EXCEL reports... Aspose. Cell is very useful)

------------------------------- Client line ------------------------------------------------------------

Appstart. This is the startup Item. Why? Because in the appconfig file, I will configure the database connection method as direct connection to the database,Direct database connection is easier for debugging.

Hellowang is tested, please ignore

Main, this project is the startup project of the client. You can use this as a shortcut on the desktop when creating the setup installation package. Why? Like appstart, appconfig uses distributed communication... Can be deleted without distributed Communication

Res, this project is purely copied from drugshop. Its unique significance (extremely important) is to replace the logon interface, icons, bottom entries, and so on in agileeas... You must change it... After the change, I forgot to remind me.

Winui: It carries all the UI modules, interface services, and is also the most important part. The following describes how to create our UI module.

WPF disregard

----------------------------- Nonsense ---------------------------------------------------------

PS: important. The outputpath of all projects must point .. \.. \ bin \ dotnet4.0 \ directory, right, that is, the prepared bin folder (the purpose is that all DLL files are available directly after being published in one folder ),

3. Create a standardized Module Interface

Next, the key is how to quickly create a UI through the SDM file. If you do not understand the description here, the PDF in the official package also provides a detailed description.

Find this in the bin folder and find two directories on the right:

The list shows the main interface for querying table data, that is, usercontrol in winform. In the form, the Details window corresponding to each data record corresponds to window in winform,Open your SDM file here (the one you saved with the orm designer ),Right-click the "list" node and choose "CREATE". All the data tables you added to the entities are displayed. Find the data table you want to perform the crud Service (only one can be selected ), click Next:

This interface is used to design the UI to be queried. Normally, all fields need to be displayed. Right-click the interface and select all, the following query item is used to identify which fields will appear as the where condition in the LINQ query. Of course, the corresponding condition data control will also appear on the interface, PS: if the type of the conditional input control is not Textbox, You need to select the type of the control in "space type", which is commonly used in drop-down boxes, time and date (do not use the year, month, or date without explanation ).

The added interface designer is as follows:

The interface designer is the same as the interface designer in Vs, And the use method is the same. Besides the necessary name repair and IRD field modification, other suggestions are modified after adding the module to.

Right-click the "window" node and choose "New" from the shortcut menu. Select the same data table entity. The page is as follows:

The trick here is not to display the primary key auto-increment and record time, UID and other information that you do not need to manually enter (except for special requirements), whether to add or display synchronization, since we have previously set parameters for this SMD file, it is important not to modify the namespace when creating the page to maintain the consistency of the namespaces of different modules of each project.For data tables with many fields, you can select multiple columns in multiple rows to set the required columns.The final window effect is as follows:

After several basic interfaces and form interfaces are designed, our SDM file is like the following (list and editor do not have to match one by one. You can see your own requirements, for example, if I have a View query interface, the corresponding editor is not required)

4. Import the code into the solution

Right-click the project root node of the uidesigner to generate a solution. Let's take a look at the solution structure we have produced.

Entities contains the object class library project, winui contains the UI interface layer project, copy the CS file in the UI to the directory corresponding to your project, double-click the project to view it (Vs will automatically prompt to convert it to usercontrol and window ):

The second and third attributes of module are the names and descriptions respectively. The names will be displayed in the menu after adding modules on the EAS platform.

Here, I have made too many statements about the code modification on the UI interface, and the bugs in some middleware generation are very easy to modify (similar to multiple = ah, datetime written as datetime and so on ), the key is to change the datetimepiker name in the uidesigner... (Nagging)

In this way, a query interface corresponds to a single sheet editing interface combination. Next is the first scene. You have to debug it.

5. How to debug

First of all, let's look back at the composition of my project. There are two key projects, appstart and Main, in the middle. What I think is the same thing is that appconfig is different, right, please copy this to your project in drugshop .... (Res can be copied together if necessary, but this article won't explain how to change res.) read the code and change the connection string directly connected to the database in it to what you need:

Set appstart as the startup Item for debugging ....

Can you see the comment? You can directly enter the debugging mode after writing your project name. If you write the following code, you will start the login interface of the platform and log on to the platform.

6. Module installation and menu settings

There is nothing to say about this. After logging on to the system, choose System Management> module Management> Installation. Find the winui. dll file that hosts your module in Bin/dotnet4.0. Is there your module? If I really don't understand what he wrote in the instruction documents of the pharmacy system, I will understand it. I won't repeat this item here.

As the EAS platform has already designed user permissions and role settings, we only need to bind the module according to the corresponding permissions to implement permission management. This is really convenient .....

This is probably the case... It seems that many of these are actually sequential accounts. I feel a little disappointed when typing and typing .... I have no rules to write, but I should have pointed out some problems. I hope that my later comrades will not take a detour. If you have any questions, follow up or contact me directly, I hope more people can develop more excellent products through such a free platform. This is the first step...There is no rule in writing. Sorry!

If you forget to add a reference, it is easy to add a reference. In bin/dotnet4.0, first, EAS is added to all eas-related projects. data and microkernal are the two foundations. You can add what you need at the interface layer. We recommend that you add them based on the cases of the pharmacy system, of course, do not forget to add references between projects. There is nothing to say about this. The UI should reference entities and so on.

In this case, you should be able to build a simple solution. Next time you will talk about how to modify res to customize your own icon logon box and welcome interface, or the content of distributed communication.

BTW, you can wait for the next version (the functions are constantly improving), or contact the agile EAS platform development team for technical support!

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.