<i id='FfzPc'><tr id='FfzPc'><dt id='FfzPc'><q id='FfzPc'><span id='FfzPc'><b id='FfzPc'><form id='FfzPc'><ins id='FfzPc'></ins><ul id='FfzPc'></ul><sub id='FfzPc'></sub></form><legend id='FfzPc'></legend><bdo id='FfzPc'><pre id='FfzPc'><center id='FfzPc'></center></pre></bdo></b><th id='FfzPc'></th></span></q></dt></tr></i><div id='FfzPc'><tfoot id='FfzPc'></tfoot><dl id='FfzPc'><fieldset id='FfzPc'></fieldset></dl></div>
      <bdo id='FfzPc'></bdo><ul id='FfzPc'></ul>
    <tfoot id='FfzPc'></tfoot>
      <legend id='FfzPc'><style id='FfzPc'><dir id='FfzPc'><q id='FfzPc'></q></dir></style></legend>

      <small id='FfzPc'></small><noframes id='FfzPc'>

      Azure Functions 中的 DI

      DI in Azure Functions(Azure Functions 中的 DI)
        <tbody id='IVV4B'></tbody>

        • <small id='IVV4B'></small><noframes id='IVV4B'>

          <legend id='IVV4B'><style id='IVV4B'><dir id='IVV4B'><q id='IVV4B'></q></dir></style></legend>

            <tfoot id='IVV4B'></tfoot>

              <i id='IVV4B'><tr id='IVV4B'><dt id='IVV4B'><q id='IVV4B'><span id='IVV4B'><b id='IVV4B'><form id='IVV4B'><ins id='IVV4B'></ins><ul id='IVV4B'></ul><sub id='IVV4B'></sub></form><legend id='IVV4B'></legend><bdo id='IVV4B'><pre id='IVV4B'><center id='IVV4B'></center></pre></bdo></b><th id='IVV4B'></th></span></q></dt></tr></i><div id='IVV4B'><tfoot id='IVV4B'></tfoot><dl id='IVV4B'><fieldset id='IVV4B'></fieldset></dl></div>
                <bdo id='IVV4B'></bdo><ul id='IVV4B'></ul>
                本文介绍了Azure Functions 中的 DI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在我的 ASP.NET Web API 应用程序中使用了一些类库来处理我的所有后端内容,例如对 Azure SQL 数据库、Cosmos DB 等多个数据库的 CRUD 操作.

                I have some class libraries that I use in my ASP.NET Web API app that handle all my backend stuff e.g. CRUD operations to multiple databases like Azure SQL Database, Cosmos DB, etc.

                我不想重新发明轮子并能够在我在 Visual Studio 2017 中创建的新 Azure Functions 中使用它们.我所有的存储库方法都使用一个接口.那么,我将如何在我的新 Azure 函数中实现依赖注入?

                I don't want to re-invent the wheel and able to use them in a new Azure Functions that I'm creating in Visual Studio 2017. All my repository methods use an interface. So, how will I implement dependency injection in my new Azure function?

                我没有看到任何对 DI 的支持,但我有点困惑.Azure Functions 似乎基于与 WebJobs 相同的 SDK,我认为去年微软已经开始在 WebJobs 中支持 DI - 我很确定,因为我使用 Ninject 实现了它.

                I'm not seeing any support for DI but I'm a bit confused. It appears Azure Functions are based on the same SDK as WebJobs and I think last year Microsoft had started supporting DI in WebJobs - I know for sure because I implemented it using Ninject.

                有没有办法让我可以在新的 Azure Functions 项目中使用现有的库?

                Is there way around this so that I can use my existing libraries in my new Azure Functions project?

                推荐答案

                除了服务定位器(反)模式,我还看到了这两种技术.我也询问了 Azure Functions 团队的意见.

                I see these two techniques in addition to the service locator (anti)pattern. I asked the Azure Functions team for their comments as well.

                https://blog.wille-zone.de/post/azure-functions-dependency-injection/

                https://blog.wille-zone.de/post/azure-functions-proper-dependency-injection/

                这篇关于Azure Functions 中的 DI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                What is the difference between Funclt;string,stringgt; and delegate?(Funclt;string,stringgt; 有什么区别?和委托?)
                What is the difference between lt;%: and lt;%= in ASP.NET MVC?(ASP.NET MVC 中的 lt;%: 和 lt;%= 有什么区别?)
                linq query for tag system - search for multiple tags(标签系统的 linq 查询 - 搜索多个标签)
                Forum tags. What is the best way to implement them?(论坛标签.实施它们的最佳方法是什么?)
                html script tag not using type javascript lt;script type=quot;text/htmlquot;gt;?(html 脚本标签未使用类型 javascript lt;script type=quot;text/htmlgt;gt;?)
                ASP.NET Control to HTML tag equivalent(ASP.NET 控件到 HTML 标记等效)
                  <tbody id='J7ZvD'></tbody>
                <tfoot id='J7ZvD'></tfoot>
                • <bdo id='J7ZvD'></bdo><ul id='J7ZvD'></ul>

                    <i id='J7ZvD'><tr id='J7ZvD'><dt id='J7ZvD'><q id='J7ZvD'><span id='J7ZvD'><b id='J7ZvD'><form id='J7ZvD'><ins id='J7ZvD'></ins><ul id='J7ZvD'></ul><sub id='J7ZvD'></sub></form><legend id='J7ZvD'></legend><bdo id='J7ZvD'><pre id='J7ZvD'><center id='J7ZvD'></center></pre></bdo></b><th id='J7ZvD'></th></span></q></dt></tr></i><div id='J7ZvD'><tfoot id='J7ZvD'></tfoot><dl id='J7ZvD'><fieldset id='J7ZvD'></fieldset></dl></div>

                    1. <small id='J7ZvD'></small><noframes id='J7ZvD'>

                          <legend id='J7ZvD'><style id='J7ZvD'><dir id='J7ZvD'><q id='J7ZvD'></q></dir></style></legend>