Why doesn't [Dependency] work with internal properties?

Mar 12, 2013 at 6:11 PM
Edited Mar 12, 2013 at 7:43 PM
Wow, CodePlex is sure being buggy lately. I tried editing the title to make a correction and two threads were created. Please delete the first one if possible. Thanks

Ok.... sorry for the mistake in the title. It should be 'internal' instead of 'public'. Having a bad day today it seems ¬¬.

Well, migrating the code to use the container has been such a big endeavor, this is not even funny.

I wanted to ask why doesn't the DependencyAttribute work when applied to internal properties. This makes very little sense, because the whole injection pipeline works with internal classes and InjectionMethod's.

I can't use ctor injection in my current case because I'm actually injecting onto web pages. I went with the custom httpModule solution to call buildup on every page and it's controls, so I need to use property or method injection.

Since property injection is a bit simpler, I would really like to go with that. I can't though, because some of the types exposed by them are internal, and this gives me an error about inconsistent accessibility. These classes are in referenced assemblies which have the InternalsVisibleTo(<my_assembly>) in them.

I also cannot convert the pages to internal because the aspnet framework complains about it and cannot compile the pages (if I could that would be a somewhat good solution IMHO).

Why have you decided to exclude internal properties from the injection mechanism? Isn't it enough that the assembly that is configuring the container has access to the properties? Wouldn't it be possible to update the Unity framework to allow internal properties (provided the container configuration is in the same assembly or one with the InternalsVisibleToAttribute applied)?

Thanks in advance, and sorry for making multiple consecutive questions here. It's just that I'm having a hard time on some parts.