How do I use DotNet Migrations in .Net Core when my Model and Repository are in a class library? - entity-framework-core

I am following this article/tutorial on how to make a generic repository for ASP.Net Core at:
http://www.c-sharpcorner.com/article/generic-repository-pattern-in-asp-net-core/
When I download the code I am able to run the migrations and the project runs and works.
But when I follow the directions and try to build from scratch, then when I get to the point where I have to run the migrations:
Add-migration MyFirstMigration
I get this error:
C:\Tutorials\ASP.Net\Core\GenericRepository\FromScratch\GenericReposotory\GR.Web\project.json(20,43): warning NU1012: Dependency conflict. Microsoft.EntityFrameworkCore 1.1.0 expected Microsoft.Extensions.Logging >= 1.1.0 but received 1.0.0 No parameterless constructor was found on 'ApplicationContext'. Either add a parameterless constructor to 'ApplicationContext' or add an implementation of 'IDbContextFactory' in the same assembly as 'ApplicationContext'.
The tutorial had the model and repo defined in a class library including this:
namespace GR.Data
{
public class ApplicationContext : DbContext
{
public ApplicationContext(DbContextOptions<ApplicationContext> options)
: base(options) { }
protected override void OnModelCreating(ModelBuilder modelBuilder){
base.OnModelCreating(modelBuilder);
new AuthorMap(modelBuilder.Entity<Author>());
new BookMap(modelBuilder.Entity<Book>());
}
}
}
The options are passed in from StartUp.cs in the Web Project like this:
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
services.AddMvc();
services.AddDbContext<ApplicationContext>(
options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
}
And it gets the connection string from appsettings.json in the Web Project: GR.Web.
In the Package Manager Console I have GR.Data selected as the default project and GR.Web set as the startup project. I get this error:
C:\Tutorials\ASP.Net\Core\GenericRepository\FromScratch\GenericReposotory\GR.Web\project.json(20,43): warning NU1012: Dependency conflict. Microsoft.EntityFrameworkCore 1.1.0 expected Microsoft.Extensions.Logging >= 1.1.0 but received 1.0.0 No parameterless constructor was found on 'ApplicationContext'. Either add a parameterless constructor to 'ApplicationContext' or add an implementation of 'IDbContextFactory' in the same assembly as 'ApplicationContext'.
How is the download working and how do I get mine to work.
so confused.
On top of it I had to fool around with it forever to get all the depenanceies on EF Core and Tools Preview on the right versions to get this far.
Is there a better article somewhere on how to do this?
I fixed:
"Microsoft.Extensions.Logging": "1.0.0",
to
"Microsoft.Extensions.Logging": "1.1.0",
and now I get this error:
System.TypeLoadException: Method 'Apply' in type 'Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.RelationalColumnAttributeConvention' from assembly 'Microsoft.EntityFrameworkCore.Relational, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation. at Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.RelationalConventionSetBuilder.AddConventions(ConventionSet conventionSet)
at Microsoft.EntityFrameworkCore.Metadata.Conventions.SqlServerConventionSetBuilder.AddConventions(ConventionSet conventionSet)
at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder, IModelValidator validator)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
at Microsoft.EntityFrameworkCore.Internal.LazyRef1.get_Value()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass16_0.<RealizeService>b__0(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.Design.MigrationsOperations.AddMigration(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Tools.Cli.MigrationsAddCommand.Execute(CommonOptions commonOptions, String name, String outputDir, String context, String environment, Action1 reporter)
at Microsoft.EntityFrameworkCore.Tools.Cli.MigrationsAddCommand.<>c__DisplayClass0_0.b__0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Cli.Program.Main(String[] args)
Method 'Apply' in type 'Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal.RelationalColumnAttributeConvention' from assembly 'Microsoft.EntityFrameworkCore.Relational, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not ha ve an implementation.

In dependancies for the Web Project, GR.Web, I rolled back
"Microsoft.EntityFrameworkCore": "1.1.0"
to
"Microsoft.EntityFrameworkCore": "1.0.1"
and now it works.

Related

Liberty class loading issues or problem with hibernate (migrating tomcat app on liberty)?

i have to deploy a multi-module application in ear on Liberty Server 20 in my Eclipse. This application use hibernate as provider jpa2 and Derby client + driver derby-10.12.1.1.jar(as shared fileset). Persistence.xml is configured with non jta.
This is server.xml:
<enterpriseApplication id="rubrica-ear" location="rubrica-ear.ear" name="rubrica-ear"/>
<dataSource jndiName="jdbc/TestappDS" type="javax.sql.ConnectionPoolDataSource">
<properties.derby.client createDatabase="false" databaseName=".rubrica"></properties.derby.client>
<jdbcDriver>
<library>
<fileset dir="C:\programmiMio\java-eclipse\drivers" id="shared"></fileset>
</library>
</jdbcDriver>
</dataSource>
My .rubrica db location is in /usr/home.
Because I dont want to start a server derby on console but automatically, i do taht in a #WebListener class:
#WebListener
public class ReqListener implements ServletContextListener {
static final Logger log = LoggerFactory.getLogger(ReqListener.class);
PrintWriter pw = new PrintWriter(System.out);
private NetworkServerControl derbyserver;
#Override
public void contextInitialized(ServletContextEvent arg0) {
try {
String userHomeDir = System.getProperty("user.home", ".");
String systemDir = userHomeDir + "/.rubrica";
// Set the db system directory and startup Server Derby for incoming connections.
System.setProperty("derby.system.home", systemDir);//il db viene salvato qui
derbyserver = new NetworkServerControl(InetAddress.getByName("localhost"), 1527);
derbyserver.start(pw);
log.info("Apache derby settings ok");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.error(e.getMessage());
}
}
#Override
public void contextDestroyed(ServletContextEvent arg0) {
if (derbyserver!=null){
...
}
}
When i deploy i get this error
[ERROR] An error occurred in the org.hibernate.ejb.HibernatePersistence persistence provider when attempting to create the entity manager factory of the testapp persistence unit container. The following error occurred: java.lang.NullPointerException
at org.hibernate.engine.jdbc.spi.TypeInfo.extractTypeInfo(TypeInfo.java:128)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:163)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:67)
at com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:919)
at [internal classes]
When I debug on Liberty i see that Hibernate classes running before the #WebListener code (this is not the same thing in Tomcat), how can i resolve this issue? Something about class loading settings?
I try derby Embedded instead, but problem still araise again, in server.xml:
<properties.derby.embedded createDatabase="create" databaseName="C:/Users/myuser/.rubrica" shutdownDatabase="false"/>
<jdbcDriver>
<library>
<fileset dir="C:\programmiMio\java-eclipse\drivers" id="shared-libs"/>
</library>
</jdbcDriver>
Thanks
Roberto

Could not load type 'Microsoft.EntityFrameworkCore.Query.RelationalQueryContextFactory' Z.EntityFramework.Plus.EFCore

I have written a simple query which was working when I was using .net core 2.1 (I have used Z.EntityFramework.Plus.EFCore)
int cnt = adminDb.Role.Where(c => c.RoleId == roleId).Delete();
After upgrading to .net core 3.1 I am getting the error below.
Could not load type 'Microsoft.EntityFrameworkCore.Query.RelationalQueryContextFactory' from assembly 'Microsoft.EntityFrameworkCore.Relational, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Source : Z.EntityFramework.Plus.EFCore
StackTrace : at Z.EntityFramework.Plus.InternalExtensions.GetDbContext[T](IQueryable`1 source)
at Z.EntityFramework.Plus.BatchDelete.Execute[T](IQueryable`1 query)
at Z.EntityFramework.Plus.BatchDeleteExtensions.Delete[T](IQueryable`1 query, Action`1 batchDeleteBuilder)
at Z.EntityFramework.Plus.BatchDeleteExtensions.Delete[T](IQueryable`1 query)
at Assyst.Administration.API.Controllers.RoleMenuMappingController.SavePermission(Nullable`1 roleMenuMasterId, IList`1 roleMenu) in E:\Source\Main_Projects\Application\PanERP-7\Error\Administration\Admin\Controllers\RoleMenuMappingController.cs:line 365
I am receiving this error and I'm not sure what it means?

Getting error while connecting to jpa using micronaut-data-hibernate-jpa library

I want to use JPA for micronaut. For that I am using io.micronaut.data:micronaut-data-hibernate-jpa:1.0.0.M1 library. Whenever I run my application and hit the endpoint to get the data, I get the following error:
{
message: "Internal Server Error: No backing RepositoryOperations configured for repository. Check your configuration and try again"
}
I tried looking up for errors but I couldn't find one. Attaching my files here. Please help.
build.gradle
plugins {
id "net.ltgt.apt-eclipse" version "0.21"
id "com.github.johnrengelman.shadow" version "5.0.0"
id "application"
}
version "0.1"
group "micronaut.test"
repositories {
mavenCentral()
maven { url "https://jcenter.bintray.com" }
}
configurations {
// for dependencies that are needed for development only
developmentOnly
}
dependencies {
annotationProcessor platform("io.micronaut:micronaut-bom:$micronautVersion")
annotationProcessor "io.micronaut:micronaut-inject-java"
annotationProcessor "io.micronaut:micronaut-validation"
annotationProcessor "org.projectlombok:lombok:1.16.20"
annotationProcessor 'io.micronaut.data:micronaut-data-processor:1.0.0.M1'
implementation platform("io.micronaut:micronaut-bom:$micronautVersion")
compile 'io.micronaut.data:micronaut-data-hibernate-jpa:1.0.0.M1'
implementation "io.micronaut:micronaut-inject"
implementation "io.micronaut:micronaut-validation"
implementation "io.micronaut:micronaut-runtime"
implementation "io.micronaut:micronaut-http-server-netty"
implementation "io.micronaut:micronaut-http-client"
implementation 'nl.topicus:spanner-jdbc:1.1.5'
runtimeOnly "ch.qos.logback:logback-classic:1.2.3"
testAnnotationProcessor platform("io.micronaut:micronaut-bom:$micronautVersion")
testAnnotationProcessor "io.micronaut:micronaut-inject-java"
testImplementation "org.junit.jupiter:junit-jupiter-api"
testCompile "org.junit.jupiter:junit-jupiter-engine:5.1.0"
testImplementation "io.micronaut.test:micronaut-test-junit5"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}
test.classpath += configurations.developmentOnly
mainClassName = "micronaut.test.Application"
// use JUnit 5 platform
test {
useJUnitPlatform()
}
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
options.compilerArgs.add('-parameters')
}
shadowJar {
mergeServiceFiles()
}
run.classpath += configurations.developmentOnly
run.jvmArgs('-noverify', '-XX:TieredStopAtLevel=1', '-Dcom.sun.management.jmxremote')
Repository:
package micronaut.test.repo;
import io.micronaut.data.annotation.Repository;
import io.micronaut.data.repository.CrudRepository;
import micronaut.test.entity.Partner;
#Repository
public interface PartnerRepository extends CrudRepository<Partner,Integer> {
}
Service:
package micronaut.test.service;
import micronaut.test.entity.Partner;
import micronaut.test.repo.PartnerRepository;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List;
#Singleton
public class SpannerService {
private PartnerRepository partnerRepository;
#Inject
public SpannerService(PartnerRepository partnerRepository) {
this.partnerRepository = partnerRepository;
}
public List<Partner> getPartners() {
return (List<Partner>) partnerRepository.findAll();
}
}
Controller:
package micronaut.test.controller;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Produces;
import micronaut.test.entity.Partner;
import micronaut.test.service.SpannerService;
import javax.inject.Inject;
import java.util.List;
#Controller("/micronaut")
public class MainController {
private SpannerService spannerService;
#Inject
public MainController(SpannerService spannerService) {
this.spannerService = spannerService;
}
#Get("/data")
#Produces(MediaType.APPLICATION_JSON)
public List<Partner> getPartners() {
return spannerService.getPartners();
}
}
stacktrace:
io.micronaut.context.exceptions.ConfigurationException: No backing RepositoryOperations configured for repository. Check your configuration and try again
at io.micronaut.data.intercept.DataIntroductionAdvice.findInterceptor(DataIntroductionAdvice.java:108)
at io.micronaut.data.intercept.DataIntroductionAdvice.intercept(DataIntroductionAdvice.java:76)
at io.micronaut.aop.MethodInterceptor.intercept(MethodInterceptor.java:40)
at io.micronaut.aop.chain.InterceptorChain.proceed(InterceptorChain.java:150)
at micronaut.test.repo.PartnerRepository$Intercepted.findAll(Unknown Source)
at micronaut.test.service.SpannerService.getPartners(SpannerService.java:22)
at micronaut.test.controller.MainController.getPartners(MainController.java:32)
at micronaut.test.controller.$MainControllerDefinition$$exec2.invokeInternal(Unknown Source)
at io.micronaut.context.AbstractExecutableMethod.invoke(AbstractExecutableMethod.java:144)
at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:2792)
at io.micronaut.web.router.AbstractRouteMatch.execute(AbstractRouteMatch.java:235)
at io.micronaut.web.router.RouteMatch.execute(RouteMatch.java:122)
at io.micronaut.http.server.netty.RoutingInBoundHandler.lambda$buildResultEmitter$19(RoutingInBoundHandler.java:1408)
at io.reactivex.internal.operators.flowable.FlowableCreate.subscribeActual(FlowableCreate.java:71)
at io.reactivex.Flowable.subscribe(Flowable.java:14918)
at io.reactivex.Flowable.subscribe(Flowable.java:14865)
at io.micronaut.reactive.rxjava2.RxInstrumentedFlowable.subscribeActual(RxInstrumentedFlowable.java:68)
at io.reactivex.Flowable.subscribe(Flowable.java:14918)
at io.reactivex.internal.operators.flowable.FlowableMap.subscribeActual(FlowableMap.java:37)
at io.reactivex.Flowable.subscribe(Flowable.java:14918)
at io.reactivex.Flowable.subscribe(Flowable.java:14865)
at io.micronaut.reactive.rxjava2.RxInstrumentedFlowable.subscribeActual(RxInstrumentedFlowable.java:68)
at io.reactivex.Flowable.subscribe(Flowable.java:14918)
at io.reactivex.internal.operators.flowable.FlowableSwitchIfEmpty.subscribeActual(FlowableSwitchIfEmpty.java:32)
at io.reactivex.Flowable.subscribe(Flowable.java:14918)
at io.reactivex.Flowable.subscribe(Flowable.java:14865)
at io.micronaut.reactive.rxjava2.RxInstrumentedFlowable.subscribeActual(RxInstrumentedFlowable.java:68)
at io.reactivex.Flowable.subscribe(Flowable.java:14918)
at io.reactivex.Flowable.subscribe(Flowable.java:14868)
at io.micronaut.http.context.ServerRequestTracingPublisher.lambda$subscribe$0(ServerRequestTracingPublisher.java:52)
at io.micronaut.http.context.ServerRequestContext.with(ServerRequestContext.java:52)
at io.micronaut.http.context.ServerRequestTracingPublisher.subscribe(ServerRequestTracingPublisher.java:52)
at io.reactivex.internal.operators.flowable.FlowableFromPublisher.subscribeActual(FlowableFromPublisher.java:29)
at io.reactivex.Flowable.subscribe(Flowable.java:14918)
at io.reactivex.Flowable.subscribe(Flowable.java:14865)
at io.micronaut.reactive.rxjava2.RxInstrumentedFlowable.subscribeActual(RxInstrumentedFlowable.java:68)
at io.reactivex.Flowable.subscribe(Flowable.java:14918)
at io.reactivex.Flowable.subscribe(Flowable.java:14865)
at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.run(FlowableSubscribeOn.java:82)
at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker$BooleanRunnable.run(ExecutorScheduler.java:288)
at io.reactivex.internal.schedulers.ExecutorScheduler$ExecutorWorker.run(ExecutorScheduler.java:253)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.micronaut.data.operations.RepositoryOperations] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:1903)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:582)
at io.micronaut.data.intercept.DataIntroductionAdvice.findInterceptor(DataIntroductionAdvice.java:105)
... 43 common frames omitted
Micronaut currently supports only Tomcat JDBC, Apache DBCP2 and Hikari data sources providers out of the box (see https://micronaut-projects.github.io/micronaut-sql/latest/guide/#jdbc).
You can add this line into your build.gradle which adds Tomcat JDBC Data Source provider implementation into your project:
runtime "io.micronaut.configuration:micronaut-jdbc-tomcat"
Or you can choose another implementations like Apache DBCP2:
runtime "io.micronaut.configuration:micronaut-jdbc-dbcp"
Or Hikari:
runtime "io.micronaut.configuration:micronaut-jdbc-hikari"
For nl.topicus:spanner-jdbc data source provider you have to implement your own DatasourceFactory and DatasourceConfiguration for Micronaut because there is no one yet.
You can inspire your self in io.micronaut.configuration:micronaut-jdbc-tomcat. Sources are here: https://github.com/micronaut-projects/micronaut-sql/tree/master/jdbc-tomcat/src/main/java/io/micronaut/configuration/jdbc/tomcat
For example DatasourceFactory can then look like this:
#Factory
public class DatasourceFactory implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(DatasourceFactory.class);
private List<nl.topicus.jdbc.CloudSpannerDataSource> dataSources = new ArrayList<>(2);
private final DataSourceResolver dataSourceResolver;
/**
* Default constructor.
* #param dataSourceResolver The data source resolver
*/
public DatasourceFactory(#Nullable DataSourceResolver dataSourceResolver) {
this.dataSourceResolver = dataSourceResolver == null ? DataSourceResolver.DEFAULT : dataSourceResolver;
}
/**
* #param datasourceConfiguration A {#link DatasourceConfiguration}
* #return An Apache Tomcat {#link DataSource}
*/
#Context
#EachBean(DatasourceConfiguration.class)
public DataSource dataSource(DatasourceConfiguration datasourceConfiguration) {
nl.topicus.jdbc.CloudSpannerDataSource ds = new nl.topicus.jdbc.CloudSpannerDataSource();
ds.setJdbcUrl(datasourceConfiguration.getJdbcUrl());
...
dataSources.add(ds);
return ds;
}
#Override
#PreDestroy
public void close() {
for (nl.topicus.jdbc.CloudSpannerDataSource dataSource : dataSources) {
try {
dataSource.close();
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Error closing data source [" + dataSource + "]: " + e.getMessage(), e);
}
}
}
}
}
Anyway you can still use Google Cloud Spanner DB with Data Source providers like Hikari and Apache DBCP2. For example:
runtime 'nl.topicus:spanner-jdbc:1.1.5'
runtime "io.micronaut.configuration:micronaut-jdbc-hikari"
The first line adds JDBC driver and the second line adds Data Source provider which will use the spanner-jdbc JDBC driver.
It is known that the Google Cloud Spanner uses another dialect than other databases for Hibernate ORM. I think that this dialect is pretty new. Take a look over this repository 1. Maybe it will be useful for you, not necessary for solving your current issue, but giving you some other perspective.

Could not load type 'Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy' when installing on Sitefinity 8.1.5800

I am trying to install Babaganoush on Sitefinity 8.1.5800 which has assembly redirects in place. I am getting the exception below and would like to know if anyone else has seen this?
Could not load type 'Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy' from assembly 'Telerik.Sitefinity, Version=8.1.5800.0, Culture=neutral, PublicKeyToken=b28c218413bdf563'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type 'Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy' from assembly 'Telerik.Sitefinity, Version=8.1.5800.0, Culture=neutral, PublicKeyToken=b28c218413bdf563'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[TypeLoadException: Could not load type 'Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy' from assembly 'Telerik.Sitefinity, Version=8.1.5800.0, Culture=neutral, PublicKeyToken=b28c218413bdf563'.]
Babaganoush.Sitefinity.Utilities.ConfigHelper.RegisterToolboxWidget(String title, String description, String cssClass, String resourceClassId, String layoutTemplate, String sectionName, Nullable1 sectionOrdinal, ToolboxType toolboxType) +0
Babaganoush.Sitefinity.Mvc.Startup.OnBootstrapperInitialized(Object sender, ExecutedEventArgs e) +704
System.EventHandler1.Invoke(Object sender, TEventArgs e) +0
Telerik.Sitefinity.Abstractions.Bootstrapper.Bootstrap() +906
Telerik.Sitefinity.Web.SitefinityHttpModule.Init(HttpApplication context) +400
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +530
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475
[HttpException (0x80004005): Could not load type 'Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy' from assembly 'Telerik.Sitefinity, Version=8.1.5800.0, Culture=neutral, PublicKeyToken=b28c218413bdf563'.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12618692
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12458309
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34249
The MvcControllerProxy type is now in the Telerik.Sitefinity.Mvc assembly.
You'll probably have to wait for the guys at Falafel to release a version that targets Sitefinity 8.1

asp.net mvc site Upload error

I have a website developed in the asp.net mvc 2 .
I have this error after upload my project on public domain server.(like Godaddy)
Method not found: 'System.String System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, System.String, System.String, System.String)'.
The brief is :
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MissingMethodException: Method not found: 'System.String System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, System.String, System.String, System.String)'.
Source Error:
Line 50:
< div class="nav_box" >
Line 51: < ul >
Line 52: < %= Html.MenuItem(Resources.Global.Home, "Index", "Home")%> //**Getting error here.**
Line 53: < %= Html.MenuItem(Resources.Global.Search, "Index", "Search")%>
Line 54: < %= Html.MenuItem(Resources.Global.Chemistry, "Chemistry", "Dating")%>
Source File: d:\hostfolder\61231230\html\test\Views\Shared\NewGeneral.Master Line: 52
Stack Trace:
[MissingMethodException: Method not found: 'System.String System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, System.String, System.String, System.String)'.]
DatingScript.Helpers.MenuItemHelper.MenuItem(HtmlHelper helper, String linkText, String actionName, String controllerName) in MenuItemHelper.cs:34
ASP.views_shared_newgeneral_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\hostfolder\6954170\html\test\Views\Shared\NewGeneral.Master:52
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +59
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266
Check the version number of the DLL containing the mentioned namespace and verify that you are using the correct/expected version.
I have experienced something similar today when I suddenly got the message:
"Method not found: 'System.String Sitecore.Web.WebUtil.GetSafeQueryString(System.String)'."
when trying to access the sitecore shell.
As I am developing within a development team I had to do a bit of analysis of the DLL's in the bin folder as there were no build errors in my build and the the referenced namespace is placed within a Sitecore dll.
When I compared my failing Sitecore.Kernel.dll file version with a Sitecore.Kernel.dll version from a working solution I found a difference in version number and that the Sitecore dll was copied from a repository that I had'nt updated recently.