System.Collections.Generic.IList<MicroLite.SerialNumber>' is lessaccessible than method

A

Anders Eriksson

I'm getting this error:
Error 1 Inconsistent accessibility: return type
'System.Collections.Generic.IList<MicroLite.SerialNumber>' is less
accessible than method 'MicroLite.DAL.Browse()'
C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 18 36 MicroLite

I think that IList<SerialNumber> serials; will make it internal, which
should explain the error message, BUT if I put public before it
public IList<SerialNumber> serials; then I get this error messages


Error 2 } expected C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 19 10 MicroLite
Error 3 Invalid token 'using' in class, struct, or interface member
declaration C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 22 13 MicroLite
Error 4 ; expected C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 22 62 MicroLite
Error 5 ; expected C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 24 68 MicroLite
Error 6 Invalid token '=' in class, struct, or interface member
declaration C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 29 29 MicroLite
Error 7 Invalid token '(' in class, struct, or interface member
declaration C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 29 58 MicroLite
Error 8 Invalid token ')' in class, struct, or interface member
declaration C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 29 64 MicroLite
Error 9 Invalid token '(' in class, struct, or interface member
declaration C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 31 39 MicroLite
Error 10 A namespace cannot directly contain members such as fields or
methods C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 35 13 MicroLite
Error 11 Type or namespace definition, or end-of-file expected
C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 36 9 MicroLite


I don't get it! What am I doing wrong???


The Code:
using MicroLite.Configuration;
using System.Collections.Generic;

namespace MicroLite
{
public class DAL
{
private ISessionFactory sessionFactory;

public DAL()
{
sessionFactory = Configure
.Fluently()
.ForMsSql2005Connection("ACPConnection")
.CreateSessionFactory();
}

public IList<SerialNumber> Browse()
{
public IList<SerialNumber> serials;

using (var session = sessionFactory.OpenSession())
{
using (var transaction = session.BeginTransaction())
{
var query = new SqlQuery("select SerialNumbers.KOD,
Status.status_description, SerialNumbers.MarkDate " +
"from SerialNumbers inner join Status on
SerialNumbers.Status=Status.status_id order by MarkDate");

serials = session.Fetch<SerialNumber>(query);

transaction.Commit();
}
}

return serials;
}
}
}

// Anders
 
A

Anders Eriksson

I'm getting this error:
Error 1 Inconsistent accessibility: return type
'System.Collections.Generic.IList<MicroLite.SerialNumber>' is less
accessible than method 'MicroLite.DAL.Browse()'
C:\Users\ame\Documents\Visual Studio
2013\Projects\TEST\DatabaseClient\MicroLite\DAL.cs 18 36 MicroLite

OK, please forget this!
It's not the IList that need to be public it's the SerialNumber Class,
which VS2013 created as internal...

Sorry for the noice!

// Anders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top