CYQ. Data V5 from getting started to giving up the ORM series: tutorial, cyq. dataorm

Source: Internet
Author: User

CYQ. Data V5 from getting started to giving up the ORM series: tutorial, cyq. dataorm
1: AppConfig class Introduction: Public Static (Shared) Properties

IsEnumToInt Whether to convert table field enumeration to Int (default value: false ). If this parameter is set to true, performance can be improved. However, the enumerated values of the generated table fields must be consistent with those of the database.
Aop Configuration example of the Aop plug-in configuration item: [complete Class Name, assembly (dll) name] <add key = "Aop" value = "Web. Aop. AopAction, Aop"/>
ThreadBreakPath When Tool. ThreadBreak is used, the relative path of the external file is configured (the default value is in the file corresponding to the environment variable Temp)
EntitySuffix The suffix of the generated object class.
Version Obtain the version number of the current Dll.
RunPath Framework running path (Bin directory)
Public Static (Shared) Methods
GetApp Overloaded. Obtain the value of Web. config or App. config.
GetAppInt Obtain the numeric value of Web. config or App. config (if the allowed value does not exist or is null, the default value is output ).
GetConn Overloaded. Obtain the connectionStrings node value of Web. config or App. config.
SetApp Set the value of Web. config or App. config.
Note:

1: The attribute name of the AppConfig class is the same as the Key of the AppSetting node of Web. config/App. config.

2: In addition to basic attributes and methods, it also includes the following five categories of configuration.

AppConfig. Cache Public Static (Shared) Properties
IsAutoCache Whether to intelligently cache data (enabled by default)
DefaultCacheTime Cache. CacheManage default Cache time [minute (60 by default)]
MemCacheServers Distributed cache server configuration, separated by commas (,)
NoCacheTables When AutoCache is enabled, you can set non-cached tables. Multiple tables are separated by commas (,).
IngoreCacheColumns When AutoCache is enabled, you can set column names that are not affected by updates, in Json format. {TalbeName1: 'column1, column2 ', talbeName2: 'column1, column2 '}
AppConfig. DBPublic Static (Shared) Properties
PagerBySelectBase Whether to enable SelectBase in MSSQL. The default value is false.
Defadaldaltype Default database type (read-only)
CommandTimeout Global database commands default timeout settings, default 120 seconds (unit: seconds)
MasterSlaveTime The duration for the user to perform operations on the primary database during read/write splitting. The default value is 10 seconds (unit: seconds)
DefaultConn Default database link (complete link statement or Web. config configuration item name can be assigned) If you do not configure the Conn link in the configuration file (Web. Config), you can assign a value to this attribute.
DefaultDataBase Default Database Name (read-only)
FilterSqlInjection By default, the where condition in all MAction operations has a powerful filter word to filter SQL Injection keywords. If a statement contains a specified filter word, an error message is returned and logs are recorded. If you need custom keywords, you can configure this item, for example, "delete; from, truncate, other words", semicolon table phrase, which must contain two words at the same time; multiple filter phrases ", "separated by commas
AutoID The sequence ID that needs to be configured when int type ID is added when MAction is used to operate Oracle. If Guid is set to ID, this parameter is not required. If you need to configure a serial number for each table, you can use: SEQ _ {0} Where {0} will be automatically paired into the table name, if not {0 }, A sequence is shared for the entire database. Default parameter value: SEQ _ {0}
SchemaMapPath MAction maps the table architecture to the external specified relative path [External Storage, avoiding database Reading]
DeleteField Delete field name (if the table has the field name set, MActon's delete operation will change to update) Default: IsDeleted
EditTimeFields Update time field name (if a specified field name exists in the table, the update time is automatically updated. Multiple fields are separated by commas)
HiddenFields Name of the field to be hidden globally (default value: "cyqrownum, rowguid, deletefield ")
AppConfig. DebugPublic Static (Shared) Properties
OpenDebugInfo Enable information debugging record: After enabling, MAction. DebugInfo can output execution logs. You also need to enable AppDebug if you want to use it.
SqlFilter Number of milliseconds (this is for all SQL statements: Write all long (MS) SQL statements into the log, corresponding to the path of the configuration item LogPath)
InfoFilter Milliseconds (this is after AppDebug is Enabled: You can use this setting to filter out SQL statements that take a long time (MS)
AppConfig. LogPublic Static (Shared) Properties
IsWriteLog Whether to write database exception logs: When enabled: if an exception is thrown, It is not transferred to the database. If not enabled, an exception is thrown.
LogConn CYQ. Data. Log records abnormal database logs-Database Link Configuration
LogPath Relative Path of text log configuration (default: Logs \\")
LogTableName Exception log table name (SysLogs by default, configurable)
AppConfig. XHtml Public Static (Shared) Properties
CDataLeft "<! [CDATA ["item
CDataRight "]>" Used in Xml. XHtmlHelper
DtdUri The relative path of the DTD parsing document to be configured for Html operations in Xml. XHtmlHelper
Domain Main website domain name required by Cookie during Xml. MutilLanguage language switching [without www]
SysLangKey The default language Key of the Xml. MutilLanguage class. Default Value: Chinese

 

2: AppDebugPublic Static (Shared) Properties
IsRecording Recording
Info Obtain debugging information
Public Static (Shared) Methods
Start Start recording debugging information
Stop Stop and clear recorded debugging information
Sample Code:
Class Program {static void Main (string [] args) {AppConfig. debug. openDebugInfo = true; // you must first open this AppConfig. debug. infoFilter = 20; // record the SQL statement execution time> 1 Millisecond (this is after AppDebug is enabled :) AppConfig. debug. sqlFilter = 2; // record the SQL statement execution time> 2 ms (this is all SQL statements) // note that the software file is opened, execution time greater than 2 milliseconds will be recorded in sqlfilter_time .txt AppDebug. start (); // Start record Exe1 (); Exe2 (); Exe3 (); Console. writeLine (AppDebug. info); // obtain the debugging information AppDebug. stop (); // close the record Console. read ();} static void Exe1 () {string SQL = "select count (*) from users"; using (MProc proc = new MProc (SQL) {proc. exeScalar <string> () ;}} static void Exe2 () {using (MAction action = new MAction ("V_Article") {action. select () ;}} static void Exe3 () {using (MAction action = new MAction ("Users") {action. fill (1 );}}}
Running result:

Summary:

1: AppConfig is commonly used (not directly operating on this class, but configuring Web. config)

2: AppDebug: It is used only when the SQL statement performance needs to be monitored or optimized.

CYQ. Data: GitHub Source: https://github.com/cyq1162/cyqdata

CYQ. Data: Demo Source: http://code.taobao.org/p/cyqopen/src/trunk/CYQ.Data.GettingStarted/

Related Article

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.