Learning O/RM, starting with the simplest example... 4th

Source: Internet
Author: User
Previous articles:
Learning O/RM, starting from the simplest example...
Learn O/RM, starting from the simplest example... 2
Learn O/RM, starting from the simplest example... 3. For the latest Demo, see the end.

Learn about O/RM, and start with the simplest example. 4. Download the code generation tool and the latest Demo.

After downloading the code generation tool, you can refer to the Demo example to see how to use it, because the tool is not fully prepared yet.

After more than a week, I finally completed the code generation tool supporting this "simplest O/RM example. You may encounter problems when only some simple functions are completed, the interface is unfriendly, and some buttons are invalid.

First, let's briefly introduce the function of the Automatic Generation Tool for this Code:

· Connecting to the database is indispensable first. Haha, this is not a function.

· Lists all tables and views of the selected database. The tree structure is displayed. If all databases are displayed, the speed is slow and there is no need to do so. Therefore, you can select a specific database.

· Generate the corresponding ing file- ing file format based on the selected data table or view. You can see the xml file in the latest Demo (under App_Data ).

· Generate the simplest stored procedure. Of course, you have not checked whether the stored procedure exists. These are not the focus of this tool. They include... or later extensions.

· Five files with DAL are provided. Right, there are five files. This is the biggest highlight of this "simplest O/RM example. No matter how many entity classes and how many Insert and Select operations you have, all these five files will help you solve the problem (how does it sound like advertising words? :)) Well, it looks like it's amazing. Of course, if the business is complicated, you still need to make minor changes, but the flexibility is great.

· The BLL layer class comes with a class file: ObjectStore. cs, which is the parent class of all object operation classes. It is implemented using the model. It is the rooma avenue leading to DAL :). In addition, it also supports generating BLL-layer entity operation classes (for this reason, I really don't know what to name it, such as the Employee class, which contains Insert, Update, and other operations, see the Demo)

· Entity class generation at the Model layer. If this is not mentioned, it's easy to get home. However, this feature remains to be improved. For example, currently, all object classes are generated based on data tables. A field corresponds to an attribute, and the relationship between classes is completely invisible. (Currently, the code generation tools I have used do not seem to have this function available. I hope you can tell me) For example, the Employee in the Demo inherits from the Person and is associated with the Department. However, the currently generated code is not reflected. In our actual project, in line with the OO principle, we must modify the code so that the corresponding entity class (DepartmentInfo) of the Department table is) become an attribute (member) of the EmployeeInfo table ). These will be implemented in the next version. I have discovered that the built-in Stored Procedure (sp_fkeys) can help me implement my ideas.

· Last function: generate a solution! Haha, the most promising feature, but I regret to tell you that I have automatically generated the corresponding directory structure and class files and ing files. There is no complete solution similar to "using VS2005 to manually create a website. On the one hand, there is no similar experience. On the other hand, when the Spring Festival arrives, I will go back to my hometown for the New Year. Today is the last day of this year to work in the company. Although I can access the Internet after going home, there is no programming environment, poor...

· Finally, we provide this simple code generation tool and a Demo of the latest version (which contains almost all possible business needs)

· Click to download the code generation tool ORMSupport: http://files.cnblogs.com/lxinxuan/ORMSupport.rar (time is too urgent, not even made into the installer, decompress and run ORMSupport directly. exe, this code has no technical content. For rapid development, the code is very "procedural", so it should not be disclosed, so that RP will not be reduced)

· Click to download the latest version Demo example: http://files.cnblogs.com/lxinxuan/ORM%20V0.2.2.rar (updated on February 2)

I hope you can give me some suggestions. If you have any ideas, please let me know. Thank you. Code clutter, hope not to make you uncomfortable too much :)
I also hope that the experts in the garden will give me some advice. I have very few such opportunities. Thank you!

The Chinese New Year is approaching. Next time I write a blog, it is estimated that it will be over the Spring Festival next year. During the holidays, I will still view the latest developments in garden and learn more about Update Technologies.

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.