Nhib.pdf source code shortest 1

Source: Internet
Author: User
Nhib.pdf source code shortest 1
I have been familiar with Hibernate, and I am very impressed. It is a very good O/R Mapping FW. On http://nhibernate.sourceforge.net/, I have transplanted mongo.net#--nhib.pdf (NH) from Java, but it is still in the PreAlpha Build 2.
Out of interest and learning. NET goal, took two days to read only a small part of the code: first, the source code annotation is not rich, second, it is not familiar with the use of Hibernate/NHibernate, and third, some knowledge points are not familiar.
The preparation is as follows:
1. Nhib1_prealpha Build 2
2. NUnit
3. The NHibernate configuration file monitoring. dll. config is as follows:
<? Xml version = "1.0" encoding = "UTF-8"?>
<Configuration>
<ConfigSections>
<Section name = "nhibction" type =" System. Configuration. NameValueSectionHandler, System, Version = 1.0.3300.0, Culture = neutral, PublicKeyToken = b77a5c561934e089 "/>
</ConfigSections>
<Nhib.pdf>
<Add key = "hibernate. show_ SQL" value = "false"/> <! -- Set whether to output SQL statements to the Console -->
<Add key = "hibernate. connection. provider" value = "nhib.pdf. Connection. DriverConnectionProvider"/>
<Add key = "hibernate. dialect" value = "nhib.pdf. Dialect. MsSql2000Dialect"/> <! -- Set the dialect for using SQL Server. After all, the SQL statements of different databases are more or less different -->
<Add key = "hibernate. connection. driver_class" value = "nhib.pdf. Driver. SqlClientDriver"/> <! -- Set the DB Driver used -->
<Add key = "hibernate. connection. connection_string "value =" Server = zephyr; initial catalog = argus; UserID = sa; Password = zephyr; Min Pool Size = 2 "/> <! -- Set the connection string -->
</Nhib.pdf>
</Configuration>
It can be seen that the above is a standard Config file, which is generally read by the System. Configuration. ConfigurationSettings. GetConfig method.
The Blue part is the place where NH is actually configured. In this example, I configure it to use SQL Server. The Key/Value meanings are very clear.
It is worth noting that the name of the configuration file is very important. Usually, for an EXE Assembly, it is AssemblyName. config, but for Dll Assembly, the corresponding configuration file is AssemblyName. dll. config example:

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.