Now, the. NET or framework, we agree with a variety of large and small, ef,subsonic,nhibernate, and even small petapoco this, but used the people I think they consider is more.
The smaller Petapoco also have thousands of lines of code.
Some of them are difficult to configure, or they can't get out of SQL,
And I've been looking for a simpler way to streamline my development and make it easier to manipulate data.
Due to the recent use of MySQL, while MySQL uses the Myism engine and the InnoDB engine, because the InnoDB engine supports a broader, transactional, and so on, although the character index may be less myism, but the use is necessary.
I started to write a small or type.
The concrete realization idea is Knock out converter.
In the previous article, I personally think that the idea of software OO is to minimize the input configuration and optimize the simplification and reconstruction of OO methods.
We all know that in the development, the received data is often a string type, if using webservice,wcf,remoting and other remote interface, the method is directly the entity, but in collaboration with the database often need to be the model type in parameter Specifies the type of database that the. NET Framework actually has is a infertype, that is, when manipulating data, not specifying a database type, just adding prametername and value, you can manipulate the library directly, The validation of data types in the context of the library's operations also eliminates the hassle of typing on the program, which is, of course, a trickery approach, but is the simplest and easiest to manipulate.
This is also the core part of the or tool I wrote myself.
Thought is still "convention greater than configuration", assuming that the table default contains the ID primary key, auto-growth, the single table name and the entity name lowercase relative, then we can construct the corresponding library table operation statement according to these conventions.
For SQL injection, we all know that parameter is often re-coding parameters to some extent anti-injection, so we can also construct the corresponding SqlParameter, through the factory and abstract SqlHelper, The concrete sqlhelper is injected into the operation class to implement the unified operation of the various libraries. This makes it possible to implement a single-table ORM.
For the character length and so on can be implemented according to Ef,subsonic, add attributes, limit the character length, set the primary key column, if there is no keycolumn, the default convention with the ID column
I personally think that if you add a character length to the entity, the data type and validation of regular expression, you can generate direct SQL directly from the entity, then you can implement code first, but DB first is often the way we use it more, so, The extension can be so realized, and the principle is this, ORM is the basic idea.