JasperFx / lamar

Fast Inversion of Control Tool and Successor to StructureMap
https://jasperfx.github.io/lamar
MIT License
572 stars 119 forks source link

Cast when service factory is unknown #168

Closed Silvenga closed 5 years ago

Silvenga commented 5 years ago

Resolves #167.

When building the expression to inject a service into a constructor, InlineLambdaCreationFrame.WriteExpressions assumes the service factory return type is directly compatible with the argument being resolved. This is not the case when not using the generic overloads to create the service descriptor. This pr teaches InlineLambdaCreationFrame to assume that type object is compatible with the resolving service type.

Silvenga commented 5 years ago

I'm sure I'm using the wrong words to describe what's happening. Please let me know if anything should be renamed or changed.

Silvenga commented 5 years ago

And this is completely the same as #164. 😿

kieronlanning commented 5 years ago

Thanks for fixing this, is there a ETA for a release? I have exactly this issue...

I've pulled the code locally and included it in my project and confirmed this works. Thanks @Silvenga.

Silvenga commented 5 years ago

@jeremydmiller hate to bug, but I know this is a blocker for a couple - and I don't know how to mitigate the problem in at least my use-case.

jeremydmiller commented 5 years ago

@Silvenga I'm sorry, I honestly hadn't noticed this one. I'll try to get this in soon.

jeremydmiller commented 5 years ago

I'm closing this one in lieu of https://github.com/JasperFx/lamar/pull/164. Will be in Lamar 3.0.4 very soon