This is a migrated thread and some comments may be shown as answers.

Updating an Entity Definition

12 Answers 93 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 12 Apr 2011, 07:11 PM
Ok I like how the new wizard shows me everything now in a nice list

But I'm running into the annoyance of it Appending properties to my definitions instead of removing and refreshing.  So we updated a table with a DB constraint.  The wizard showed REMOVE against all the columns then ADD below those showing it needed to re-add them (okay fine).  When I clicked finish, nothing was removed, I had an entity with every column duplicated which means I have to delete and re-map the thing in which also means I lose every custom association I have defined and have to re-drag all those in.

Why can it not just remove and add as described?...or at least give us a checkbox so I can say "Yep, I'm cool with that happening"

12 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 13 Apr 2011, 12:31 PM
Hello Steve,

We are glad to hear that you like the new Update from database wizard.

Usually, if only a new constraint has been added to the database, the changes should look something like in the attached image. There should not be any removed or added columns. Just a new constraint added to the Constraints collection of the table containing the foreign key.

Having remove operation for an item (a column for example) and also an add operation for the same (or almost the same) item, usually results from renaming the same item in the database.

In order to be able help you further I will need to have better understanding about the state of your model before updating and also about the changes in your database.
It will be best if you can send us a SQL script that creates the database (or just the relevant part of it), and also another SQL script that performs the changes that have to be applied to the model using the Update from database wizard.
This way I will be able to investigate your exact case locally.

About updating the model when there are removed items in the database we have some plans to improve the experience there. As always your feedback is most welcome.


Best wishes,
Jordan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 13 Apr 2011, 03:31 PM
I will try and get the rLinq...although you guys probably already have it in a seperate ticket...

You know what it probably is\was.  OA generated the properties as UserId RuleId and I renamed them to UserID and RuleID...is there some logic in the wizard to not look at the underlying column name or something?  Becasue the wiz didn't say Modify at all, it was X Removes, then X Adds.

Steve
0
Jordan
Telerik team
answered on 14 Apr 2011, 03:13 PM
Hello Steve,

Actually, the name of items (columns, tables, etc.) is essential for the Update from database process.
Currently the name is the most important component when comparing items.
Because of that when two columns have different names (even if they are almost the same) they are considered different.
As you can imagine, we cannot know with 100% accuracy which column has been renamed to which other column, and what was the intention of the user.
This is why in the Update from database wizard a pair of add / remove operations is shown.

The best we could do here is a suggestion that  a column has been renamed, but ultimately it is up to the user to decide.
We have some plans to improve the experience in that area, but I cannot share anything specific at the moment.
As always, your feedback is most welcome.

Best wishes,
Jordan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 14 Apr 2011, 04:37 PM
Is there no attribute in the rLinq which knows the underlying column?...like userId automaps as UserId, so I rename it to UserID...should it still not know UserId&UserID link back to userId? (did that make sense)?
0
Jordan
Telerik team
answered on 15 Apr 2011, 04:11 PM
Hello Steve,

It depends where you do the renaming.
If you rename a column or a property in the visual designer the mapping is preserved, since in the visual designer we are in control.

But if you rename a column or a table in the database, since we do not control that and cannot know what the intention was when you do an Update from database you will get an add/remove pair of operations.

Or did you mean something else?

Regards,
Jordan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 15 Apr 2011, 04:16 PM
Well yeah :)  I wouldn't expect you to magically match columns names if renamed in the DB table :)

I meant in the designer...I renamed the columns in the designer to be uppercase.  And I did get the Add\Remove in the update wizard.

Now our SQL guy has a script which he runs which triggers an ALTER...but the column names (casing) never changed there.

Steve
0
Jordan
Telerik team
answered on 19 Apr 2011, 11:38 AM
Hi Steve,

You probably already know that, but just in case:
If just the names of the properties in the generated code are what concerns you, this can be fixed very easily without any impact on the database by just renaming the properties in the visual designer (and not the columns using the table editor). This way the generated code will look like you want it to, the database schema remains unchanged, and the mapping between database and model is preserved.

Kind regards,
Jordan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 19 Apr 2011, 09:17 PM
Hey Jordan,
  I think you've lost sight of the original issue :) 

1) I renamed the columns in the designer
2) DB guy altered the table
3) Update to the model duplicated all the columns with ADD\REMOVE rows in the wizard
0
Jordan
Telerik team
answered on 20 Apr 2011, 07:23 AM
Hello Steve,

Thank you for the clarification.

It will also be helpful to know exactly what did you do in order to rename columns in the visual designer.

Anyway, if your DB guy renamed columns in the database (to something different than in the model) then it is completely normal to get the add / remove operations.

All the best,
Jordan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 20 Apr 2011, 03:27 PM
Click then Property, change the name in the Properties pane in VS2010...thats all

DB Admin did not change the names of the columns at all
0
Jordan
Telerik team
answered on 21 Apr 2011, 10:43 AM
Hello Steve,

Actually what you did (using the property grid in the visual designer) is rename the property, which has no effect whatsoever on the associated column. You can use the Mapping Details Editor tool window to see the columns mapped to the properties of a given class. There you should also see that the column names have not changed. So this should not be the reason for the add / remove operations in the Update from database wizard, because there only the relational parts (tables, columns, etc.) of models are compared.

Note:
Currently, the only way to change the name of a column is by using the Table editor (right click on class' header in the visual designer > Edit Table...).

In order to be able to help you further I will need to have better understanding about your model and how it was changed. It will really help if you can send at least the relevant parts of your model before and after it was changed. SQL scripts defining the database schema (before and after) may also help.

Regards,
Jordan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 21 Apr 2011, 02:39 PM
I realize that all I was doing was superficially changing the model property names (not affecting the DB tables)...that was what I was attempting to do. 

So that's why I posted this...becasue it was so odd.  I was expecting that an ALTER to the table by our DB guy to add in a simple constraint would not delete and re-add (duplicate) all of my properties.

So might as well just close this, I can manually fix it where needed, and now I know to at least watch for the strangeness
Tags
Design Time (Visual Designer & Tools)
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Jordan
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or