database - Transactions in Castle ActiveRecord + NHibernate for dummies -


I want to do all of the following in a single nuclear transaction:

  1. Read through ActiveRecord One object from
  2. Save a new object via ActiveRecord
  3. Update another table through NHibernate

In addition, if I By ending the transaction, the value of the item I read in step 1 has changed, I would like to overturn the transaction.

I have never used the transaction in AR or NAH, so please provide more details as you can. How do transaction mechanisms play together?

Well, the castle activate depends on the NHibernate, the truth is, a castle activist transaction class is found on NHibernate Is not the same; But you should think of ActiveRecord as a wrapper on one of the NIHBennet.

So there is no need to "play together". Because, in depth, they are the same.

Another important concept is "session". A "session" is a unit of work, a "window" that tells NHibernate what you want to do: questions, updates, and so on. Again, there is also a NHibernate session and a castle activation session, again, for the first time there is a cover.

This is important because when you are using a session in ActiveRecord (and in fact you always do this, even if it is contained), then it is possible that the "hidden" NHibernate session ; Usually a representative is used for the method executed. And that's the way you can use both styles of code inside your app (see).

Finally, I suggest that you always use the style of ActiveCord to declare sessions and transactions, even shaking both styles of coding. Since they represent NHibernate sessions and transactions, you are safe therefore please understand that please, please. PS: Yes, the example I asked for you (not too lazy to write), but I think that if you write it then it will be better for your learning process. Believe me, it's easy with your idea.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -