orm - Should i care/have knowledge about nHibernate before choosing Fluent nHibernate? -
I was going through Flunt Naibernet Vicki and I know that Flunt Naibernet
to the top Created N hibernate
... Do I have knowledge / care about nHibernate before choosing FlintNehiberNet? Any suggestion ...
I say yes if you know the XML based mapping format of NHibernate , It is very easy to track errors through NH's [Fluatmapping's Container]. ExportsToOo ([eg Environmental Content Directory])
. In
Edit: ASP .NET MVC example w / StructureMap
StructureMap:
private static void configure SQLiteInMemoryTest (IInitializationExpression init) {init.For & Lt; ISessionFactory & gt; () .Singleton (). Use temporarily Configure () Kdetabes (SQLiteConfiguration.Standard.Inmemory (). AdoNetBatchSize (100) .ShowSql) Mappings (m = & gt; m.FluentMappings.AddFromAssemblyOf & lt; MyEntity & gt; ()) Kanuwad configuration (config = & gt; {; config .SetProperty (NHEnvironment.ProxyFactoryFactoryClass, Taipf (Proksifactorfractor). Asdakshnskwalifaidnam);}) .BuildSessionFactory ()); Init.For & lt; ISession & gt; (). Lifestyle IS (GetLifecycle). Use (reference = & gt; {var session = context.GetInstance & lt; ISessionFactory & gt; (). OpenSession (); new Testdeta (session, _nhConfig).; Return session;}); }
Let MVC to use a Strccrmap based controller factory:
Global.asax.cs:
safety Void Application_Start () {[...] var Controller Factory = New Structure Controller Factor (Object Feature Container); Controller builder Current .set controlfighter (controllerfactor); [...]} Public Category StructureMap Controller Edit: Default Controllerfinor {Private Redonly IContainer_container; Public StructurePicTrainer Factor (ICOTNear Container) {_Container = Container; } Secure Override IController GetControllerInstance (RequestContext requestContext, Type Controller Type) {if (Controller Type == blank) Return zero; Return (Ictrower) _ Container.Get Instance (Controller Type); }}
Comments
Post a Comment