Hi all, New to NHibernate but not necessarily the concepts of ORM.
I've read a great deal of information and some of it seems to blur the lines for my specific situation so I'm wondering if someone can clarify a few of the concepts and maybe refer me to a blog post to solve a specific. I have the following Solution Structure (including some test suites not shown here): - Databases: Oracle 11g (only need to query; strictly read-only) & SQL Server (not using NHib for this; using EF CodeFirst) - Project.Model -- class library with all my POCOs. - Project.Data -- class library with Repositories, Session Factories, etc. This is where I would like all of my data access code to be - Project.Web -- MVC4 webapp. I would like this webapp to only communicate via POCOs, Repositories, and units of work. I would like accomplish the following: - Store my connection string in Project.Web's Web.config and pass it into my Data project (my web.config is transformed automatically in my build process so it would be nice to keep it here). - Use FluentNHibernate to configure NHibernate and fluently map to entities - Use ODP.NET + FluentNHibernate for an Oracle Database (I have another SQL Server DB which I'll be using EF Code-First for instead of NHibernate as well) - Use a session factory the proper way - Use transactions the proper way - Use linq to query the Oracle DB (again, read only -- no writes/updates) - Verify via NUnit that these things are working as they should be. - I'd like to make use of Transact() => to set up transactions, but am unfamiliar with the syntax around it. - I'd like to keep anything about the data within the context of the Data project as much as possible. My general thinking so far (please tell me if/where I'm going wrong here as I'm almost certain I am): - install ODP.net via nuget to Project.Data - Create a SessionFactory as some type of singleton in Project.Data that takes a string parameter for the connection string and uses that to create an OracleDataClientConfiguration with that connection string. - From my Project.Web file Application_Start, call the Project.Data.MyDBSessionFactory(ConfigurationManager.ConnectionStrings["TheDBConnStringName"].ConnectionString).CreateSessionFactory() method to create the session factory. - I'm unsure about the best way to handle sessions and transactions. It seems that maybe I should manage them at the repository level (creating a new session if one isn't provided) and then using a unit of work to provide a session to multiple repositories when working in the context of a larger transaction? Any thought on this and how to architect it would be greatly appreciated. Again, I've been searching around but blog links would be appreciated. Thanks, Sean -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To unsubscribe from this group and stop receiving emails from it, send an email to fluent-nhibernate+unsubscr...@googlegroups.com. To post to this group, send email to fluent-nhibernate@googlegroups.com. Visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en. For more options, visit https://groups.google.com/groups/opt_out.