2

I have three .NET 4.5 projects Example.Mvc (Mvc 5), Example.UnitTest, Example.Data. I loaded Dynamic Linq Library v1.1.13 from NuGet into my data layer "Example.Data" project. Example.Data uses Entity Framework 6 in which I would like to use the Dynamic Linq like so:

var list = db.ExtendedUserAccounts
                        .Where(x => x.LastName.Contains("doe"))
                        .OrderBy("LastName, DateOfBirth asc")
                        .Skip(numberOfResultsPerPage * (pageNumber - 1))
                        .Take(numberOfResultsPerPage);
                    return list.ToList();

The Example.UnitTest project calls the method flawlessly. However, the Example.Mvc project, which references the same Example.Data project, throws the following exception:

System.Reflection.ReflectionTypeLoadException

"Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information."

The LoaderException says:

System.IO.FileNotFoundException

{"Could not load file or assembly 'Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The system cannot find the file specified.":"Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc"}

I never got this error before trying to use Dynamic Linq.

UPDATE:

I made the error go away by referencing the old DLLs of Castle.DynamicProxy2, Castle.Core, and log4net. I found them on RubyGems.org. I really do not like this fix because the assemblies are outdated and I may run into some compatability/assembly redirect issues in the future, but what can I do?

jaybro
  • 1,363
  • 1
  • 12
  • 23

0 Answers0