Restricted Recursive Updates

Posts   
 
    
Maxelmo
User
Posts: 2
Joined: 23-Jan-2009
# Posted on: 23-Jan-2009 18:59:10   

Is there a way to restrict a recursive insert/update?

for Example, if I have an object Structure as follows:

<Person> <PersonAddress> <address> <field/> <field/>
<country> <field/> </country> </address> </PersonAddress> </Person>

I only want to update the person and Adresses, not the country.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Jan-2009 20:53:22   

So, you modified a bunch of entities in a tree, then you perform a recursive save, but you want the query update just certain objects?

could you please show us some of your current code for this? LLBLGen version?

David Elizondo | LLBLGen Support Team
Maxelmo
User
Posts: 2
Joined: 23-Jan-2009
# Posted on: 24-Jan-2009 14:23:04   

Well, actually I’m not sure that I choose the right architecture. I need to design a software solution, for a company that sells software solutions to local governments (community). The solution exists out of a CMS for which we will use DotNetNuke. Within DotNetNuke we will develop modules like CRM et cetera. The DotNetNuke modules will connect to the core engine/services we need to develop. We want to use LLBLGen to generate the DAL for these services. I was thinking of using the generated entities to send over the line using WCF. I have to deal with developers that are not familiar with n-tier development and .Net. They only have some experience with asp.net. So I need to design an architecture that's simple so they can work with it.

Therefore I was thinking of using the recursive option, which will reduces the amount of code that has to be written. The problem is that there's a risk involved when this option is used in the wrong way. For instance when we have an object tree like: -Person -PersonAdress -Address -Country

I want to allow the front-end-developers to update a person and the addresses, but I don't want them to add countries using the same method to update the Person and addresses.

I probably better not use the recursive option in this scenario.

I'm also searching for some advice whether to use the generated entities or using DTO/Data contracts for the WCF Services. I think DTO's would be a better solution, because of the abstraction from the underlying model, but I’m not sure, maybe this would make the solution unnecessarily complex for the developers. It might be that the projection framework, solves this, but I’m not sure if it's possible to easily map the DTO back to the data entities.

Well, It's more a brain dump than a real question and I need to read the documentation first, but as you know this will take some time, and I need to start developing next week.

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 26-Jan-2009 10:39:37   

For instance when we have an object tree like: -Person -PersonAdress -Address -Country

I want to allow the front-end-developers to update a person and the addresses, but I don't want them to add countries using the same method to update the Person and addresses.

Recursive Saves only saves entities in the passed graph, and only those who are dirty (have fields that are modified).

So if the developers don't pass Country or pass an unchanged Country, then it won't be saved.

Anyway I recommend using DTOs, where in the above case you should project the passed in DTO to the graph you want (Person-PersonAddress-Address).