Compiling SubSonic 3.0.0.4 from sources
I downloaded SubSonic 3.0.0.4 sources from https://github.com/subsonic/SubSonic开发者_JS百科-3.0 and compiled it using Visual Studio 2010. When I add the compiled SubSonic.Core.dll to my own project and try to use the SimpleRepository like this
SimpleRepository repo = new SimpleRepository(ProviderFactory.GetProvider(connectionString, "System.Data.SqlClient"), SimpleRepositoryOptions.RunMigrations);
the dll crashes:
An unhandled exception of type 'System.TypeInitializationException' occurred in SubSonic.Core.dll
Additional information: The type initializer for 'SubSonic.DataProviders.DynamicProxyInterceptionStrategy' threw an exception.
Crash occurs at SubSonic's DbDataProvider.cs on line 56:
InterceptionStrategy = new DynamicProxyInterceptionStrategy(this);
All works fine if I download ready-made SubSonic.Core.dll from the project's web site and use it. But I wanted to compile it myself, because I'll try to do some modifications on it later.
Thanks
BapuI've had success with downloading the latest revision from Git and upgrading Subsonic in an existing project (which has a Microsoft SQL database). I first compiled the Subsonic.Core project, swapped my old dll with the new and had the same error as you.
The inner exception states that it's missing a reference to Castle.Core. Just add a reference to Caste.Core with is found in the /lib folder and you should be good to go.
Adding the Castle.Core.dll, solved the same issue for me.
精彩评论