views:

117

answers:

2

I'm trying to use SubSonic for a new project with an existing database but when I try to build the project after generating the SubSonic files I'm getting these same two exceptions on different classes:

  • Partial declarations of 'MyData.UserCollection' must not specify different base classes
  • Type 'MyData.UserCollection' already defines a member called 'UserCollection' with the same parameter types

I'm able to successfully build a new project using the Northwind DB so I believe the error has something to do with the way the tables are setup but I'm not sure where to go from there. Any help is appreciated.

+2  A: 

Search for UserCollection in your project. SubSonic generated a partial class for this in the User.cs generated file. You either have a UserCollection of your own in which case you should probably rename it or put it in another namespace. Either that, or you tried to add functionality to the UserCollection and you derive it from another type.

Last possibility is that you have a User table and a Users table. SubSonic will change Users to User. I'm not sure, but it might cause generation errors. I haven't tried it though.

Rob Prouse
+1  A: 

Rob,

Thanks for the help. You got me going on the right track. Apparently, the generator doesn't like tables with the word "Collection" in the name. I see now that the error was with:

public partial class UserCollectionCollection : ActiveList<UserCollection, UserCollectionCollection>
public partial class UserCollection : ActiveList<User, UserCollection>

By adding:

regexMatchExpression="Collection" 
regexReplaceExpression="Group"

to the provider in my web.config file I was able to build successfully.

Jonathan S.