Classes herdadas de DbContext dá erro
Não consigo criar essa classe:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Data.Entity.Design;
namespace Aleggro_Teste.DAL
{
public class ContextoFuncionario: DbContext==> Aqui dá o erro
{
}
}
Já tentei adicionar várias referências e nenhuma delas resolveu. No PM, tentei fazer esse install:
PM> install-package entityframework
E nada aconteceu. Como eu faço para resolver isso?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Data.Entity.Design;
namespace Aleggro_Teste.DAL
{
public class ContextoFuncionario: DbContext==> Aqui dá o erro
{
}
}
Já tentei adicionar várias referências e nenhuma delas resolveu. No PM, tentei fazer esse install:
PM> install-package entityframework
E nada aconteceu. Como eu faço para resolver isso?
Pjava
Curtidas 0
Respostas
Joel Rodrigues
22/06/2013
Qual é o erro exatamente? Por que a classe DbContezt fica dentro de System.Data.Entity.
GOSTEI 0
Pjava
22/06/2013
The type or namesapce name DbContext could not be found(are you missing a using directive or an assembly reference)
esse é o erro
esse é o erro
GOSTEI 0
Pjava
22/06/2013
Esse é o erro que dá ao instalar o pacote no NuGet, mas eu já tenho o Entity instalado
PM> install-package entityframework
install-package : An error occurred while loading packages from'https://nuget.org/api/v2/': The remote name could not be resolved: 'nuget.org'
At line:1 char:1
+ install-package entityframework
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM> install-package entityframework
install-package : An error occurred while loading packages from'https://nuget.org/api/v2/': The remote name could not be resolved: 'nuget.org'
At line:1 char:1
+ install-package entityframework
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
GOSTEI 0
Joel Rodrigues
22/06/2013
Dá uma olhada aqui: [url]http://msdn.microsoft.com/en-us/library/system.data.entity.dbcontext(v=vs.103).aspx[/url]. Parece que essa classe só está disponível no EF 5.0. Verifique se é isso.
GOSTEI 0
Pjava
22/06/2013
Não sei se é isso, mas no VS 2012 está funcionando com Framework 4.5 e MVC 4
GOSTEI 0
Joel Rodrigues
22/06/2013
Não sei se é isso, mas no VS 2012 está funcionando com Framework 4.5 e MVC 4
Ah, e não é no VS2012 que está dando erro?
GOSTEI 0
Pjava
22/06/2013
ão, o erro está dando é no VS 2010, Frame4 e MVC3
GOSTEI 0
Joel Rodrigues
22/06/2013
Rapaz, pelas pesquisas que fiz, a classe DbContext foi incluída no EF 4.1.
GOSTEI 0
Pjava
22/06/2013
Teria que dá um Up no meu Frame de 4 para 4.1, é isso? Bem, estou começando com o Vs2012 e nele não tenho problemas. Só como aprendizado mesmo.
GOSTEI 0
Joel Rodrigues
22/06/2013
Em teoria seria isso mesmo, atualizar para a versão 4.1.
GOSTEI 0