NHibernate Passing Session to the Repository -


How do I go about passing a session for a repository class?

We say that I have two projects

1) TestSite 2) Business Objects

The Republican Business Objects Project is included in the project. The NHibernate session has been opened in the test site project. Now, I want to use the same session because the test site initiates the transaction on that session. Currently, I am using the following:

var repository = New Customer Resor (_session);

Of course, it looks ugly! I'm thinking in some way that a dependency injection frame can be tilted and I can be provided without entering the repository with the ejection object. In our WCF service, we actually use a unitofwork that wraps an operation and stores ISSN for that operation. .

The repositories know how they are receiving a hint from the current unit of work under which they are running

In case of testing we have a base test class, Those who are included in any test class, who touch the test database, we then control the beginning and closing of the work unit in testfixturesetup. Once you have done a great job to use this thing, in the version of NUITT we are not guaranteed to run Tyrundo (in case of setup or trial, in case of an unused exception).


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -