My development framework: ORM framework, developed orm framework
Today, I would like to share with you my own ORM framework. Although it is not very good, I personally think it is quite useful.
First, let's talk about some of my views on the mainstream ORM frameworks:
Advantages:
Disadvantages:
I have never been optimistic about these ORM frameworks, so I write more disadvantages. I may not know some advantages. If someone passing by knows, I can leave a message and I will make up for it.
Now let's talk about my own ORM framework. It is called the ORM framework because it has also achieved several advantages of the above ORM framework.
First, based on the image data operation layer, I wrote a set of methods for database operations based on ADO. NET. DbHelper
Then I developed the abstract data operation Engine Based on this DbHelper, and expanded the support for different databases. Here only mysql and MSSQL are displayed, and ACCESS all supports ADO.. NET databases can be extended.
After doing so, my framework will be able to achieve database independence. I can use any database or even hybrid database.
Now let's talk about how to develop SQL statements quickly and avoid programmers from paying attention to SQL statements.
For programmers, there is nothing more direct than reading code. I will show you the code first:
The addition, deletion, modification, and query methods are demonstrated here. First, I did not write an SQL statement or an ORM statement. The writing method should be more intuitive. Our data model has been extended, attributes are added to all fields.
If I want to set the value of a field, I will set its IsValue to true. If I want to query a field, I will set its IsColume to true, I personally understand that this method is closer to the idea of OOP and easier to understand. At least I am bringing new people to get started quickly and there is almost no pressure on them.
This also avoids Junior programmers from writing SQL statements at will. It also facilitates maintenance and management, and supports fast development. The most important thing is high performance, because I have no reflection, you do not need to translate ORM statements into SQL statements. You can also customize to query only some fields (it seems that some ORM cannot achieve this effect ).
Some people may say that your entity model must be very complicated. It may take a long time to write this statement. In fact, this sentence is half correct, because the entity model is indeed complicated, but it does not take time, as I mentioned in my previous blog, all my entity models are automatically generated and do not require manual operations, including my data layer code, it is indeed very complicated, but it does not need to be manually processed. It can be used directly after being generated in one step.
Now, I will introduce the details of my framework. I will introduce it in detail later. If you are interested, please take a look. We also welcome your valuable comments on my framework.