2010 m. rugpjūčio 23 d., pirmadienis

Merge similar referenced objects controller for XAF

I've noticed that modern application usually have Dirty dictionaries
and there are no means of cleaning those dictionaries.

What do i mean by Dirty dictionaries ? here's a sample:

You have a list of whatever type of Objects, and You what to group them by one of the fields.
In this situation We're trying to group data object by property "Class". Here's what we get:

 If we take a look at the "Dictionary", here's what we get:

Look's like that classe`es are identical... but.
What You'd what in such situation is somehow "Join" the 2 instances. An inexperienced user would simply delete one of them. But that doesn't solve the problem.

A clever SQL script here is not really possible. Why ?
Because it's after 5 years of working with SQL I have no idea how to write simple a script to find all objects using this dictionary value. It is possible of course. but.. I've found a better way :)

Here's how it works.
1. You go the the dictionary. Select object's that You want to Join and click Merge:

Then You Get a screen that Show's what will be merged, and asks You to select one that You want to stay:
Click OK, and The Controller collects (finds) ALL referencing objects that use one of the values being merged (Joined), and replaces them with the correct value.

4 komentarai:

  1. Hi,
    Is it possible for me to use your code in my solution?



  2. Hi Carlos,

    I started working on preparing it for the "public", but I just didn't have time to finish that. I'm hoping to update it and implement in ExpandFramewok. Check out the www.expandframework.com

    If You need it "yesterday" I can help You, explaining how to do that.

  3. Any chance to see your code in eXpand soon?

    regards, Robert

  4. :) Not much :) this solutions need to be redone according Xpand standard. At the moment it uses a custom form for user input.. which should be "remade" to use a strandard XAF detail view etc.. Also there's no controller for web.

    Maybe You'd like to perform the "upgrade" if I share the code ?