Skip to content

Instantly share code, notes, and snippets.

@masoodwasim
Created March 11, 2020 20:03
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 masoodwasim/fd7b10a892a2f2553762e2fc48e4a3f3 to your computer and use it in GitHub Desktop.
Save masoodwasim/fd7b10a892a2f2553762e2fc48e4a3f3 to your computer and use it in GitHub Desktop.
[assembly: WebJobsStartup(typeof(Startup))]
namespace SampleFunctionsApp
{
public class Startup : IWebJobsStartup
{
public void Configure(IWebJobsBuilder builder)
{
builder.Services.AddLogging(loggingBuilder =>
{
loggingBuilder.AddFilter(level => true);
});
var config = (IConfiguration)builder.Services.First(d => d.ServiceType == typeof(IConfiguration)).ImplementationInstance;
builder.Services.AddSingleton((s) =>
{
MongoClient client = new MongoClient(config["MONGO_CONNECTION_STRING"]);
return client;
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment