I am organizing a VisualStudio 2008 solution using Fluent NHibernate, and I would like to keep all NHibernate DLL dependencies stored in the "Back End" class library and let the external web application or console application not know NHibernate.
The structure of my solution is as follows:
BackEnd - class library - business logic and data repositories and a public API .. this layer uses NHibernate to store data and does not provide NHibernate classes for the external interface
Public - Class Library --- POCO Objects without dependencies, used by both the front and rear ends. Backend uses NHibernate to store these objects.
Front End - console application and MVC web application - (two applications for the external interface (1) MVC2 web application && (2) console application) link to Public and Back Finish projects and just use some public methods to interact with Back End with using Public objects.
What I would like to do is just NHibernate links and its many dependencies once in the Back End and Front End applications just link to the back end project. However, the Fluent BackEnd crashes at runtime if I do not reference any of the Nhibernate dependencies in my front end application, except to reference them in the Back End. Here's the Back End code with which it crashes, complaining that it cannot find the dhibernate dll when the front end drops the link:
public static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(SQLiteConfiguration.Standard.UsingFile(DbFile))
.Mappings(m => m.AutoMappings
.Add(AutoMap.AssemblyOf<EngineInfo>(type => type.Namespace.Contains("BackEnd"))
.Conventions.Add(DefaultCascade.All())
.Conventions.Add(DefaultLazy.Never())
)
)
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
}
I may have accidentally discovered a NHibernate-specific resource for Front End applications, but I don't have compile-time errors, and I would like to work a little.
If I reference the Nhibernate DLL, everything works fine, but in my front end applications I get the following warning at compile time:
*
.
*
?
- Update -
dll,
NHibernate.ByteCode.Castle.dll
System.Data.SQLite
. , .
, , NH SQL, , Nhibernate SQLite. , NHibernate SQLite, , , .
, , , :
, appconfig? --- MSDN - http://msdn.microsoft.com/en-us/library/bb383993.aspx
?
--- Update ---
, , , DLL NHibernate. VS 2008 2010 . , , , ?