Removing multiple entities at onjce from the designer

Posts   
 
    
torevor
User
Posts: 17
Joined: 08-Apr-2011
# Posted on: 13-Apr-2011 20:48:19   

I had pulled in an existing sql server database into my LLB project, but later I needed to reference a different, slightly modified version of the database (different database/schema name, but 95% same as first database).

I added this new database in the Project Explorer --> Relational Model Data. I deleted the first database from the Catalog Explorer.

Now, I want to rebuild my entities based on the new database I am referencing, and remove the entities mapped to the old database.

I set "RemoveUnmappedElementsAfterRefresh" to True, thinking this would delete those entites, but it seems to not do that.

If I try to "refresh relational model data from database" I get: "One or more errors or problems detected during the project validation and relational model data adjustment process. Please check the 'Errors' window for details"

The errors (one for every entity) are like:

Message type: Error Message text: The entity 'mySchemaName.myTableName' has a mapping definition for the target database with driver 'SQL Server 2000/2005/2008/Express Driver (SqlClient)' but there's no target element specified in the mapping.' Source: mySchemaName.myTableName Created on: Wednesday, April 13, 2011 11:35 AM Corrections/suggestions Choice 1: Open 'mySchemaName.myTableName' in its editor and manually map the entity to a target. Choice 2: Auto-map 'mySchemaName.myTableName' onto a new or matching existing target in relational model data for database 'SQL Server 2000/2005/2008/Express Driver (SqlClient)'

It seems if I just choose #2: (Auto-Map), this cleans up the problem.....but going through all entities is a bit tedious....would it be possible to have an "auto map all" option? (And as for choice #1....I couldn't see where you could actually manually change where an entity was mapped, although maybe I didn't look closely enough).

Having the ability to both multi-delete entities in the project explorer, and auto-remap all entities (in the case where you've changed your database for whatever reason) would be nice additions, if this functionality isn't already there and I'm missing it.

UPDATE:

Actually, it seems the Auto remap didn't work.....I just ended up with a bunch of errors like: Message type: Warning Message text: The Table 'myDBName.mySchemaName.myTableName' can be considered orphaned (no project element is mapped onto it) Source: Project Relational Model Data Adjustment Created on: Wednesday, April 13, 2011 11:54 AM Corrections/suggestions Choice 1: Exclude the element from the project Choice 2: Mark the element for deletion Choice 3: Leave as-is

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 14-Apr-2011 06:38:08   

The best choice in this situation, in my opinion, is: - Go to your original project (make a backup) - Go to the Catalog Explorer and rename your old catalog for the new one (i.e. Northwind by Northwind2). Now your project points to the new catalog. - Ensure the RemoveUnmappedElementsAfterRefresh project's property is set to true. You can also set that in the LLBLGen Preferences and set Default in Project properties. - Now refresh the model. LLBLGen will say you that something is changed and recommend you to export the DDL. Skip the dialog if you want. - Follow the wizard. Note that you are now refreshing against your new catalog. - When the refresh report appears, it will say you that many unmapped elements had been removed.

As you see, you don't need the auto-map feature. Anyway, there is a global action you can invoke if you run into the need of use it. You can right-click the Entities node and click 'Auto-map unmapped entities' option. Note that I assumed you are using v3.x coz you didn't tell me that simple_smile

Hope helpful wink

David Elizondo | LLBLGen Support Team
torevor
User
Posts: 17
Joined: 08-Apr-2011
# Posted on: 14-Apr-2011 17:44:18   

Yes on the 3.1.

Ok, this seems like a reasonable solution if it works, will give it a try, thanks!

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 14-Apr-2011 19:48:07   

Let us know how you get on?

Thanks

Matt