[Spleb] Analysis of codesmith principles (2)

Source: Internet
Author: User

3,Schemaexplorer, Database access

CodesmithThe reason is that it provides convenient database access and calling. This part is actually a plug-in, that isSchemaexplorer.

schemaexplorer encapsulates all database objects. databaseschema and tableschema , columnschema and other databases schema , the data source information is extracted by dynamically loading Assembly , this function is implemented by the idbschemaprovider interface. Many components are provided on the codesmith website. v3.1 provides adoxschemaprovider and sqlschemaprovider , for ADO and SQL database access, similar to ADO. net oledbdataadpater and sqldataadpate R .

DatabaseschemaRepresents a database. AccordingConnnectionstringAndIdbschemaprovider. Its main attribute isTableschmeacollectionAndViewschemacollectionProvides the data table and data view information of the database.

TableschemaRepresents a database table. Mainly providesColumnschemacollection. That is, the column data of the data table.

ColumnschemaRepresents the columns of a data table. The main attribute isColumnname,Systemtype,Columntype,IsprimarykeymemberAnd other content

The above three categories are providedExtendedpropertycollectionStores extended information, which is similarHashtable,In addition, many databasesProviderThe special information of this type of database is also stored here.

In the template, You Can iterate over the above three collection classes to perform database stored procedures,ORMAnd so on.

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.