Microsoft. NET technical practices ORM Development Series articles summary template studio template editor for Smart Tips and query tracker llbl Gen profiler

Source: Internet
Author: User

This articleArticleI originated from my llbl Gen 3.x ORM source code tracing series tutorials. I have the following articles:

Llbl Gen 3.x source code tracing and parsing Framework Structure

Llbl Gen 3.x source code tracing and parsing Type converter type converter

Llbl Gen 3.x source code tracing and parsing execution of Stored Procedures

Llbl Gen 3.x source code tracing and parsing query command Tracing

Llbl Gen 3.x source code tracing and parsing validation principles and procedures

ERP/MIS development and development llbl Gen plug-in (Plun-in) implementing a plug-in

Many of my friends are confused.Source codeWhat's the purpose?CodeI cannot write the same software, so there is no need to analyze its source code. Because of work, I guess most of my friends will not rely on source code analysis to improve code development technology. This process is too slow and ineffective, the fastest way to improve our technology is generally to read the article and practice the application in practice.

I used the following two software to analyze the code of llbl Gen 3. X and understand the experience. net practice.

Template Studio

Llbl Gen 3. X has its own template studio, but it does not provide support for smart prompts. In this way, code writing is inefficient, so I want to create a template editor with smart prompts, see the template definition below, llbl Gen 3. template definition of the lpt type of X

<%
Project currentproject = _ executinggenerator. projectdefinition;
Entitydefinition currententity = (entitydefinition) _ activeobject;

%>
Using system;
Using system. Data;

If you are not familiar with it, refer to my article "getting started with template studio Template Development LPT templates development" to help you understand.

Description in the reference, _ executinggenerator is a built-in variable of template studio, and a value is dynamically input at runtime. Its type is igenerator, which is defined inProgramSet SD. llblgen. Pro. generatorcore. There are two other variables

_ Parameters; Type: Dictionary (string, taskparameter). It stores parameters of the current task.

_ Activeobject: If emittype = allentites, it indicates the current object.

So what I want to achieve is

When you type a variable of the _ executinggenerator type, you can display its member list to edit the template quickly.

If you have read my article about application reflection, dynamic compilation, and Code Generator for. Net programmers who have been working for five years, the template syntax mentioned in it is as follows:

<% @ Property name = "math" type = "mathprogram" Category = "text" Description = "namespace for this class" %>
<% @ Property name = "includedelete" type = "system. int32" default = "123" Category = "options" Description = "if true Delete statements will be generated." %>

<% @ Assembly name = "testclasslibrary" %>
<% @ Import namespace = "EPN. Common" %>

Llbl Gen 3. the definition of the LPT template file of X is different from the template definition of code Smith above. Therefore, the technology mentioned in that article needs to be improved to achieve smart prompts.

 

Llbl Profile

This software is an SQL statement used to track the dynamic output of llbl Gen and convert it into an SQL statement that can be run directly. The Trace Output SQL of llbl gen is not a standard SQL, and needs to be converted to run properly. See

The socket technology is used to output the tracked SQL statements to the specified server window, and then automatically convert them into running SQL statements below the form. This is its main function.
One of the difficulties of ORM tracing is that the orm framework generates dynamic SQL statements and can run them directly, but it is very troublesome to modify them.
See the following dynamic SQL statement example.

Execute (n' select * from groups ')
Sp_executesql n 'select * From groups'
When it comes to dynamic SQL statements, this sentence may be very important: Execute brackets can only contain string variables, string constants, or their concatenation, and cannot call other functions or stored procedures. If you want to use it, use a variable combination.
When to use dynamic SQL statements, when the SQL structure cannot be determined (that is, the table name and column name), use dynamic SQL.

Llbl profile converts the SQL statements dynamically generated by ORM into static SQL statements and can be modified. This is its main function.

I often use this method to locate the problem when tracing the results of programs or SQL results.

After I wrote this software, I searched for it on the Internet and found a commercial software called llbl Gen profile, which did a good job.

Commercial software must be user-friendly, easy to use, and stable. In comparison with it, my software is just an ugly duckling. I think it would be better to stick to development for a while.

For more information about ORM tracking, see the SQL profiler tracking and query section in the Information Infrastructure development framework.

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.