Being fairly new to SimpleInjector, this could be relatively simple.

I am registering a pairing as follows;

container.Register<INote, Note>();

As per the SimpleInjector documentation. Carrying on it says to use the following to resolve this;

INote note = container.GetInstance<INote>();

However, i'm not allowed to access the properties or methods of the note variable, it just states that it is inaccessible due to it's protection level.

Within INote declared as

int userID;

within Note : INote

public int userID {get; set;}

What do I need to do to be able to resolve the INote note variable to the concrete implementation declared in the container?

Edit - More Info

The error is during compilation saying

Error 1 'NotesDAL.Interfaces.Models.INote.userID' is inaccessible due to its protection level

The Note class is public

public class Note : INote
{
    public string noteID {get; set; }
    public string userID { get; set; }
    public string note { get; set; }
}   
有帮助吗?

解决方案

For Completion;

Thankyou for these comments! Turns out I was declaring the INote interface as a class, not an interface, I knew it would be a stupid mistake but caught thanks to you! Everything else is working perfectly!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top