Note that there are some explanatory texts on larger screens.

plurals
  1. POStructureMap 2.5 and internal implementors
    primarykey
    data
    text
    <p>is it possible to get this stuff working(some way to force Objectfactory create instances like Activator)</p> <p>in the below example everything is placed in a sigle assembly</p> <pre><code>public interface IUnitOfWorkFactory { IUnitOfWork Create(); } internal class NHUnitOfWorkFactory : IUnitOfWorkFactory { public IUnitOfWork Create() { //// do needed stuff } } </code></pre> <p>bootstrapping :</p> <pre><code>ObjectFactory.Configure(x =&gt; { x.ForRequesedType&lt;IUnitOfWorkFactory&gt;.TheDefaultIsConcreteType&lt;NHUnitOfWorkFactory&gt;(); }); </code></pre> <p>usage:</p> <pre><code>IUnitOfWorkFactory factory = ObjectFactory.GetInstance&lt;IUnitOfWorkFactory&gt;(); </code></pre> <p>My result:</p> <pre> Porktal.Core.Tests.UnitOfWorkTests.Can_Start_Unit_of_Work : StructureMap.StructureMapException : StructureMap Exception Code: 207 Internal exception while creating Instance 'Porktal.Core.Data.NH.NHUnitOfWorkFactory, Porktal.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' of PluginType Porktal.Core.Data.IUnitOfWorkFactory. Check the inner exception for more details. ---- System.MethodAccessException : Porktal.Core.Data.NH.NHUnitOfWorkFactory..ctor() Stack Trace: at StructureMap.Pipeline.ConfiguredInstanceBase`1.StructureMap.Pipeline.IConfiguredInstance.Build(Type pluginType, BuildSession session, InstanceBuilder builder) at StructureMap.Pipeline.ConfiguredInstanceBase`1.build(Type pluginType, BuildSession session) at StructureMap.Pipeline.Instance.createRawObject(Type pluginType, BuildSession session) at StructureMap.Pipeline.Instance.Build(Type pluginType, BuildSession session) at StructureMap.Pipeline.BuildPolicy.Build(BuildSession buildSession, Type pluginType, Instance instance) at StructureMap.InstanceFactory.Build(BuildSession session, Instance instance) at StructureMap.BuildSession.CreateInstance(Type pluginType, Instance instance) at StructureMap.BuildSession.b__0(Type t) at StructureMap.Util.Cache`2.get_Item(KEY key) at StructureMap.BuildSession.CreateInstance(Type pluginType) at StructureMap.Container.GetInstance(Type pluginType) at StructureMap.Container.GetInstance[T]() at StructureMap.ObjectFactory.GetInstance[PLUGINTYPE]() at Porktal.Core.Bootstraper.Bootstrap() in D:\Porktal\Porktal.Core\Bootstraper.cs:line 20 at Porktal.Core.Tests.UnitOfWorkTests.Can_Start_Unit_of_Work() in D:\Porktal\Porktal.Core.Tests\UnitOfWorkTests.cs:line 11 ----- Inner Stack Trace ----- at PorktalCoreDataNHNHUnitOfWorkFactoryInstanceBuilder44203c8113d44053be045df4db28c3dc.BuildInstance(IConfiguredInstance , BuildSession ) at StructureMap.Pipeline.ConfiguredInstanceBase`1.StructureMap.Pipeline.IConfiguredInstance.Build(Type pluginType, BuildSession session, InstanceBuilder builder) </pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload