Skip to content

Instantly share code, notes, and snippets.

@itsmaheshkariya
Created February 1, 2020 14:33
Show Gist options
  • Save itsmaheshkariya/a0509c03005ae690eca112540a903868 to your computer and use it in GitHub Desktop.
Save itsmaheshkariya/a0509c03005ae690eca112540a903868 to your computer and use it in GitHub Desktop.
Dotnet notes
dotnet tool install --global dotnet-ef --version 3.0.0
dotnet ef
dotnet new web
@itsmaheshkariya
Copy link
Author

itsmaheshkariya commented Feb 1, 2020

services.AddDbContext<AspDbContext>(options =>
       options.UseSqlServer(config.GetConnectionString("optimumDB")));
pdate do not forget to add using Microsoft.EntityFrameworkCore; namespace```

@itsmaheshkariya
Copy link
Author

{
    "Data":{
        "CommandAPIConnaction":{
            "ConnectionString":"Server=127.0.0.1;Database=test;User=sa;Password=mahesh619619@Key;Trusted_Connection=False"
        }
    }
}

@itsmaheshkariya
Copy link
Author

itsmaheshkariya commented Feb 2, 2020

Startup class
using Swashbuckle.AspNetCore.Swagger;

Inside ConfigureServices

services.AddSwaggerGen(c => {
                c.SwaggerDoc("v1", new Info {Title="My Core API", Description="Swagger" });
 });

Inside Configure

app.UseSwagger();
           app.UseSwaggerUI(c =>
           {
               c.SwaggerEndpoint("/swagger/v1/swagger.json","Core API");
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment