Could not load file or assembly NHibernate.ByteCode.Castle

195 views
Skip to first unread message

von

unread,
Feb 7, 2012, 10:46:16 AM2/7/12
to S#arp Architecture
I am trying to upgrade my 2.0 application to 2.0.1. After I updated
the referenced assemblies I got the following exception: Could not
load file or assembly 'NHibernate.ByteCode.Castle' or one of its
dependencies. The system cannot find the file specified. I was able to
resolve this by removing "proxyfactory.factory_class" from
NHibernate.config file. But now I encounter another issue that goes
something like: Object of type
'SharpArch.NHibernate.LinqRepository`1[MyEntity]' cannot be converted
to type
'SharpArch.Domain.PersistenceSupport.ILinqRepository`1[MyEntity]'.

What seems to be the problem here?

Seif Attar

unread,
Feb 7, 2012, 11:03:30 AM2/7/12
to sharp-arc...@googlegroups.com
Can you provide full stack trace and your castle repository registrations?



Sent from my phone


--
You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
To post to this group, send email to sharp-arc...@googlegroups.com.
To unsubscribe from this group, send email to sharp-architect...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sharp-architecture?hl=en.

Voltaire Villafuerte

unread,
Feb 7, 2012, 12:09:25 PM2/7/12
to sharp-arc...@googlegroups.com
Hi Seif,

Actually, to make sure I have everything setup correctly in my project for the 2.0.1 version, I created a new project. Point to a database with one table and one (string) field. I then did a query in the HomeController using LinqRepo so I have this:

public HomeController(ILinqRepository<Meal> mealRepo)
        {
            this.mealRepo = mealRepo;
        }

public ActionResult Index()
        {
            var meals = mealRepo.FindAll();
            return View();
        }

In the ComponentRegistrar I registered the LinqRepo inside AddGenericRepositoriesTo method and so I have this:

container.Register(
                Component.For(typeof(ILinqRepository<>))
                    .ImplementedBy(typeof(LinqRepository<>))
                    .Named("linqRepository"));

That used to work in 2.0RC. So I thought maybe I should also register ILinqRepositoryWithTypedId to follow what was done for "INHibernateRepository" and so I have this in the code:

  container.Register(
                Component.For(typeof(ILinqRepository<>))
                    .ImplementedBy(typeof(LinqRepository<>))
                    .Named("linqRepository"));

            container.Register(
                Component.For(typeof(ILinqRepositoryWithTypedId<,>))
                    .ImplementedBy(typeof(LinqRepositoryWithTypedId<,>))
                    .Named("linqRepositoryWithTypedId"));

But I still got the same error:

Object of type 'SharpArch.NHibernate.LinqRepository`1[SA_Test.Domain.Person]' cannot be converted to type 'SharpArch.Domain.PersistenceSupport.ILinqRepository`1[SA_Test.Domain.Person]'.

Seif Attar

unread,
Feb 7, 2012, 1:16:33 PM2/7/12
to sharp-arc...@googlegroups.com
I actually did that! :S Had noticed that we were missing
LinqRepositoryWithTypedId<T, TId> added it and implemented and made
LinqRepository<T> inherit it, but forgot to add that it implements
ILinqRepository<T> :S

I have pushed a patch release to nuget (2.0.2), if you just run
update-package in the nuget package manager console it should upgrade
to latest version ;)

On 7 February 2012 17:09, Voltaire Villafuerte

Seif Attar

unread,
Feb 7, 2012, 1:19:17 PM2/7/12
to sharp-arc...@googlegroups.com
Thanks for baring with me!

Voltaire Villafuerte

unread,
Feb 7, 2012, 8:05:55 PM2/7/12
to sharp-arc...@googlegroups.com
You are most welcome Seif!

And great it works now. Thanks!
Reply all
Reply to author
Forward
0 new messages