GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing structuremap.github.io — StructureMap - Working with Primitive Types
Working with Primitive Types Edit on GitHubStructureMap treats simple types like strings, numbers of any kind, enumerations, and dates as primitive types that are completely exempt from auto wiring -- meaning that any constructor or setter dependencies on these types must be supplied as inline dependencies. To make this concrete, if you ask StructureMap to build a concrete type that has dependencies on simple types without like this example, StructureMap will throw an exception telling you that it cannot build the instance:
Part of the exception message thrown in the unit test shown above is the erroneous build plan
showing you that the new GuyWithNoDefaultName(String name) ┗ String name = Required primitive dependency is not explicitly defined We can build
See Construction Policies for an example of using a constructor policy to set a dependency on a "connectionString" argument in a conventional way. Default ValuesAs a new feature in the 4.0 release, StructureMap can finally take advantage of default parameter arguments to derive the values for a primitive argument (or setter value) while still allowing you to explicitly define that parameter or setter value:
|
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |