On the good and bad of dynamic soft code generator

Source: Internet
Author: User

Once upon a while, the soft code generator is a very convenient tool, many people engaged in C # language developers have used this tool, of course, including the landlord himself.

The previous development model is centered around the database, first design the database, and then write the code. The dynamic code generator is born in this context.

You just have to design the database schema, and then use the Soft code generator to generate a key data access layer code, very convenient. (Although the soft has business layer, but I think that is chicken, but it is a layer of data access layer of simple packaging, no practical significance)

This is very appealing to developers who don't want to write tedious database operations manually.

Under the landlord by virtue of their own experience, from the good and bad two aspects to summarize the dynamic soft code generator.

Advantages

First, the entity class and data access code are generated automatically.

Second, most of the database operations can be met, including paging

Third, rapid development

Disadvantage

First, the generated entity class is lack of correlation, and most of the actual projects need to navigate

Second, the lack of database transaction support, all operations are single-table

Third, for some types of support is not good, such as date and the new DateTimeOffset

Iv. the data being queried is based on datasets rather than entities, which makes people feel strange

Five, the database structure changes will be manually generated code, if you modify the soft generated files, then wait to cry.

Six, does not support the generation of the database from code.

It field has a very famous motto: No silver bullet. There is no once and for all solution, no elixir. The code generator is not a silver bullet. Many years ago, I heard a saying that code generators can replace developers.

There are two reasons for this: one, your developer sucks, it's about the code generator, two, your product sucks, and you can do it with code generators. Whatever the reason, the person who said it sucks, haha!

With the rapid development of it technology, there are many excellent tools to replace the code generator. Landlord is to do. NET, to everyone recommend a few good tools, know the right when swim, do not know as learning.

Microsoft's entity Framework, followed by NHibernate. The Entity framework is Microsoft's pro-son, and Microsoft's own SQL Server is well integrated. NHibernate is open source, support database is more, portability is good.

If you don't like these heavyweight frameworks, consider using Ibatis and dapper. Just the landlord, if you can choose, I will consider using the Entity Framework and LINQ. LINQ was so awesome that I had to admire Microsoft.

On the good and bad of dynamic soft code generator

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.