2
votes

I have created a sample project to replicate an issue I'm having with Castle Windsor and the NHibernate Integration Facility.

I get the following exception:

Method not found: 'Void Castle.Core.DependencyModel..ctor(Castle.Core.DependencyType, System.String, System.Type, Boolean)'.

With the following stack-trace:

at Castle.Facilities.NHibernateIntegration.Internal.NHSessionComponentInspector.ProcessModel(IKernel kernel, ComponentModel model)
at Castle.MicroKernel.ModelBuilder.DefaultComponentModelBuilder.<>c__DisplayClass6.<BuildModel>b__4(IContributeComponentModelConstruction c)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at Castle.MicroKernel.ModelBuilder.DefaultComponentModelBuilder.BuildModel(IComponentModelDescriptor[] customContributors)
at Castle.MicroKernel.Registration.ComponentRegistration`1.Castle.MicroKernel.Registration.IRegistration.Register(IKernelInternal kernel)
at Castle.MicroKernel.DefaultKernel.Register(IRegistration[] registrations)
at Castle.Facilities.NHibernateIntegration.NHibernateFacility.RegisterDefaultConfigurationBuilder()
at Castle.Facilities.NHibernateIntegration.NHibernateFacility.RegisterComponents()
at Castle.Facilities.NHibernateIntegration.NHibernateFacility.Init()
at Castle.MicroKernel.Facilities.AbstractFacility.Castle.MicroKernel.IFacility.Init(IKernel kernel, IConfiguration facilityConfig)
at Castle.MicroKernel.DefaultKernel.AddFacility(IFacility facility)
at Castle.Windsor.WindsorContainer.AddFacility(IFacility facility)
at Castle.Windsor.Installer.DefaultComponentInstaller.SetUpFacilities(IConfiguration[] configurations, IWindsorContainer container, IConversionManager converter)
at Castle.Windsor.Installer.DefaultComponentInstaller.SetUp(IWindsorContainer container, IConfigurationStore store)
at Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers, DefaultComponentInstaller scope)
at Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers)
at CW3_FluentNH_Integration_Tester.Main.Main() in D:\Documents and Settings\cannizrm\Desktop\Windsor3FluentTester\CW3_FluentNH_Integration_Tester\CW3_FluentNH_Integration_Tester\Main.vb:line 28
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

I have the following DLL versions:

Castle.Core.dll - 3.0.0.2230
Castle.Windsor.dll - 3.0.0.2325
Castle.Facilities.NHibernateIntegration.dll - 1.1.039
FluentNHibernate.dll - 1.3.0.717
Iesi.Collections.dll - 3.2.0.4000
NHibernate.dll - 3.2.0.4000

This the sample code I am using to load the container and install the Fluent NH Configuration:

Imports Castle.Windsor

Module Main

#Region " Declarations "

  Private objContainer As IWindsorContainer

#End Region

#Region " Properties "

  Public ReadOnly Property Container As IWindsorContainer
    Get
      If objContainer Is Nothing Then
        objContainer = New WindsorContainer()
      End If
      Return objContainer
    End Get
  End Property

#End Region

#Region " Functions "

  Sub Main()

    Container.Install(Castle.Windsor.Installer.Configuration.FromXmlFile ("Configs\hibernate.cfg.xml"))

  End Sub

#End Region

End Module

This is the sample XML configuration file used:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <facilities>
    <facility id="nhibernate" isWeb="false" type="Castle.Facilities.NHibernateIntegration.NHibernateFacility, Castle.Facilities.NHibernateIntegration">
      <factory id="nhibernate.factory">
        <settings>
          <item key="show_sql">true</item>
          <item key="connection.provider">NHibernate.Connection.DriverConnectionProvider</item>
          <item key="connection.driver_class">NHibernate.Driver.SqlClientDriver</item>
          <item key="dialect">NHibernate.Dialect.MsSql2005Dialect</item>
          <item key="connection.connection_string">Data Source=.\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True</item>
        </settings>
      </factory>
    </facility>
  </facilities>
</configuration>
1
I have since posted to the Castle Windsor development mailing list with a possible solution to this. I will add this into a valid answer when account restrictions are not in place.Ross
Yes, this is obviously a case of NHibernateIntegration not being updated for Windsor 3.Mauricio Scheffer
Yeah that's correct. The link to my post on the dev. mailing list is here: groups.google.com/group/castle-project-devel/browse_thread/…. I'm just waiting to see if it is worth creating a patch for or not.Ross
Yes, always send a patch. Never wait for confirmation. Be "pro-active" (stupid word I know, but it does apply here). Worst case, it gets rejected, but it probably won't.Mauricio Scheffer

1 Answers

0
votes

I've registered this as an issue on the projects tracker and have included two patch files to resolve it.

http://issues.castleproject.org/issue/FACILITIES-156