Framework Design of the persistent data layer (2)

Source: Internet
Author: User

A long time ago, after publishing an article titled design of the persistent data layer framework (I), many people are paying attention to it. Now, a slightly complete test version of release has been released to provide the DLL, see the configuration instructions. You are welcome to experience and provide valuable suggestions.

The following is an example of the configuration file:

1. Configure in APP. config or web. config

< Configsections >
< Section Name = "Data" Type = "Zivsoft. Data. confighandler, zivsoft. Data, version = 3.5.3295.29087, culture = neutral, publickeytoken = 3266f10ce3531d0e" />
</ Configsections >
< Data Dbtype = "Sqlserver" >
< Access Type = "Zivsoft. Data. Access. accessdboperator; zivsoft. Data. Access, version = 3.5.3295.29087, culture = neutral, publickeytoken = 3266f10ce3531d0e" >
< Add Key = "Connectionstring" Value = "Provider = Microsoft. Jet. oledb.4.0; Data Source = ~ \ DB \ soaweb. mdb" />
< Add Key = "Autocreatetable" Value = "False" />
< Add Key = "Autocreatedb" Value = "True" />
</ Access >
< Sqlserver Type = "Zivsoft. Data. sqlserver. sqlserverdboperator; zivsoft. Data. sqlserver, version = 1.0.3295.29087, culture = neutral, publickeytoken = 3266f10ce3531d0e" >
< Add Key = "Connectionstring" Value = "Data Source = Lihua-PC \ sqlexpress; initial catalog = sample; Integrated Security = true; pooling = false" />
< Add Key = "Autocreatetable" Value = "True" />
< Add Key = "Autocreatedb" Value = "True" />
</ Sqlserver >
< MySQL Type = "Zivsoft. Data. MySQL. mysqldboperator; zivsoft. Data. MySQL, version = 1.0.3295.29087, culture = neutral, publickeytoken = 3266f10ce3531d0e" >
< Add Key = "Connectionstring" Value = "...... " />
< Add Key = "Autocreatetable" Value = "True" />
< Add Key = "Autocreatedb" Value = "False" />
</ MySQL >
</ Data >

 

2. configuration in a separate file

If you configure the file separately, you need to create a new data. xml file in the current directory or in the app_data directory. The format is as follows:

<? XML version = "1.0" encoding = "UTF-8" ?>
< Config >  
<! -- My area -->
< Data Dbtype = "Access" >
< Access Type = "Zivsoft. Data. Access. accessdboperator; zivsoft. Data. Access, version = 1.0.3295.29087, culture = neutral, publickeytoken = 3266f10ce3531d0e" >
< Add Key = "Connectionstring" Value = "Provider = Microsoft. Jet. oledb.4.0; Data Source = D: \ dB \ soaweb. mdb" />
< Add Key = "Autocreatetable" Value = "False" />
< Add Key = "Autocreatedb" Value = "True" />
</ Access >
< Sqlserver Type = "Zivsoft. Data. sqlserver. sqlserverdboperator; zivsoft. Data. sqlserver, version = 1.0.3295.29087, culture = neutral, publickeytoken = 3266f10ce3531d0e" >
< Add Key = "Connectionstring" Value = "Data Source = Lihua-PC \ sqlexpress; initial catalog = sample; Integrated Security = true; pooling = false" />
< Add Key = "Autocreatetable" Value = "True" />
< Add Key = "Autocreatedb" Value = "True" />
</ Sqlserver >
</ Data >
< Localization Loc = "En-us" >
< En-US > App_data \ localization \ resourceen. xml </ En-US >
< Zh-CN > App_data \ localization \ resourcecn. xml </ Zh-CN >
< Zh-TW > App_data \ localization \ resourcetw. xml </ Zh-TW >
< JP-Wh > App_data \ localization \ resourcejp. xml </ JP-Wh >
< Ko-KR > App_data \ localization \ resourceko. xml </ Ko-KR >
< Es-MX > App_data \ localization \ resourcees. xml </ Es-MX >
</ Localization >
< Log Level = "Debug" >
< Logfile > App_data \ log. Log </ Logfile >
</ Log >
</ Config >

 

3. The configuration is mainly in the above two categories. In addition, you need to mention GAC.

BecauseProgramSet is strongly named. You can drop the DLL to GAC, but note that the complete information must be specified in the configuration as follows:

< Access Type = "Zivsoft. Data. Access. accessdboperator;Zivsoft. Data. Access, version = 1.0.3295.29087, culture = neutral, publickeytoken = 3266f10ce3531d0e" >

 

The configuration can be simplified as follows:

< Access Type = "Zivsoft. Data. Access. accessdboperator; zivsoft. Data. Access" >

 

4. About extensions.

Zivsoft. Data. dll contains all data operations, Orm, and other interfaces. You can inherit idboperator to extend the support for other databases, such as DB2, MySQL, and Oracle. Currently, I only use common sqlserver and access methods.

5. How to automatically generate entity.

There is a zivsoft. Data. Orm. setup. dll in the program package. You can run the interface in it to specify the database and automatically generate zivsoft. Data. Orm. entity. dll.

 

As for how to call the details of entity classes, foreign key associations, and so on, we will not write much in this article. We will explore it for ourselves, which is similar to that of all ORM systems, I have time to complete this article. I hope to pay attention to it for a long time and give more suggestions. Haha!

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.