Register
Login
Home
Code Complete
Download
Purchase
Your Cart
Forum
Services
Contact us
Tuesday, January 06, 2009
Web
Site
Forum
Unanswered
Active Topics
Forums
Search
Members
Forums
>
Code Complete
>
Support
Name changes not being reflected in generated code
Last Post 30 Oct 2008 06:59 AM by
eurowise
. 2 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
Telarian
New Member
Posts:33
29 Oct 2008 10:17 PM
I have a situation where the database objects I work with have prefixes based on their purpose. So you might have a table called tblPayments or lkpMethod. I don't really like having those prefixes transferred into the object names generated by CodeComplete. So I just change the names of everything in the CodeComplete interface (primarily in the "Class Names" section). For the most part this works out great but there are some places where the changes made in the CodeComplete interface are not reflected in the generated code.
For instance, the following is generated within the DLMethod.Designer.vb file within the DL part of my project.
-----------------------------------------------------------------------------------
''' <summary>
''' Generates a list of DT child objects
''' </summary>
''' <param name="Id" >System.Int32</param>
''' <returns>List</returns>
''' <remarks>Set the overwrite flag to Y to re-generate the method</remarks>
''' <overwrite>Y</overwrite>
Public Shared Function GetTblPaymentCollectionData(ByVal Id As System.Int32) As List(Of DTTblPayment)
Dim Command As SqlCommand = GetTblPaymentCollectionCommand(Id)
Dim DTOTblPaymentList As New List(Of DTTblPayment)
Using dr As New SafeDataReader(Command.ExecuteReader())
With dr
While .Read()
Dim DTOTblPayment As New DTTblPayment
DTOTblPayment.Id = .GetInt32("Id")
DTOTblPaymentList.Add(DTOTblPayment)
End While
End With
End Using
Return DTOTblPaymentList
End Function
'<end_overwrite>
-----------------------------------------------------------------------------------
I get the following errors in this section though.
-----------------------------------------------------------------------------------
Error 138 Type 'DTTblPayment' is not defined. C:\thepath\DL Classes\DLMethod.Designer.vb 527 46
-----------------------------------------------------------------------------------
If you look at the suggestions provided by VS for fixing the error it shows you that 'DTTblPayment' should in fact be 'DTPayment'. The problem is basically that the name changes made in the CodeComplete interface were reflected in some parts of the generated code, but not in other parts. Obviously this is a problem.
This is just one example. These types of errors pop up all over the place. Hundreds of individual instances in fact. Obviously it happens for each object you generate for. In my case there are only six database objects in use so it isn't too crazy to fix.
I should point out that the instance of "GetTblPaymentCollectionCommand(Id)" above is in fact correct. I thought that I should leave the stored procedures using the actual table names. So I didn't change the stored procedure names in CodeComplete. Therefore that one is actually correct.
If the option of changing the names is going to be there (which I think it absolutely should) then the changes need to be reflected throughout the generated code.
Telarian
New Member
Posts:33
29 Oct 2008 10:22 PM
I should also point out that the practice of removing the 's' from the end of database object names for the purposes for creating csla object names, isn't entirely without flaws at this point either. For the most part I like it, but it does cause some very odd looking object names for my database object called 'lkpStatus'. I just fix it in the Class Names section of the CodeComplete interface but as I pointed out above, those changes are not reflected everywhere in the generated code.
eurowise
Basic Member
Posts:107
30 Oct 2008 06:59 AM
Thanks for reporting that. We are aware of the problem and we are working on it to fix it. We are also planning to allow you to specify the prefixes that will be removed during the configuration and Code Complete will do it for you.
Philip
You are not authorized to post a reply.
Code Complete
--Dedicated to the latest news and announcements
--Tips and Tricks
--Code Complete Templates
--Testimonies
--Wish list
--General
--Support
Default Group
--Default Forum
Forums
>
Code Complete
>
Support
Active Forums 4.0
(c) 2009 - Eurowise Soft - Code Complete, The code generator.
|
Terms Of Use
|
Privacy Statement