2

I am using Visual Studio 2013 in my project (Asp.net 4.5.1). I used NuGet to add StructureMap on my project.

The Structure of my Solution is:

  1. MyProjectWeb (Created first)
  2. MyProjectCore (add second to Solution)
  3. MyProjectWebTest (added third to Solution)
  4. MyProjectCoreTest (added forth to Solution)

Then, I just added StructureMap, created Database folder in MyProjectCore andbelow the DataBase Folder create Impt.

Also, I added the following classes (in code example the classes appear to be in the same file but in reality they are in separate files)

using System.Collections.Generic;
using System.Ling;
using System.Data.Lina;
using StructureMap;

namespace MyProject.MyProject.DataAccess.Impl
{
    [Pluggable("Default")]
    public class MyClass : IMyClass
    {
    // Code Goes Here
    }
}

namespace MyProject.MyProject.Core.DataAccess
{
    [PluginFamily("Default")]
    public interface IMyClass
    {
        // Code goes here
    }
}

I get the dreaded type or namespace cannot be found for both Pluggable and PluginFamily.

What am I missing here?

Note: Have done tons of research on this and can not seem to find a clear solution. For Clearity this is a webapp project I am trying to recreate and old webapp project to get and understanding of the underlying architecture so I can migrate to an MVC platform. any Help will be appreciated thanks in advance Kevin

nik0lai
  • 2,585
  • 23
  • 37
K Wagner
  • 21
  • 2
  • the code should read MyClass : IMyClass forgot to type it like that when I posted questions Still have problem though. – K Wagner Dec 22 '16 at 13:46

1 Answers1

0

Have you ensured that the project is setup to scan the assembly for attributes?

public class ScanningRegistry : Registry { public ScanningRegistry() { Scan(x => { x.Assembly("MyProject.MyProject.Core.DataAccess"); }); } }

Failing that, is there any particular reason you're using attributes over say a Registry DSL ?

nik0lai
  • 2,585
  • 23
  • 37
  • This is my first time using StructureMap. As I stated before this is an old WebApp that I am trying to bring back to a compliable/working State so I can follow the coding logic. Second where does one put the statement you lined out above. In what file or what location ? As far is Registry DSL goes I know nothing about it? Have been reading online documentation but it is not so clear it seams to me. – K Wagner Dec 22 '16 at 17:47
  • I wanted to add one comment for those searching on this error and have seen this other answer many times. Reminder to new users that Stucturemap entity types in controller constructors have to match the type name. If generically setup.Hope this helps some that may come to this question. – Casey ScriptFu Pharr Jan 07 '20 at 15:26