Share connection between NHibernate and Entity framework

94 views
Skip to first unread message

Srinivas Raghavan

unread,
Jul 5, 2017, 12:55:45 PM7/5/17
to Particular Software
Product name: NServiceBus
Version: 6.2

In our application we are using SQLServer transport with NHibernate for persistence and EntityFramework to store business data. In the prior version we are retrieving the connection from NHibernateStorageContext/SQLServerStorageContext and assigning it to EntityFramework DbContext using dependency injection. But in the latest version of NServiceBus 6.2, NHibernateStorageContext/SQLServerStorageContext is deprecated and we are not finding an option to get the DbConnection from the NServiceBus. 

Please suggest is there any way to retrieve the DBConnection from NHibernate and assign to entity framework through the dependency injection. Also, if you have any samples please share with us.

Szymon Pobiega

unread,
Jul 5, 2017, 3:08:23 PM7/5/17
to particula...@googlegroups.com
Hi

Here's a sample you are looking for https://docs.particular.net/samples/entity-framework/. The new APIs are based on SynchronizedStorageSession concept available via the message handling context. 

Hope it helps,
Szymon

--
You received this message because you are subscribed to the Google Groups "Particular Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to particularsoftware+unsub...@googlegroups.com.
To post to this group, send email to particularsoftware@googlegroups.com.
Visit this group at https://groups.google.com/group/particularsoftware.
To view this discussion on the web visit https://groups.google.com/d/msgid/particularsoftware/137aa114-8acf-4e8a-8b98-f75159a96d36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Have you tried NServiceBus V6 yet?

Learn how to scale applications with microservices and NServiceBus 6.


Join Udi Dahan's next Advanced Distributed Systems Design Course:

September 2017 Los Angeles, CA, USA

November 2017 Sydney, Australia


ramon...@particular.net

unread,
Jul 10, 2017, 5:51:51 AM7/10/17
to Particular Software

The following sample demonstrates how to get similar dependency injection behavior as was possible with NServiceBus 5:


-- Ramon 
 
Reply all
Reply to author
Forward
0 new messages