Gabor wrote:
Frans,
In adapter, how can I preclude the clients of using some of the entities features then?
the entities don't have save/load etc. code, so you just have functionality required for working with the entity itself, which is IMHO what you need.
Moreover saving the custom code is far more pain when wee need to regenerate.
that can be an issue indeed. I could send you some templates which create for every entity a derived entity and a typed collection, effectively doing the same as 2-class scenario, but then you have entities which aren't full of persistence code so you dont have to jump through hoops to limit clients doing things you don't want.
You know, that I changed the assembly name, after first generation of the projects. When i tried to regenerate, the LLBL didn't find the validator's, because it searches them as it has the namespace before the change. Is it any method, to force the code generator to regenerate the validator classes again, on how to correct this?
You can make the code generator overwrite them (if you want to). Say you use self-servicing, 2-class scenario. You then make a copy of <llblgen pro folder>\TwoClassScenarioFull2003.config to <llblgen pro folder>\TwoClassScenarioFull2003Overwrite.config, and open that copy in a texteditor (it's XML).
Change the name tag's contents to Two class scenario (Full) Vs.Net 2003 Overwrite. Then scroll down till you find the taskgroup:
<taskGroup description="Validator classes generation group">
<task name="ValidatorsDirectoryCreator" assemblyFilename="SD.LLBLGen.Pro.TaskPerformers.dll" taskPerformerClass="SD.LLBLGen.Pro.TaskPerformers.DirectoryCreator">
<parameter name="folderToCreate" value="ValidatorClasses"/>
<parameter name="failWhenExistent" value="false"/>
<parameter name="clearWhenExistent" value="false"/>
</task>
<task name="EntityValidatorClassGenerator" assemblyFilename="SD.LLBLGen.Pro.TaskPerformers.dll" taskPerformerClass="SD.LLBLGen.Pro.TaskPerformers.CodeEmitter">
<parameter name="destinationFolder" value="ValidatorClasses"/>
<parameter name="failWhenExistent" value="true"/>
<parameter name="filenameFormat" value="[elementName]Validator.[extension]"/>
<parameter name="templateID" value="SD_EntityValidatorTemplate"/>
<parameter name="emitType" value="allEntities"/>
</task>
</taskGroup>
In the task EntityValidatorClassGenerator, you change <parameter name="failWhenExistent" value="true"/> to <parameter name="failWhenExistent" value="false"/>
Save and use your copy in the code generator configuration screen (top dropdownbox), which now should overwrite your validator classes. Be carefull though, your code added to these classes is now overwritten.
In march code merging is added which will merge own code added to generated code to newly generated code so your own code will be preserved.