CRL is an object-oriented lightweight ORM business framework
Object/Data ing is used for data processing, and conditional queries are expressed using lambda expressions. This increases the programmability and reliability, reduces the error rate, and supports native SQL queries or operations.
Data connections are configured programmatically and support multiple libraries. See the implementation in global. asax. Change the data connection in localsqlhelper. createdbhelper for the first time.
Business reuse is achieved through encapsulation and Inheritance of business objects. Common packages include: Member/account system, Dictionary configuration, classification system, online payment, order/shopping cart, permission verification/menu system, etc. Of course, you can also write your own business encapsulation.
Efficiency problem: cache processing is performed on Object ing, and the query efficiency is almost the same as that of handwritten SQL. Note: The default query efficiency for CRL objects is with (nolock)
Data security: All standard queries are parameterized and there is no risk of injection.
Dynamic stored procedures support and query conversion, greatly reducing database maintenance and increasing development efficiency
Log binding: an error occurs when data is operated through CRl. A corresponding error log is generated, including the executed statements and parameters.
CRL depends on corehelper. dll. This dll is a function library, including data access, logs, and other functions.
Detailed examples of features:
-
- Expression QueryConverts an expression query to an equivalent SQL syntax, for example:
VaR order = ordermanage. instance. queryitem (B => B. ID = 1 & B. userid = 2 );
Equivalent
Select * from order where id = 1 and userid = 2
The same is true for update and deletion.
- Automatic Creation of object tablesThe first call will automatically create the table corresponding to the object, which does not need to be maintained from the database, or can be programmed to check the table structure
-
- Cache bindingAny basic query can be used for data caching. After the expiration time is set, the cache is automatically updated, or the current object data cache var query = code is directly created. productdatamanage. instance. getlamadaquery (); // complete Query
Query = query. Where (B => B. ID <700 );
Int exp = 10; // expiration minutes
VaR list = code. productdatamanage. instance. querylist (query, exp); // return a query cache with different conditions and different caches.
Call object data cache
VaR list = code. productdatamanage. instance. queryfromallcache (B => B. ID <700); // search
- dynamic compilation (MSSQL only) automatically compiles any query, update, or delete operations into equivalent database stored procedures, greatly improve the running efficiency
var query = code. productdatamanage. instance. getlamadaquery ();
query = query. where (B => B. ID <700);
string name = request ["name"];
query = query. where (B => B. interfaceuser = Name);
var list = code. productdatamanage. instance. querylist (query, compilesp: True);
an equivalent stored procedure is created and called.
Create procedure [DBO]. [zautosp_6b517ff62bde99e6] (@ id0 nvarchar (500), @ interfaceuser1 nvarchar (500) as set nocount on select T1. [addtime], T1. [barcode], T1. [categoryname], t1. [ID], T1. [interfaceuser], T1. [number], T1. [productchannel], T1. [productid], T1. [productname], T1. [purchaseprice], T1. [soldprice], t1. [style], T1. [supplierid], T1. [suppliername], T1. [transtype] From productdata T1 with (nolock) Where (t1.id <@ id0) and [email protected]
- Inherit and use business EncapsulationBy inheriting the object or business type, you can call the built-in business encapsulation or implement your own business encapsulation to increase the development efficiency. var user = new user () {name = "test "};
Usermanage. instance. login (user, "user", false); // implement form authentication login and set the ticket
-
- Multi-Database SupportMulti-database support is achieved through database adapters. For details, see "Support database details"
Supported database details:
database |
basic query |
automatically create a table |
with (nolock) query |
batch insert |
Stored Procedure |
dynamically compile the Stored Procedure |
built-in business encapsulation |
remarks |
MSSQL |
supported |
supported |
supported |
supported |
supported |
supported |
supported |
Create a paging sp_page_mssql. SQL Stored Procedure |
mysql |
supported |
supported |
not supported |
not supported |
supported |
not supported |
supported |
Create a stored procedure by PAGE sp_page_mysql. SQL |
Oracle |
supported |
supported (Advanced permissions required) |
not supported |
not supported |
supported |
not supported |
partially supported |
Create a paging sp_page_oracle. SQL Stored Procedure dynamically execute the script sp_executescript_oracle. SQL |
. NET Framework 4 and above are recommended for use with MVC. object-oriented development saves a lot of trouble
Test Project/ExampleClick to download
Test Project Preview
The CRL development framework is released, an object-oriented ORM framework