Skip to content

Instantly share code, notes, and snippets.

@jeffhollan
Created May 29, 2019 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffhollan/1f51c8ee2478af013e1c1311c4cb1966 to your computer and use it in GitHub Desktop.
Save jeffhollan/1f51c8ee2478af013e1c1311c4cb1966 to your computer and use it in GitHub Desktop.
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;
[assembly: FunctionsStartup(typeof(functions_csharp_entityframeworkcore.Startup))]
namespace functions_csharp_entityframeworkcore
{
class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
string SqlConnection = Environment.GetEnvironmentVariable("SqlConnectionString");
builder.Services.AddDbContext<BloggingContext>(
options => options.UseSqlServer(SqlConnection));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment