Skip to content

Commit e9d64fc

Browse files
authored
Update Azure-Functions-Blog-Post.md
Added MyServiceProviderFactory class sample code
1 parent e587f05 commit e9d64fc

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

blog-posts/en/Azure-Functions-Blog-Post.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,26 @@ var host = new HostBuilder()
148148
host.Run();
149149
```
150150

151+
```csharp
152+
using System;
153+
using Abp.Dependency;
154+
using Castle.Windsor.MsDependencyInjection;
155+
using Microsoft.Extensions.DependencyInjection;
156+
157+
public class MyServiceProviderFactory<MyFunctionModule> : IServiceProviderFactory<MyFunctionModule>
158+
{
159+
public MyFunctionModule CreateBuilder(IServiceCollection services)
160+
{
161+
return IocManager.Instance.Resolve<MyFunctionModule>();
162+
}
163+
164+
public IServiceProvider CreateServiceProvider(MyFunctionModule containerBuilder)
165+
{
166+
return WindsorRegistrationHelper.CreateServiceProvider(IocManager.Instance.IocContainer, new ServiceCollection());
167+
}
168+
}
169+
```
170+
151171
### 🧠 What’s Happening Here?
152172

153173
- `AbpBootstrapper` initializes the ASP.NET Zero module and dependencies.

0 commit comments

Comments
 (0)