Entity Interfaces...

Posts   
 
    
Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 25-Nov-2005 15:50:13   

Frans,

I'm not sure why this doesn't work... I'm trying to create interfaces which can be used to handle mutliple entities generated from the same table.

I have put the following code into the Generated project:


namespace Sds.ModernArk.Services.Ark.Data.DatabaseGeneric.EntityClasses
{
    public interface IAccountSummary
    {
        int AccountID { get; set; }
    }

    public partial class AccountEntity  : IAccountSummary
    { }

    public partial class AccountSummaryEntity : IAccountSummary
    { }
}

But it wont compile... rage I says AccountEntity and AccountSummaryEntity does not implement IAccountSummary.AccountID

When it clearly does... cry

Any ideas?

PS... Its friday so maybe Im doing somethign STUPID wrong.

Marcus

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 25-Nov-2005 16:08:05   

The code looks fine as the generated Entity Classes should have the partial word specified in the class definition

Since in C#, the "partial" keyword must appear in all class definitions.

The only 2 cause I can think of is: 1- The name spaces are mismatched !! i.e. the namespace that holds the class definition that has the implementation of the AccountID is not the same as the one that has the Interface implementation declaration

2- AccountID wasn't implemented at all, which I dought is the case.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 25-Nov-2005 16:16:12   

Wild guess, your field in the entity is called AccountIdwink (as that's the default name LLBLGen Pro comes with), so I think Walaa's 1st answer is the right one, other than that I also can't think of anything else.

Frans Bouma | Lead developer LLBLGen Pro
Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 25-Nov-2005 16:25:09   

Walaa wrote:

The only 2 cause I can think of is: 1- The name spaces are mismatched !! i.e. the namespace that holds the class definition that has the implementation of the AccountID is not the same as the one that has the Interface implementation declaration

BINGO smile

Entities are generated with Sds.ModernArk.Services.Ark.Data.EntityClasses as their namesace but the project folder structure means that new classes are created with Sds.ModernArk.Services.Ark.Data.DatabaseGeneric.EntityClasses as the namespace!

Thanks guys... Sometimes you just can't see the wood for the trees!!!