Jump to content

Simple(?) protection level issue. Please help.

- - - - -

  • Please log in to reply
No replies to this topic

#1
piotrool

piotrool

    Newbie

  • Members
  • Pip
  • 1 posts
Hi everyone,
I am a beginner in programming and currently work on DotNetNuke module development tutorial using C#. I have am experiencing a protection level error that I have very hard time figuring out. Would you guys please take a look at the following code snippets and maybe give me some hint? I will keep it as short as possible.

Part of my "GuestbookCSController.cs file":

namespace WroxModules.GuestbookCS
{
public class GuestbookCSController
{
public void InsertGuestbookEntry(GuestbookEntryInfo oInfo)
{
DataProvider.Instance().InsertGuestbookEntry(oInfo.ModuleId,
oInfo.SubmitterName, oInfo.SubmitterWebsite,
oInfo.SubmitterComment,
oInfo.SubmissionDate, oInfo.IsApproved);
}
}

The above code throws the following error:

'WroxModules.GuestbookCS.DataProvider.Instance()' is inaccessible due to its protection level

And I guess, this is what the error is referencing to (DataProvider.cs file):

namespace WroxModules.GuestbookCS
{
public abstract class DataProvider
{
private static DataProvider instance = null;
static DataProvider()
{
instance = (DataProvider)Reflection.CreateObject("data",
"WroxModules.GuestbookCS", " ");
}
private static DataProvider Instance()
{
return instance;
}
public abstract void InsertGuestbookEntry(int moduleId, string
submitterName, string submitterWebsite, string submitterComment,
DateTime submissionDate, bool isApproved);
public abstract void ApproveGuestbookEntry(int moduleId, int entryId);
public abstract void DeleteGuestbookEntry(int moduleId, int entryId);
public abstract IDataReader GetApprovedEntries(int moduleId);
public abstract IDataReader GetAllEntries(int moduleId);

}
}

Thanks in advance for your response.

---------- Post added at 08:27 AM ---------- Previous post was at 06:51 AM ----------

Hey!

I've managed to solve it by myself by changing

private static DataProvider Instance()
{
return instance;

to public

Thank a lot anyway.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users