views:

55

answers:

1

In a C# solution, I have multiple class libraries for the domain model, services, and repositories. I configured Unity in web.config of the main website project so that it knows what concrete objects to map to the services and repositories. For quick testing, though, I'd like to use PowerShell to load the assemblies and manipulate classes/functions from there to toy around with behavior. However, if I load the class projects directly into PowerShell, it won't know or care about web.config since I don't need that project, and Unity won't know what to inject.

I can always have a function or constructor (?) that will substitute the concrete services manually, I think, but I was curious if there's a better way around it than that.

+1  A: 

Load the assembly with your web.config (or app.config): http://stackoverflow.com/questions/835862/powershell-calling-net-assembly-that-uses-app-config

Peter Seale