SmartSql = MyBatis + Cache(Memory | Redis) + R/W Splitting +Dynamic Repository + Diagnostics ......
Simple, efficient, high-performance, scalable, monitoring, progressive development!
How does she work?
SmartSql draws on MyBatis's ideas, uses XML to manage SQL, and provides several filter tags to eliminate various if/else judgment branches at the code level. SmartSql will manage your SQL and filter the tags to maintain your various conditional judgments at the code level to make your code more beautiful.
Why Choose SmartSql?
The Orm,linq of the DotNet system, which is mostly Linq, is very good, eliminating the developer's reliance on SQL. But it ignores the fact that SQL itself is not complex, and that it is difficult for developers to write Linq to generate good performance SQL in complex query scenarios, and I believe that students who have used EF must have this experience: "I think about how SQL writes, and then I write Linq, It's over. You may also want to see what SQL output of Linq is like. " It was a very bad experience. To be absolutely optimized for SQL, developers must have absolute control over SQL. In addition, SQL itself is very simple, why add a layer of translators?
SmartSql has been out of formal open source for more than two years, in the production environment after several micro-service verification. There are also some businesses that are using SmartSql (if you are also using SmartSql Welcome to submit issue)Who is using SmartSql. Has now joined NCC。 The future (Roadmap-2019) SmartSql will continue to add new features to help developers improve efficiency. Welcome to submit Issue https://github.com/dotnetcore/SmartSql/issues.
So why not Dapper, or DbHelper?
Dapper is really good and good performance, but the code that will be ceded to you is filled with SQL and various judgment branches that will make code maintenance difficult to read and maintain. In addition, Dapper only provides DataReader to Entity anti-serialization function. And SmartSql offers a number of features to improve developer efficiency.
Dynamic Agent Repository (SmartSql.DyRepository) components are SmartSql very unique features that simplify the use of SmartSql. There is little intrusion into the business code. It can be said that using ISqlMapper is the original method, and DyRepository automatically helps you implement these methods.
DyRepository only need to define the Repository interface, through a simple configuration can automatically implement these interfaces and register in the IoC container, when used injection instant acquisition implementation. The principle is to obtain the Scope and SqlId in the XML file of SmartSql through the naming rules of the interface and interface method, use the parameters of the interface method as the Request, and automatically judge the query or perform the operation through the SQL in the XML, and finally realize the ISqlMapper Call.
0. Define Repository interfaces
1. Injection dependencies
SmartSql Best practices -> SmartCode
By SmartCode Developers simply configure the database connection to build everything that is required for the solution, including, but not limited to:
Give you a restore.
- Building Docker Mirroring & Running Instances
Open a browser by the way
Directory structure generated by SmartCode
Read and write separation
SmartSql Read and write separation is especially easy, just provide a good configuration can be:
- Lru Least recently used algorithms
- Fifo Advanced first-out algorithm
- Other inherited self-ICacheProvider cache types are available
The SmartSql is implemented internally DotNet the main types of type handlers, and some types of compatible type conversion processors are provided, as well as more commonly used JsonTypeHanlder.
CUD Code generation
SmartSql also provides CUD extension functions to help developers generate good CUD-SQL for direct developer use without having to write any configuration.
When a transaction is nested, the transaction attribute annotation of the child function is no longer turned on, and the transaction that calls the function by the parent is used instead
SmartSql currently supports Skywalking monitoring and is enabled by installing the SkyAPM-dotnet agent. The following is a partial screenshot.
Monitoring execution commands
View whether the cache is cached and the number of records returned
View executed SQL statements
Exception stack Trace
Click on the link to join the QQ group [SmartSql official QQ group]:604762592