Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> Renaming an entity in designer fails
 

Pages: 1
Bugs & Issues
Renaming an entity in designer fails
Page:1/1 

  Print all messages in this thread  
Poster Message
JimFoye
User



Location:
Austin, TX
Joined on:
22-Jun-2004 04:03:11
Posted:
656 posts
# Posted on: 29-Aug-2007 23:58:15.  
Build: 2.5, Aug. 20th going against SQL Server Express 2005

I had a table called SWS_NameAddress which I renamed SWS_Address. When I refreshed in the designer, it correctly figured out the the table corresponding to my entity had been renamed (uh, how does it do that? reminds me of the old joke about the thermos).

So now I want to rename my entity from SWS_NameAddress to SWS_Address, to keep it consistent with the table name. When I do, I get an error message:

"Renaming of the object is cancelled because of the following error:

The name is not CLS compliant and/or is not usable as an indentifier".

And actually, it gives me this error no matter what new name I use. So that does not seem right. Shocked

There may be something wrong with my project file. I notice that when I bring up the dialog to add new entities from tables in the catalog, the list of "Catalog elements which already have an element mapped" on the left has a trailing underscore on many of the entitity names. For example, in the project explorer the first entity is "Account", which is based on the table dbo. Account. But in this dialog, this appears as "Account_". I have no idea why.Confused

I can upload a screenshot showing this if need be. Meanwhile, I might just start over (this is a fairly new project).

Jim


  Top
JimFoye
User



Location:
Austin, TX
Joined on:
22-Jun-2004 04:03:11
Posted:
656 posts
# Posted on: 30-Aug-2007 00:12:01.  
[Update]

I created a new project file from scratch. Of course the entity is named SWS_Address initially. I have no problem renaming it to SWS_NameAddress and then back again.

The trailing underscores still appear in my entity list in that dialog, so I guess that's by design? Seems kind of strange, though.


  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8138 posts
# Posted on: 30-Aug-2007 08:23:06.  
HI Jim,

JimFoye wrote:
The trailing underscores still appear in my entity list in that dialog, so I guess that's by design? Seems kind of strange, though.


LLBLGenPro Help wrote:
A screen will pop up, showing all database tables (or views) in the catalog. As you can map as many entities onto a single target as you'd like, all tables (or views) are always listed. LLBLGen Pro automatically suggests names for entities for these targets, so if you already have an entity mapped on a given table/view, it will make sure the name suggested isn't clashing with the names already available in the project.
By default, no possible entity is checked to be added to the project.
You can check / uncheck entities by either using your mouse, or by stepping through them using your keyboard arrows. The spacebar will toggle the checkbox belonging to the selected entity on and off. You can also select one ore more rows in the grid and click 'Toggle checkboxes of selected rows', which will toggle the checkboxes of the rows you selected. Each row that is checked will be added to the project as an entity. Keep in mind that all names in an LLBLGen Pro project have their first character capitalized, need to be CLSCompliant and should be usable as a C# identifier. This way each name can be used in the code safely.


The trailing underscore if for entities that have been currently added, so the underscore prevents you have entities with the same name.

David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14626 posts
# Posted on: 30-Aug-2007 10:10:23.  
Quote:
So now I want to rename my entity from SWS_NameAddress to SWS_Address, to keep it consistent with the table name. When I do, I get an error message:

"Renaming of the object is cancelled because of the following error:

The name is not CLS compliant and/or is not usable as an indentifier".

And actually, it gives me this error no matter what new name I use. So that does not seem right

Even if you remove the underscore from the name?


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
38048 posts
# Posted on: 30-Aug-2007 12:16:31.  
The error comes from the fact that you have enabled 'RemoveUnderscoresFromElementName', and because you have specified a '_', it won't allow it. At least, if I have that project property set to true (it's a project property inherited from preferences) I get the error, but if I set it to false, I don't (which is logical).

Detection is quite simple really Regular Smiley After all found tables are done, it will check all not yet migrated entities with the still left tables and see if fields match. If so, it will pick that table.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
JimFoye
User



Location:
Austin, TX
Joined on:
22-Jun-2004 04:03:11
Posted:
656 posts
# Posted on: 31-Aug-2007 20:11:56.  
Ok, I understand about the add entities dialog now, thanks.

Otis wrote:
The error comes from the fact that you have enabled 'RemoveUnderscoresFromElementName', and because you have specified a '_', it won't allow it. At least, if I have that project property set to true (it's a project property inherited from preferences) I get the error, but if I set it to false, I don't (which is logical).


Indeed, it does allow me to rename it to something without an underscore. Here are some observations:

1) The message might say "You can't name the entity with an underscore", rather than it's not CLS-compliant, etc.

2) I'm not sure why it's illegal for me to rename with an underscore. I interpreted that property to mean that when naming entities, the designer would not strip out the underscores it saw in the schema names. It appears to mean that plus, no entity can be named using an underscore. Is this correct? Remember, the entity is already named with an underscore. So besides the fact that property may mean more than it should, there is also an inconsistency in that my project has existing entity names that are not "legal" according to this property setting.

Seems to me that while it's fine for the designer to have some guidelines on default naming of entities when pulling from the schema, I shouldn't be restricted from how I want to manually name an entity.

Quote:
Detection is quite simple really Regular Smiley After all found tables are done, it will check all not yet migrated entities with the still left tables and see if fields match. If so, it will pick that table.


Heh, well guess I figured that subconciously. It's a bold move, and it works! Cool


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
38048 posts
# Posted on: 07-Sep-2007 11:55:44.  
JimFoye wrote:
Ok, I understand about the add entities dialog now, thanks.

Otis wrote:
The error comes from the fact that you have enabled 'RemoveUnderscoresFromElementName', and because you have specified a '_', it won't allow it. At least, if I have that project property set to true (it's a project property inherited from preferences) I get the error, but if I set it to false, I don't (which is logical).

Indeed, it does allow me to rename it to something without an underscore. Here are some observations:

1) The message might say "You can't name the entity with an underscore", rather than it's not CLS-compliant, etc.

Yes, that's a bit of a problem now. The routine simply makes a call to the CLScompliant routine and it gets back a string which is different. It then concludes: the original string wasn't CLScompliant as it had to be altered. As this could have a lot of different causes, giving the right error is a bit of a problem, but yes I agree with your remark.

Quote:

2) I'm not sure why it's illegal for me to rename with an underscore. I interpreted that property to mean that when naming entities, the designer would not strip out the underscores it saw in the schema names. It appears to mean that plus, no entity can be named using an underscore. Is this correct? Remember, the entity is already named with an underscore. So besides the fact that property may mean more than it should, there is also an inconsistency in that my project has existing entity names that are not "legal" according to this property setting.

The property means that underscores shouldn't be there. THus if you rename a name and specify a '_', it obviously can't allow that, as you've specified that you wanted no underscores.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.