1

I had given up on StructureMap a few years back or more - used Ninject and a lot of times either a project had either no IOC container, or "some" other container.

I was going to upgrade from this 2.6.x version in the project to 4.x (maybe now 5.x is out i think)

Seems like my new Service it does not like

    public static IContainer Initialize()
    {
        ObjectFactory.Initialize(x =>
        {
            x.Scan(scan =>
            {
                scan.TheCallingAssembly();
                scan.WithDefaultConventions();
            });

            x.For<INotificationService>().Use<NotificationService>();
            x.For<IMailClient>().Use<MailClient>();
            x.For<INotifierFactory>().Use<NotifierFactory>();

            x.For<ILogService>().Use<LogService>();
            x.For<IInternService>().Use<InternService>();




        });
        return ObjectFactory.Container;
    }

{"StructureMap Exception Code: 202\nNo Default Instance defined for PluginFamily PublicHealth.Intern.DataAccess.Data.UnitOfWork.IInternUnitWork, PublicHealth.Intern.DataAccess.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"}

I do see these SO references

StructureMap Exception Code: 202 No Default Instance defined for PluginFamily

StructureMap Exception Code: 202 No Default Instance defined for PluginFamily

StructureMap Exception Code: 202 No Default Instance defined for PluginFamily

I'm not sure that some of the solutions / advise will really work for me.

For example

This problem was fixed by replacing ObjectFactory.Initialize with ObjectFactory.Configure and adding the assemblies in my project:

:/

I can provide more of my code if that helps.

Community
  • 1
  • 1
Timothy Fisher
  • 185
  • 1
  • 11

0 Answers0