Re: Object Relational Mapper with deep copy ability?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You may want to ask the sources directly (the two best ORM tools I know of
are LLBLGenPro and Deklarit). Frans is a regular in this group. frans can
be reached here http://weblogs.asp.net/fbouma and Andres can be reached
here http://weblogs.asp.net/aaguiar. I'd run it for you and answer you
directly but I'm a little busy at the moment, however I'd run it by them and
see how their products handle it. Admittidely, I am friends with both of
them (just wanted to make that known up front) but my advice is as objective
as I can be here and has nothing to do with being buddy's. Either tool, I'm
quite sure, can handle what you need and are nothing short of wonderful.

HTH,

Bill
"Josh" <JGough@xxxxxxx> wrote in message
news:1126814899.690601.203110@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Greetings, all.
>
> I'm looking at some of the existing ORM tools to see if they might help
> me create a reusable solution to this problem. I want to be able to
> copy a record and all of its foreign key related records from one
> physical DB to another, but I also need to be able to modify the IDs of
> the child records before performing the insertions.
>
> For example:
>
> In a production app I may have this table:
>
> Person:
>
> person_id PK
> fname
> lname
>
> Report:
>
> report_id
> contributor_id (FK on Person)
> title
> submitdate
>
> ReportHistory:
>
> history_id PK
> report_id FK
> person_id
> action_type (FK on a Lookup table...)
> action_date
>
> When I perform the copy, I want to take all the non-key data from
> Report and ReportHistory, but include some type of mapping to translate
> the person_id and contributor_id into something else, as defined by a
> user.
>
> The reason for this is that we want to be able to move data from a
> production environment to a testing environment and keep the structure
> basically the same, but translate the sensitive production information
> into test data.
>
> Does anyone know a good reusable way to achieve this? I just got
> through looking at Olero ORM.net, but I didn't see an ability to do a
> deep copy of the data.
>
>
> I'm thinking of some pseudo-code like this:
>
> DataManager dmSource = new DataManager(connStringSrc);
> DataManager dmDest = new DataManager(connStringDest);
>
> Report rptSource = manager.GetReportById(23);
> Report rptDest = rptSource.DeepCopy();
>
> foreach (ReportHistory history in rptDest.ReportHistoryCollection)
> {
> history.person_id =
> my_custom_mapping_function_goes_here(history.person_id);
> }
>
> etc...
> In the real situation, there are about 10 child tables.
>
> rptDest.DataManager = dmDest;
> rptDest.Insert(); // or something like this....
>
> The main requirements being:
>
> - The ability to turn off all triggers during the insert.
> - The ability to retrieve all foreign-key related records from a parent
> record.
> - The ability to make a deep copy of the collection that is decoupled
> from the original datasource conenction.
> - The ability to at then iteratively insert/update all child related
> records back to a different target data source.
>
> I thought at first glance the XSD designer in VS 2005 should be able to
> do this, but when I tried to do a obj.GetsomeforeignkeyTableRows() it
> told me the cast was invalid.
>
> I think this can be done in T-SQL also with some "insert into ...
> select" statements, but I don't think it is as reusable or robust as
> being able to do it from code.
>
> Thanks!
> Josh
>


.



Relevant Pages

  • Re: Liar Liar Pants On Fire Dept: Moller
    ... I think it's kinda funny that the best you can find in the report ... supports my position (that no one could verify that Iraq had actually ... production facilities were destroyed. ...
    (alt.politics)
  • Re: Help with table structure for manufacturing production counts
    ... I currently receive a weekly report from the plant managers that gives Model numbers, quantity built, and how many have each various options (ie: color, glass doors, casters, compressor hp, voltage etc). ... The buyers in the purchasing department use the data from this report to help them keep track of inventory of their purchased components and predict what they need to buy in the upcoming weeks. ... I began to set up a table to use to house the data that comes from the weekly production reports ...
    (microsoft.public.access.gettingstarted)
  • Re: B-17s flew missions over wartime Europe
    ... accuracy report gives the average bombing height for 8th Air Force ... expected circular error was 570 feet at 10,000 feet, 830 feet ... and loss of production, then later in the month the same thing for USAAF ... the USSBS has tables and graphs of German ...
    (rec.aviation.military)
  • Re: Access Design
    ... crosstab that would total the PCT for the first and last 6 months. ... > FROM [q Production] ... > I got the report to look just like the excel spreadsheet. ... >> Have you considered using a crosstab query? ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Controlling COBOL DDs named SYSOUT
    ... am concerned, if it is a report, then use an FD! ... CPU costs hard dollars in my z/OS world. ... Another reason why management wants off of the "z". ... It occurs to me that what you are describing is a lack of production ...
    (bit.listserv.ibm-main)