Dear all,
Hi there. I am too used with stored procedures. I wonder how can you achieve this in NHibernate since I am picking this technology. As you can see, below is my stored procedure:
// pseudocode
sproc usp_InsertNewRecord
Begin
-- IF (Check whether any records exists)
------ IF NO RECORD EXISTS
--------- INSERT ...
--- ELSE
------ RETURN SOME ERROR VALUE
End
As you can see my .NET calls this stored procedure 1 time (1 database call) and within it, i could have to process all these.
If I have to use nhibernate 2.0 alpha and do my checking within C#, i will probably call database twice
a. Validates whether any record exists
b. If Not Exists, then insert
How can i make nhibernate calls Database once, just like how i manage my stored procedures?
Or is there a better way to handle this with nhibernate best practices?
Any help? Thanks.
|