Concurrency

Posts   
 
    
Posts: 40
Joined: 01-Sep-2005
# Posted on: 27-Nov-2005 22:02:35   

I have (going through the Forum) worked out how to implement a static class to provide an IConcurrencyPredicateFactory and assign this to each entity created - but I want to avoid doing this for each entity - there will be hundreds...

How do I make this a generic operation for all Entities ? We are using SelfServicing 1.0.2005.1 for C# .Net 2.0 SQL Server 2005 - We will move ASAP to version 2 when available. If required we can move to Adapter!

I want to avoid modifying generated code if possible - Unless the code will be in area that is not overwriten when refreshing the schema and/or regenerating the source. We are migrating the database from a pre existing system and cannot do it in one go! There will be lots (poss 50+) updates to the schema. We will also be regenerating teh code for new TypedLists etc.

I want to avoid modifying the Templates if possible - Unless the Templates will not cahneg between versions! We have only been developing for 2 months but we are already on out 2nd version and will definately upgrade early next year to version 2 (also the project will probably not be complete until early 2007)

I would be delighted if it was made possibly in version 2 to just assign an IConcurrencyPredicateFactory for all entities to use. Looking at the forum this appears to be a fairly common requirement. Yes, developers do want/need different concurrency schemes but a common requirement is to apply the required concurrency scheme to all entities!

I agree no concurrency scheme is great, but we do need to implement some sort of concurrency scheme. Notifying users prior to modifying an object is not achieveable in a 3-tier system without becoming stateful on the server. Our aim is for the server to produce objects and send them to the remote client (the server then forgets all about the client and its objects) The Clients then do what they wish Add/Edit/Delete - the server may never get anything back or it may get an object back and instruction to apply the changes...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 28-Nov-2005 10:56:30   

PaulMckenzie wrote:

I have (going through the Forum) worked out how to implement a static class to provide an IConcurrencyPredicateFactory and assign this to each entity created - but I want to avoid doing this for each entity - there will be hundreds...

IConcurrencyPredicateFactory instances can be set in the InitClass methods of entities. You can do that easily through code generation by binding an include template to the template id that's reserved for that purposesimple_smile -> Custom_EntityInitializationTemplate

See 'Adding your own code to the generated classes' in the documentation to get started. So, in your include template you simply add code like: base.ConcurrencyPredicateFactoryToUse = MyFactory.GetConcurrencyPredicateFactory(); which is then generated into InitClassEmpty and InitClassFetch simple_smile

How do I make this a generic operation for all Entities ? We are using SelfServicing 1.0.2005.1 for C# .Net 2.0 SQL Server 2005 - We will move ASAP to version 2 when available. If required we can move to Adapter!

In v2 this will be configurable from the designer, till then you need to create the template binding by hand in a copy of the template set. Which is a walk in the park, just follow the tutorial of Template Studio's documentation which contains a step for step approach how to bind an include template to a templateid simple_smile If you need extra help, let us know

I want to avoid modifying generated code if possible - Unless the code will be in area that is not overwriten when refreshing the schema and/or regenerating the source. We are migrating the database from a pre existing system and cannot do it in one go! There will be lots (poss 50+) updates to the schema. We will also be regenerating teh code for new TypedLists etc.

I want to avoid modifying the Templates if possible - Unless the Templates will not cahneg between versions! We have only been developing for 2 months but we are already on out 2nd version and will definately upgrade early next year to version 2 (also the project will probably not be complete until early 2007)

The code generator allows you to inject code through include templates so there's no need to modify generated code or templates. If you need extra include template anchors or have suggestions for extra include template anchors (places where include template statements are placed inside the templates), please let me know. Its one line of code for me but can make all the difference for our customers simple_smile

I would be delighted if it was made possibly in version 2 to just assign an IConcurrencyPredicateFactory for all entities to use. Looking at the forum this appears to be a fairly common requirement. Yes, developers do want/need different concurrency schemes but a common requirement is to apply the required concurrency scheme to all entities!

That's indeed the plan. Not only concurrencypredicates but all kinds of things should be assignable to entities for code generation later on. The code generator engine is the most flexible on the market and easily adjustable, it's just that we have to do a better job to open the power up to the customers more, in such a way that it's far more easier to add custom code etc. to the generated code without having to create extra template sets, bindings.

You can also add template code to the include template you bind to tweak the code generation, for example to only have the concurrencypredicate set for a given set of entities or do something else in a given set of entities. An include template can be written (the template logic that is, what you generate can be anything you like) in C#, VB.NET (.lpt templates) or TDL (.template)

Frans Bouma | Lead developer LLBLGen Pro
Posts: 40
Joined: 01-Sep-2005
# Posted on: 28-Nov-2005 20:38:08   

Thanks... The support for LLBL is fantastic!

Excellent about the feature being available in version 2.

Thanks for the info on template binding - we may implement this now, we may leave it until version 2 is available and implement the functionality there.

I will post again if we implement the template solution now and we need a hand.

Thank again.