How to change all access types to protected in two class scenario?

Posts   
 
    
Gabor
User
Posts: 97
Joined: 29-Jan-2005
# Posted on: 01-Feb-2005 20:56:54   

Hi,

I want, that all properties and methods of the generated classes has protected access type instead of public.

To do this is easy for contructors, but how to do that for all others?

Thanks

Gabor

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 02-Feb-2005 10:12:53   

Gabor wrote:

Hi,

I want, that all properties and methods of the generated classes has protected access type instead of public. To do this is easy for contructors, but how to do that for all others?

This can only be done by altering the templates. While this is doable with a global search/replace, my question is: why would you want to do this? simple_smile I mean, the code is then not usable anymore unless you derive a new class from it.

Frans Bouma | Lead developer LLBLGen Pro
Gabor
User
Posts: 97
Joined: 29-Jan-2005
# Posted on: 02-Feb-2005 15:56:01   

Thanks for the answer.

In many thread about architecture the repeated issues are:

How to save the the rich functionality of the LLBL, but provide to the client's developers only functionality that they realy needs with the least effort.

My suggested solution in two class scenario is:

  1. Change the access method to protected friend for all the entity and collection classes

  2. Create a BLL

  3. Inherit from needed classes into the BLL, and supply only those property/methods as public, that we want to provide to the client. Inside the property/method delegate the call to the base

  4. If we have a manager class, that provides the functionality via other classes, call for theirs methods/properties (they has friend accessors), thus the client can acces these functionality only via managers, but not via classes.

The bonus of this architecture, is that the client need only the BLL.dll, and precluded to use the LLBL functionality its own - they don't have to be any knowledge about LLBL functionality.

The main question is, that does changing the LLBL classes access method to the protected friend influences his internal working?

What is your opinion?

Thanks

Gabor

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 02-Feb-2005 17:11:44   

I think that's a lot of work, and will cause some issues with the typed collections in entities. If I were you I'd go for adapter, which already separates the persistence logic from the entities.

Frans Bouma | Lead developer LLBLGen Pro
Gabor
User
Posts: 97
Joined: 29-Jan-2005
# Posted on: 02-Feb-2005 21:16:18   

Frans,

In adapter, how can I preclude the clients of using some of the entities features then?

Moreover saving the custom code is far more pain when wee need to regenerate.

Your suggestion?

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? Thanks

Gabor

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 02-Feb-2005 23:01:23   

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.

Frans Bouma | Lead developer LLBLGen Pro
Gabor
User
Posts: 97
Joined: 29-Jan-2005
# Posted on: 02-Feb-2005 23:47:56   

Frans,

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,

Please send me the templates simple_smile , and Thank you very much for the help. I'm just trying, what method to choose for the forthcoming project, and your help give me a lot.

Gabor

SeanC
User
Posts: 9
Joined: 13-Mar-2005
# Posted on: 13-Mar-2005 04:44:27   

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.

Could you please send me these templates as well? I'm still evaluating the product and this sounds exactly like what I'm looking for.

My feedback so far is that I really, really like LLBLGen Pro. I like the self-serve, two-class model because of its simplicity and ease-of-use, but I will need the architecture that the adapter model provides. With the adapter model, I miss the ability to have the derived classes that don't get overwritten plus the typed-Collections that you get with the self-serve model. Hopefully those templates you mentioned will do the trick. Thanks!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 13-Mar-2005 12:47:40   

Gabor wrote:

Frans,

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,

Please send me the templates simple_smile , and Thank you very much for the help. I'm just trying, what method to choose for the forthcoming project, and your help give me a lot.

Gabor

As a customer, you can access them in the 3rd party section in the customer area: 'Extended entity generator templates for Adapter'

Be sure to select both the right generator config and the right template set!

Sean, I'll mail them to you. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 13-Mar-2005 12:50:35   

SeanC wrote:

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.

Could you please send me these templates as well? I'm still evaluating the product and this sounds exactly like what I'm looking for.

Sent to the email address you've specified on the forum simple_smile . If you don't receive them, it might be a spamfilter/virusscanner has caught the attached .zip file. If that's the case, please let me know.

My feedback so far is that I really, really like LLBLGen Pro. I like the self-serve, two-class model because of its simplicity and ease-of-use, but I will need the architecture that the adapter model provides. With the adapter model, I miss the ability to have the derived classes that don't get overwritten plus the typed-Collections that you get with the self-serve model. Hopefully those templates you mentioned will do the trick. Thanks!

smile I think these templates are what you're looking for. If you need further help, just let me know simple_smile

Frans Bouma | Lead developer LLBLGen Pro
coderdude
User
Posts: 10
Joined: 24-Apr-2006
# Posted on: 26-Jun-2006 23:09:18   

Could you also send me these templates? Thanks!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 27-Jun-2006 11:44:17   

coderdude wrote:

Could you also send me these templates? Thanks!

They're available in the customer area -> 3rd party section.

Frans Bouma | Lead developer LLBLGen Pro