The content of this section
Introduced
Collection types in NHibernate
Establish a parent-child relationship
Parent-Child Association mappings
Conclusion
IntroducedThrough the introduction of the previous articles, basically understand the nhibernate, but in the nhibernate mapping relationship is the highlight of
This section describes how to use the interfaces provided by Orm. Net to display data, including grouping and sorting.
Datamanager. Get [object] GET [object] collection methods
This is the main way to get data. It can be seen from the name that GetObject is to get an object, and getobjectcolletion is to read several rows of records to get an object set. The usage mode is as follows:
Object object = datamanager.Get [object]
Or
Objectcollec
1. EF (Entity Framework)
Mainstream ORM ideas are dominated by Linq. The King has to say it is EF. Elegance and convenience are Orthodox, and it seems that its performance and actual combat performance are still to be improved. linq cannot generate ideal SQL for us, and its own performance may be compromised. this is the main problem EF has to face. EF has many advantages.
The advantages and disadvantages of Linq seem to have become one of EF's advant
There are three common configuration methods for configuring nhib.pdf.1: Configure in Web. config and App. config
XML version = "1.0" encoding = "UTF-8"
?>
Configuration
>
Add this element
-->
Configsections
>
Section
Name
= "Hibernate-configuration"
Type
= "Nhibernate. cfg. configurationsectionhandler, nhibler"
/>
Configsections
>
Add this element
-->
Hibernate-Config
http://www.zvolkov.com/clog/2009/07/09/why-nhibernate-updates-db-on-commit-of-read-only-transaction/Always being careful with NULLable fields whenever you deal with NHibernate. If your field is NULLable in DB, make sure corresponding. NET class uses NULLable type too. Otherwise, all kinds of weird things would happen. The symptom is usually would be NHibernate wo
($) NULL,Orderformtime datetime NOT NULL,Constraint Pk_orderform primary KEY (Orderformid))Go4), Order scheduleCREATE TABLE Orderproduct (Orderproductid varchar () NOT NULL,ProductID varchar ($) NULL,Orderformid varchar ($) NULL,Constraint Pk_orderproduct primary KEY (Orderproductid))GoThird, software configurationTo add the ability to write NHibernate configuration file smart hints for Microsoft Visual Studio 2010. Just find configuration.xsd and
Session
Session in NHibernate is thread insecure and has some impact on performance each time a database operation requests a session creation. Thread safety can be easily implemented through the [threadstatic] attribute in Windows applications, while in the web you can implement thread safety by using the session with the request HttpContext binding, and the user currently requests only one session. The code is as follows:
ISessionManage.cs
Using Sy
[Nhibib] use LINQPad to view NHIbernate to generate an SQL statement.
In the previous article, we mentioned that we can rewrite the EmptyInterceptor interceptor of NHibernate to monitor the SQL scripts sent to the database by NHibernate. Today we can see a friend using LINQPad to monitor the SQL statements generated by NHiber
not many "general" things, some of them are too complicated (in my opinion, they also violate some "Design Principles"). I suddenly found an article that seems to have a detailed example, but because of the image andCodeI am so happy with all the loss. All in all, on the basis of the reference to the scattered materials, I have experienced countless attempts and frustrations to find out the results-of course, you will find that, in fact, it is not thorough.
Sometimes I also think, do you thin
Study for a period of time nhibernate, always have a problem, that is, multiple tables associated query HQL statement problem, today finally solved, first share experience
NHibernate Relationship--Many-to-manyMulti-Many-to-many relationships
Don't say much nonsense, look at the picture:
Here we are mainly to solve the order table and product table between the many-to-many relationship, I believe that the
After two articles: "Opening" and "simple ing"ArticleI believe you have some knowledge about fluent nhib. fluentnhib is actually an extension of the nhib ing, we can make full use of strong type, generic, lambde expressions, etc. Vs, framework, and other features to easily complete the ing work. At the same time, we can also learn the nhing method of Nhibernate to win the game, is there a reason not to continue to complete this series? Don't talk nons
What is level-2 cache?
The session of Nhibernate provides a level-1 cache. Each session loads the same ID twice and does not send two SQL statements to the database. However, once the session is closed, the first-level cache becomes invalid.
Compared with Session, sessionfactory also provides a caching mechanism.
Sessionfactory caches can be divided into built-in and external caches based on different functions and purposes.
Sessionfactory's b
Before, have seen a lot of nhibernate things. In particular, Yjinglee's NHibernate Tour series is more classic. See more, but have not really done from the beginning to the end of the side. I've done it all over again today and found a lot of problems. I would like to share with you some of the problems I have done and the issues I have encountered in this process. Also can let some novice friends less go s
Powerful ORM tool: nhibloud (iii) Five cores + simple object CRUD + HQL, ormcrud
In the previous two articles, we have a rough understanding of nhib.pdf.
Introduction to ORM: nhib.pdf (1) the role of nhib.pdf solves the conversion problem between objects and databases.
ORM tool: nhib.pdf (2) use CodeSmith to quickly generate ing files and ing classes. Use CodeSm
Object-Oriented Design, ORM, and nhib.pdf)
The ORM design is actually an O-to-D process, that is, the data entity is finally generated by the object. however, the problem is that in traditional design, we must design a Business Object and re-design a relational object (or other storage objects, of course). This method is actually two skins, this is a repetitive process. however, since there is no object-ori
The previous two days investigated under the automatic generation tool mygeneration and codesmith the previous version has not been updated after a too advanced buildThe code contains too many things, not the whole understanding. However, the generated xmlmapping is very powerful. So simply integrate the Codesmith and moveThe soft Pojo. The current version of the dynamic default with the NHibernate Template table design is best not underlined or the l
NHibernate LINQ Query Extension Enhancements (Nineth article) In the previous introduction of LINQ to NHibernate, all of the IqueryoverIn fact, LINQ to NHibernate is more powerful. let's first introduce the namespace Nhibernate.linq, which has a more powerful extension of LINQ to NHibernate.one, fetch immediately load (avoid lazy loading)Let's take a look at som
NHibernate Profiler is a tool that can monitor SQL statements in NHibernate1. Download NHibernate Profiler2. Add a reference to your NHibernate project (below the NHibernate Profiler root directory)HibernatingRhinos.Profiler.Appender.dll3. Configure your application configuration file, my is Web service, ie. config fil
Nhibernate.3.0.cookbook the sixth section of the first chapter handling versioning and concurrency translationChapter II Mapping a class with XMLChapter I section III Creating class hierarchy mappingsChapter Fourth Section mapping a one-to-many relationshipChapter Fifth section setting up a base entity classHandling Versioning and concurrencyVersion control and concurrencyIn any multi-user operating system, in order to handle concurrent updates and ve
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.