Comments (4)
Hey; we're a big bogged down getting the Autofac v6 release out right now.
To be honest, I'm not 100% clear what is being asked here; @alexmg, can you offer any insight?
from autofac.servicefabric.
Thanks for reporting this issue @n3gwave.
I have added a global hook that allows registrations to be added to the lifetime scope created for the service instance. This is provided to the RegisterServiceFabricSupport
method the same as the global constructor exception callback.
The registration should look something like the example below. The ServiceContext
is resolved from the IComponentContext
because the instance is registered just prior to the callback being invoked while the lifetime scope is being created.
builder.RegisterServiceFabricSupport(
configurationAction: b =>
b.Register(c => FabricTelemetryInitializerExtension.CreateFabricTelemetryInitializer(
c.Resolve<ServiceContext>()))
.As<ITelemetryInitializer>()
.SingleInstance());
I'm not sure if the timing of this will be adequate for the WebHostBuilder
scenario because the ITelemetryInitializer
will not be registered in the root lifetime scope and will not be added until the initial container build. It would be great if you could test this out from the MyGet package feed and let us know if it covers the required scenarios.
Install-Package Autofac.ServiceFabric -Version 4.0.0-develop-00076 -Source https://www.myget.org/F/autofac/api/v3/index.json
If there are issues it would be great to have an example application that could be used for testing. I was not able to test this with the Service Fabric demo application because it has not been updated to include .NET Core examples. It would also be good to have the demo application include the configuration of Application Insights telemetry, but I don't have time to get to this now.
@alistairjevans @alsami @tillig Please hold off releasing the 4.0.0
package until this has been resolved. I have reopened this issue even though there is a commit in play because I'm not convinced it will be enough.
from autofac.servicefabric.
Hey, I think that should be fine at least for things I'm doing. You are right that for case with WebHostBuilder and default template this would still be problem, but I use a combination of generic host with Autofac DI and then for services that needs http I create my own http communication listener (forked from kestrel) but has very important detail:
UseServiceProviderFactory(new AutofacChildLifetimeScopeServiceProviderFactory(this.rootScope.BeginLifetimeScope(endpointName)))
So the listener http web host has child container. That's why it's fine for me to register FabricTelemetryInitializer in the root. It will be passed down to inner hosts as well. But I doubt it people are using SF in the same way.
Anyway, it would be also good to support IReliableStateManager by default as well. Currently I'm doing some workarounds and it works but still it's not obvious. Nonetheless, I think your solution could be used with this case as well but with some 'if's' because we need to make sure we are in stateful service and this callback is added globally.
I wish I could help with testing it, but unfortunately I've no time for that right now. Basically i'm quite good with workaround I've, at least for now.
from autofac.servicefabric.
Hi @n3gwave. It would be great if you could use the package from MyGet to confirm that this does address your issue. If everything looks good, we can release the package with the changes.
from autofac.servicefabric.
Related Issues (20)
- InstancePerMatchingLifetimeScope HOT 2
- Reduced extensibility due to access restrictions in classes and methods HOT 3
- Allow logging exceptions during service instantiation HOT 8
- Access denied in RegisterActor HOT 5
- How to communicate to stateful service use remoting? HOT 2
- How to inject custom ActorService HOT 2
- How to use Serilog, Autofac and Service Fabric Actors together HOT 3
- Dynamic Proxy breaks optional constructor arguments
- Cannot create Stateless Service in Service Fabric injecting my own objects in HOT 2
- Service class constructor never invoked
- Lifetime scope for Actor instance HOT 2
- Not support 6.3.187 HOT 1
- Allow use of current ILifetimeScope in the exception callback HOT 1
- ServiceFabricModule is internal, visible to Autofac RegisterAssemblyModules, but cannot be constructed HOT 8
- Message "Access is denied
- Cannot resolve parameter 'System.Fabric.StatefulServiceContext serviceContext' HOT 2
- Singleton does not play nicely with ServiceContext dependency HOT 1
- MissingMethodException after update to Autofac 5.0.0 HOT 1
- Compatibility with Autofac v6 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autofac.servicefabric.