Proper place to maintain partial classes

Posts   
 
    
BenR
User
Posts: 5
Joined: 13-Jun-2007
# Posted on: 11-Jul-2007 01:23:37   

First off, I'm new to LLBLGen Pro, .NET 2.0 and VS2005 so this is a total noob question, and more of a generic .NET 2.0 question at that.

I am currently generating my LLBLGen project into a directory that I treat as "disposable" (i.e. It's entire contents are deleted before being regenerated). Now if I decide to create a partial class to extend one of the business entity classes, asI understand it I must create that partial class file in the same namespace and assembly as the original entity class. Does that mean that my custom partial class file must reside in the same physical directory structure as the generated code?

Or does everyone just maintain their partial class files within the directory structure generated by LLBLGen Pro?

mikeg22
User
Posts: 411
Joined: 30-Jun-2005
# Posted on: 11-Jul-2007 01:31:46   

BenR wrote:

First off, I'm new to LLBLGen Pro, .NET 2.0 and VS2005 so this is a total noob question, and more of a generic .NET 2.0 question at that.

I am currently generating my LLBLGen project into a directory that I treat as "disposable" (i.e. It's entire contents are deleted before being regenerated). Now if I decide to create a partial class to extend one of the business entity classes, asI understand it I must create that partial class file in the same namespace and assembly as the original entity class. Does that mean that my custom partial class file must reside in the same physical directory structure as the generated code?

Or does everyone just maintain their partial class files within the directory structure generated by LLBLGen Pro?

I made the mistake of generating these partial classes in the same directory as the generated entities. I don't believe you have to do this as long as the 2 parts are, like you said, part of the same assembly and namespace. This was a mistake because we use a locking source control system, so any time I regenerate, all team members have to check-in all the custom partial classes...a major PITA.

BenR
User
Posts: 5
Joined: 13-Jun-2007
# Posted on: 11-Jul-2007 02:39:31   

Well just for fun I tried creating a partial class file outside of the generated project/directory structure and then adding it to the generated project - VS2005 just made a copy of the file and placed the copy into the generated project directory! I guess that approach is pointless anyway as it requires me to modify the generated project.

The way I understand the process is: 1. LLBLGen generates the files into a single project/directory structure 2. I f I compile that project as-is, VS creates the assembly for that project

Now if I want to add my own files to that assembly (as required by partial classes) does that require me to modify the generated project or can I maintain a separate project that is somehow made part of the same assembly?

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 11-Jul-2007 11:05:47   

Just create the partial class file in the same project folder, and it would be maintained accross re-generations. As the project file won't get over written.

BenR
User
Posts: 5
Joined: 13-Jun-2007
# Posted on: 11-Jul-2007 17:11:47   

OK thanks. I guess I can't keep my code separate from the generated code if I want to extend the entities using partial classes.