UseSqlServer Method showing error



This post will explain you about "UseSqlServer Method Missing error". when you work on asp.net core projects you need to configure db settings. To configure sql server database we will use following code.

       // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer("connectionString"));
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
        }

sometimes you will not find "UseSqlServer method" at that point of time . you need to check whether you have "Microsoft.EntityFrameworkCore.SqlServer" package is Installed or not. if at all if it is not installed you need it install it.

 

if you already have this package , and eventhough if you are getting error then add following namespace manually 

using Microsoft.EntityFrameworkCore;

 

Labels: UseSqlServer method missing , UseSqlServer not found , UseSqlServer not showing in intellisense
Subscribe

Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker