Ola pessoal boa tarde, Gostaria de uma ajuda, criei um projeto similar ao do curso, e estou com o seguinte erro, por favor podem me orientar ?
Segue o erro:
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'DbContextOptionsBuilder' could not be found (are you missing a using directive or an assembly reference?) ProjLocadora c:\users\diogo paes\documents\visual studio 2015\Projects\ProjLocadora\ProjLocadora\LocadoraContext.cs 12 Active
Severity Code Description Project File Line Suppression State
Error CS0115 'LocadoraContext.OnConfiguring(DbContextOptionsBuilder)': no suitable method found to override ProjLocadora c:\users\diogo paes\documents\visual studio 2015\Projects\ProjLocadora\ProjLocadora\LocadoraContext.cs 12 Active
Severity Code Description Project File Line Suppression State
Error CS1674 'LocadoraContext': type used in a using statement must be implicitly convertible to 'System.IDisposable' ProjLocadora c:\users\diogo paes\documents\visual studio 2015\Projects\ProjLocadora\ProjLocadora\Program.cs 28 Active
Severity Code Description Project File Line Suppression State
Error CS1061 'LocadoraContext' does not contain a definition for 'SaveChanges' and no extension method 'SaveChanges' accepting a first argument of type 'LocadoraContext' could be found (are you missing a using directive or an assembly reference?) ProjLocadora c:\users\diogo paes\documents\visual studio 2015\Projects\ProjLocadora\ProjLocadora\Program.cs 32 Active
Segue o código:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjLocadora
{
class Program
{
static void Main(string[] args)
{
GravarUsandoEntity();
}
private static void GravarUsandoEntity()
{
Cliente c = new Cliente();
c.nome = "Jose MAria";
c.cpf = "12312345612";
c.dataNasc = new DateTime (17,03,1987);
c.endereco = "Rua: jose da couves";
c.telefone = "44441111";
c.telefone2 = "12331111";
using (var contexto = new LocadoraContext())
{
contexto.Clientes.Add(c);
contexto.SaveChanges();
Console.Write("Por favor aperte qualquer tecla para cotinuar");
Console.ReadKey();
}
}
}
}