Giter VIP home page Giter VIP logo

Comments (4)

peteharrison avatar peteharrison commented on June 20, 2024 1

Ok so I worked it out!
The issue was that I was trying to inject entity framework core using the Function Monkey IFunctionAppConfiguration builder. You actually need to register other dependencies through the standard Startup.cs dependency injection.. as per below.

using FunctionMonkeyTest.Models;
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;

[assembly: FunctionsStartup(typeof(FunctionMonkeyTest.Startup))]

namespace FunctionMonkeyTest
{
class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
string SqlConnection = Environment.GetEnvironmentVariable("AuthDBConnectionString");
builder.Services.AddDbContext(
options => options.UseSqlServer(SqlConnection));
}
}
}

from functionmonkey.

AKomyshan avatar AKomyshan commented on June 20, 2024

What version of Function Monkey do you use?

from functionmonkey.

peteharrison avatar peteharrison commented on June 20, 2024

What version of Function Monkey do you use?

I was using the latest beta version v4.0.56-beta.4

What should I be using? I followed all of the instructions on the getting started page and had everything working fine until I tried to add entity framework dependency injection via the function app configuration... On thinking about this, is the Function Monkey IFunctionAppConfiguration only to be used to put DI for Function Monkey specific things and if I want to inject other services I.e. Entity Framework then I should use the standard Microsoft Dependency Injection Function Startup? Maybe that is where I am going wrong?

from functionmonkey.

AKomyshan avatar AKomyshan commented on June 20, 2024

I am using the same version of the package. And also i see:
image

Im not sure but maybe problem in Microsoft.NET.Sdk.Functions package. Which version of Microsoft.NET.Sdk.Functions are you using?

from functionmonkey.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.