Print Page | Close Window

Duplicate Table Names in Different Databases

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=146
Printed Date: 14-Sep-2025 at 6:11am


Topic: Duplicate Table Names in Different Databases
Posted By: Linguinut
Subject: Duplicate Table Names in Different Databases
Date Posted: 12-Jul-2007 at 11:27am
I have a PartsMaster table in database A, and a [PARTS MASTER] table in database B.  The A table has been in existence in my project for quite some time.  Today, I needed to access the older B table and incorporate it into my project.  I was going to call it oldPartsMaster; however, when I added the class, the name was automatically changed to PARTSMASTER (space was removed).  This is not good, because when I renamed the table to oldPartsMaster, it deleted the original PartsMaster.cs file.  Now, when I save the ORM and rebuild the Model project, it errors, stating that the PartsMaster.cs file is not found.  And, it really isn't there anymore.  I closed the object mapper and told it not to save the changes (too late!).  Even if I open it again and try to recreate the table, I get the same error.
 
Solution:  Delete from the ORM the PartsMaster class that is missing.  Add the oldPartsMaster class.  ReAdd the PartsMaster class.  Save.
 
The BIG problem now is recreating any custom code in the PartsMaster class that was lost:  Create method, Custom properties, etc.  I did not even think to record this elsewhere before making these changes.  Long ago, I removed VSS because it caused far more problems that it is worth.  My next option is to find a backup.  At least, I could copy/paste the customizations into the newly created class.
 
Has IdeaBlade considered this renaming thing and the potential damage to existing classes?  Any solutions on your part?  Perhaps I am doing something wrong in my approach.
 
Thanks!
Bill



Replies:
Posted By: Linguinut
Date Posted: 12-Jul-2007 at 12:13pm
Unfortunately, the solution was only partial.  I had to manually change some naming in the oldPARTSMASTER.cs file.  The constructors section had labelled the partial class as PartsMaster.  That obviously conflicted with the real class' constructors.  Confusing, at best.  I hope it was just me doing something wrong.  After the Model build, it all looks OK; however, my next plan is to run the ORM again.  Crossing fingers.



Print Page | Close Window