Interface template inaccessible exception

Posts   
 
    
tomahawk
User
Posts: 169
Joined: 02-Mar-2005
# Posted on: 29-Oct-2007 22:52:14   

I am attempting to generate Interfaces for the managers classes. The interfaces basically mirror the class itself, with just the method definitions.

However, when attempting to generate from any template in the binding (even when the interface template isn't generated) I get the following exception from the LLBLGen designer:

Compilation of templates threw errors: Error CS0122, at line: 2951, pos: 48: 'ManagerInterfaceTemplate.FieldRelationPair.ToFieldList(System.Collections.ArrayList)' is inaccessible due to its protection level Error CS0122, at line: 2953, pos: 47: 'ManagerInterfaceTemplate.FieldRelationPair.ToFieldList(System.Collections.ArrayList)' is inaccessible due to its protection level Error CS0122, at line: 2982, pos: 51: 'ManagerInterfaceTemplate.FieldRelationPair.ToRelationList(System.Collections.ArrayList)' is inaccessible due to its protection level Error CS0122, at line: 2983, pos: 50: 'ManagerInterfaceTemplate.FieldRelationPair.ToRelationList(System.Collections.ArrayList)' is inaccessible due to its protection level

If I add a public modifier to the interface method definitions, this error goes away, but then of course, I get compilation errors in VS.

What's going on here?

I'm using LLBLGen 2.5

Thanks, Josh

Attachments
Filename File size Added on Approval
ManagerInterfaceTemplate.lpt 33,790 29-Oct-2007 22:52.36 Approved
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Oct-2007 04:28:19   

Hi Josh,

As far as I know an interface contains only the signatures of methods (no code implementation), and those (interface members) shouldn't include access modifiers as that is defined in the implementation class. Your attached file don't follow these rules.

Anyway, Why do you want to make interfaces for Manager classes? Manager classes already inherits from an abstract class (_ManagerBase_). What if you use abstract classes instead of interfaces?

David Elizondo | LLBLGen Support Team
tomahawk
User
Posts: 169
Joined: 02-Mar-2005
# Posted on: 30-Oct-2007 19:09:30   

The template file above does generate code that follows interface rules. There is no implementation and no modifiers applied.

The reason I need interfaces is because I'm using this in a CAB implementation. CAB services require a service interface be defined.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Oct-2007 19:47:10   

The template file above does generate code that follows interface rules. There is no implementation and no modifiers applied.

You're right, I was reading another file. Sorry for misunderstanding. flushed

About your errors, try making public these methods:

ArrayList ToFieldList(ArrayList fieldRelationPairs)
{
...
}

ArrayList ToRelationList(ArrayList fieldRelationPairs)
{
...
}

which are methods of public class FieldRelationPair. But no make the interface members public.

David Elizondo | LLBLGen Support Team