Boa Noite ! Conforme a orientação do instrutor na aula 06 instalei os pacotes do Sql Server com sucesso, mais na hora de configura o STARTUP acrescentei o metado ;
(options => options.UseSqlServer(connectionString));
. Mais o visual studio não reconhece esse metado (UseSqlServer) o instrutor informa para acrescentar a referencia (using Microsoft.EntityFrameworkCore;) para visual studio reconhecer o metado, mais mesmo acrescentando a referencia o metado ainda não foi reconhecido., o visual studio continua reclamando, detalhe estou utilizando SqlServer 2017. Aguardo uma solução !
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore;
namespace CasaDoCodigo
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
string connectionString= @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=CasaDoCodigo;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";
services.AddDbContext<Contexto>(options => options.UseSqlServer(connectionString)); // METADO NÃO RECONHECIDO : USESQLSERVER
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Pedido}/{action=Carrossel}/{id?}");
});
}
}
}