structuremap/structuremap — pull request #174 by flq (2014-02-11 14:35:51+00:00)
Title: Pcl (part II) - Targetting of Pcl profile for .NET 4.5 + WP8 + Windows Store Apps

## Why? ##

* Targetting 4.0 + WP8 would have forced also targetting Silverlight, which killed the ReaderWriterLockSlim from the list of available threading primitives. Too sad!
* Crazy me also wants to target phone

---

## How? ##

The csproj of the StructureMap is customized such that, depending on the chosen configuration, a different pcl target is chosenfor the compiler. Additionally, the __TypeExtensions__ became a partial class - depending on the targetted version, a different partial class definition is added to __TypeExtensions__.

Basically all differences of the two profiles lie in the reflection API. Many methods and properties have been moved to a __TypeInfo__ class that can be obtained through an extension method on __Type__. By introducing that extension method and just returning the Type itself in the .NET4.0 case, in many cases just a __"GetTypeInfo()"__ class is introduced, and the code keeps working in both profiles.

Since the code is predominantly .NET 4 based, the common route has been to add extension methods on type that resemble the old extension methods in the .NET4.5 case.

## Downsides? ##

Downsides are mostly related to resharper - it does not see that __TypeExtensions__ get enhanced with two different files depending on the chosen configuration. The same goes for the targetted profile. The csproj is now set up such that the .NET4.0 driven syntax is used. I will file an issue with Jetbrains on that, since R# does honor the chosen Configuration in other circumstancesand it maybe it should do so in unexpected conditions,too.