Пример #1
0
        public void StructureMap()
        {
            var container = new StructureMap.Container();

            foreach (var type in _types)
            {
                container.Configure(c => c.For(type).Use(type));
            }

            int length = 0;

            if (Scenario == ResolveScenario.ResolveOne)
            {
                length = 1;
            }
            else if (Scenario == ResolveScenario.ResolveHalf)
            {
                length = _types.Length / 2;
            }
            else if (Scenario == ResolveScenario.ResolveAll)
            {
                length = _types.Length;
            }

            for (var i = 0; i < length; i++)
            {
                container.GetInstance(_types[i]);
            }

            container.Dispose();
        }
 public void Dispose()
 {
     cntr.Dispose();
 }