I'm using nhibernate in. NET to get a record of the problems!

Source: Internet
Author: User

The. Net ORM Mapping Framework NHibernate, originally a Java thing, a herd of cow b roaring yards, transplanted to the. NET platform, is a very good ORM mapping framework,


The story begins, ~_~!


The bell of the work was ringing, and looked away from afar. Punch line, the long queue, Punch machine, "du" "Du" "du" ...


Bear: Bald head strong, parcel data pushed past it? For the wool WMS can not be shipped, no package order details?

Bald-headed strong: How can you do something wrong? I didn't have a problem when I tried it myself yesterday.

Bear: Wrong Your sister son, I tested n times, come, I hide to you see, (Bear sat down)!


I saw bear lying in front of the computer, Four corners facing the ground, the operation of the once,

"I rubbed it, and I found out that the parcel details were gone and pushed to WMS, where the data is gone?" "Bear said


The bald head is strong a look. dumbfounded. A series of question marks ...???????


The code did not delete the data operation Ah, how is it possible? As a result, after a few moments of analysis,

Open Project, F5 Debug mode walk, go, go! Walk, walk, half an hour passed. Bald

A little bit of a strong prospect!!!


Bald-headed strong began to doubt the stability of the nhibemate, the precision of the code logic, if the bald-headed strong before the character, straight

The SQL statement came up and also used TMD what ORM framework, but this project. All depend on NHibernate, helpless,

The bald head is strong and silent,


Sitting next to the Kumaji is studying how to beat the birds. See Bald strong silence, leaned over, whisper smile! hehe hahaha ~----~

Two guys once again debug walk, parameters, data correctness, all is TMD correct, the completion of the update package details method

Kumaji looked at the data in the database, "Well, the parcel details are still in, continue to go" bald Strong road,

F5,f10,f11. F5,f10,f11. F5,f10,f11. F5,f10,f11. F5,f10,f11. , finally finished,

Kumaji again look at the database data, dumbfounded, the data is wrong. The value of a field is incorrect. When you perform a nhibernate update

The data is still right 、。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。


Eight commandments eat watermelon beside, Kumaji asked: "1.4.0.0 version of Fluentnhibernate and database interaction mode is what?"


"Insert,delete is instantaneous, and update is only a commit to update the database," said eight.


Bald strong continue to look at the code, and finally found the clue, to the NHibernate update data source object. belongs to a reference type. Before NHibernate commit, the data source was modified elsewhere,!!!!!!!!!!!!!!!


Dumbfounded the ~-~. Hehe, below is some small experience and the problem summary!!!!


1, for NHibernate database interaction mode, Insert,delete is instant, update is only commit to update the database (this may be my personal understanding of the problem, the specific need to see the program settings nhibernate the level of submission!) )

2, for NHibernate to do insert,update,delete data source, the largest is not subject to any "pollution (the value of the data source may be modified in some places)" data source

3, encounter problems, please analysis, do not blindly debug! To learn to analyze the problem, can solve the problem!

4, unfamiliar things, do not use in your project, unless you have to it, it must be familiar with, or even proficient in it!





This article is from the "idiot" blog, make sure to keep this source http://hotboy.blog.51cto.com/8826994/1625827

I'm using nhibernate in. NET to get a record of the problems!

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.