none
Removing Entity in Designer leaves references in XML

Answers

  • 1. When you delete an EntityType, that type is fully deleted from the model (the CSDL section.) If you are still seeing it in the CSDL, please let us know, since that is not a bug we've ever seen reported.

     

    2. However, we do not delete the table definition from the SSDL. This was by design, but with all of the feedback that you and others have provided, we are looking at changing the design. We have not yet nailed down the exact approach, but are exploring the idea of also deleting the mapped database tables from the EDMX file when the types mapped to them are deleted. Your feedback here will be forwarded to the product team as more evidence that this may be the right thing to do.

     

    Many thanks!

      Noam

    Thursday, September 04, 2008 3:00 PM
    Moderator

All replies

  • I've had the same issue.

    Unfortunately the only solution I've found is to also remove the entities from XML manually.

    I assuming it will be fixed with v2 of the designer.

     

     

    Thursday, September 04, 2008 10:22 AM
  • Hi Iain

     

    Thanks for the reply. It's good to know we're not the only ones having this problem. It's a pretty annoying bug too, I hope Microsoft repairs this in a Hotfix or so. We are working with the EF since December last year and had to cope with a lot of annoying problems in the first release. We finally hoped that would be over now.

     

    Maybe someone from the Entity Framework Team can give us an estimate when this bug will be fixed (please )?

     

    Cheers,

    Paul.

    Thursday, September 04, 2008 11:58 AM
  • 1. When you delete an EntityType, that type is fully deleted from the model (the CSDL section.) If you are still seeing it in the CSDL, please let us know, since that is not a bug we've ever seen reported.

     

    2. However, we do not delete the table definition from the SSDL. This was by design, but with all of the feedback that you and others have provided, we are looking at changing the design. We have not yet nailed down the exact approach, but are exploring the idea of also deleting the mapped database tables from the EDMX file when the types mapped to them are deleted. Your feedback here will be forwarded to the product team as more evidence that this may be the right thing to do.

     

    Many thanks!

      Noam

    Thursday, September 04, 2008 3:00 PM
    Moderator
  • Hi Noam,

     

    Thanks for the quick response. We've got a pretty large Model that contains a lot of Entities. One of the Main Entities is called tDossier. It has Relations all over the place. I've removed it from our Model an pretty much every remained in the XML. In SSDL, CSDL and C-S mapping content.

     

    If you would like to have the edmx File that would be no problem. Tell me what you need and I'll send it to you.

     

    We're using the August Release of the .NET Framework together with SP1 for VS2008. Below you'll find a copy of my installation of Visual Studio 2008.

     

    Of late we've experienced several crashes with CodeSMART but I don't believe they are EF Designer related.

     

    Cheers,

    Paul.

     

    Microsoft Visual Studio 2008
    Version 9.0.30428.1 SP1Beta1
    Microsoft .NET Framework
    Version 3.5 SP1

    Installed Edition: Professional

    Microsoft Visual Basic 2008   91605-270-6053687-60481
    Microsoft Visual Basic 2008

    Microsoft Visual C# 2008   91605-270-6053687-60481
    Microsoft Visual C# 2008

    Microsoft Visual C++ 2008   91605-270-6053687-60481
    Microsoft Visual C++ 2008

    Microsoft Visual Studio 2008 Tools for Office   91605-270-6053687-60481
    Microsoft Visual Studio 2008 Tools for Office

    Microsoft Visual Web Developer 2008   91605-270-6053687-60481
    Microsoft Visual Web Developer 2008

    AnkhSVN - Subversion Support for Visual Studio   2.0.5073.165
    AnkhSVN - Subversion Support for Visual Studio 2.0.5073.165
     * Ankh.Package 2.0.5073.165
     * Subversion 1.5.1 via SharpSvn 1.5001.714.32513

    CodeSMART   2007
    AxTools CodeSMART 2009 for VS.NET (VSIP-level support package)

    Devart MyDirect .NET   4.85.34.0
    Devart MyDirect .NET
    Copyright  2002 - 2008 Devart. All rights reserved.
    Web: www.devart.com/mysqlnet
    Support: mysqlnet@devart.com

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB944899)   KB944899
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/944899.

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB945282)   KB945282
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/945282.

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946040)   KB946040
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/946040.

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946308)   KB946308
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/946308.

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946344)   KB946344
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/946344.

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946581)   KB946581
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/946581.

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947171)   KB947171
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/947171.

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947173)   KB947173
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/947173.

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947180)   KB947180
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/947180.

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947540)   KB947540
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/947540.

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947789)   KB947789
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/947789.

    Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB948127)   KB948127
    This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this hotfix will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/948127.

    Microsoft Visual Studio 2008 Professional Edition - ENU Service Pack 1 (KB945140) (Beta)   KB945140
    This service pack is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this service pack will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/945140.

    Microsoft Visual Studio 2008 Professional Edition - ENU Service Pack 1 (KB947888) (Beta)   KB947888
    This service pack is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this service pack will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/947888.

    Microsoft Visual Studio 2008 Professional Edition - ENU Service Pack 1 (KB948484) (Beta)   KB948484
    This service pack is for Microsoft Visual Studio 2008 Professional Edition - ENU.
    If you later install a more recent service pack, this service pack will be uninstalled automatically.
    For more information, visit http://support.microsoft.com/kb/948484.

    PowerCommands for Visual Studio 2008   1.0
    A set of power commands for Visual Studio 2008

    AxTools CodeSMART 2009 for VS.NET
    For more information about CodeSMART 2009 for VS.NET, see the AxTools website at http://www.axtools.com

    Monday, September 08, 2008 8:14 AM
  • I would agree this threw me too for some time.  As the current behavior works counter to what one would expect.  IMO, mostly during dev, you want/need to remove and add back table(s) and let the tool do the hard work.  I don't think manually adding back the entity and columns is right behavior by default - but could be wrong.

    Monday, September 08, 2008 2:39 PM
  • Paul,

     

     Please do send the EDMX file (with tDossier in it) to my microsoft email alias: noamba.

     

    William,

     

     Are you saying that you would want the tool to delete the SSDL tables when they become unmapped?

     

    Thanks,

      Noam

    Monday, September 08, 2008 5:23 PM
    Moderator
  •  Noam Ben-Ami // MSFT wrote:

    This was by design, but with all of the feedback that you and others have provided, we are looking at changing the design. We have not yet nailed down the exact approach, but are exploring the idea of also deleting the mapped database tables from the EDMX file when the types mapped to them are deleted. Your feedback here will be forwarded to the product team as more evidence that this may be the right thing to do.

     

    Many thanks!

      Noam

     

    Hi Noam,

     

    Regarding the details of how to manage deletions in a model (as well as other activities). Since you guys are in the process of figuring out the best approach, I thought I'd throw in a request to make it all configurable. Instead of choosing one method or another, could you give us the ability to configure how we want the visual designer to work? Both as a base configuration option, and maybe an option in the context menu for entities? Say, in the case of deleting an entity. We could configure it to delete the underlying SSDL content along with the CSDL/MSL by default. However, if we had the option to right-click the entity, point to the delete sub menu, and choose from a few options:

     

    Delete -> Delete Entity

    Delete -> Delete Table

    Delete -> Delete Entity and Table

    Delete -> Delete Entity, Table, and Associations

    etc.

     

    That would give us the option to delete how we need to on a per-instance basis. There have been several cases where I've generated my EDM from the database, then wanted to remove some of the entities and their underlying tables and associations (in SSDL as well as CSDL) so I could add back better conceptual entities that fit my domain better. Along the same thread, it would be nice if we could configure to a greater degree how entities are updated when doing an update from db, like configuring how to update entity keys in SSDL to not update at all, not update for existing definitions, not update only for views, maybe the option to ask before updating, and other options like that.

    Monday, September 08, 2008 8:02 PM
  •  

    Noam,

     

    Send the file to x@x.x What I mean is that when I select the Entity in the Designer and press 'Delete' I would expect all the information about the Entity and it's relations to dissapear from the XML.

     

    I would agree with jrista, that it would be a nice feature to be able to select what to delete, too.

     

    Cheers,

    Paul.

    Tuesday, September 09, 2008 11:11 AM
  • How about Updating the Wizard itself. It needs to be more clear about

    1. What's in the Conceptual Model
    2. What's available in the Mapped SSDL
    3. What's in the Underlying Database

    Then in each of the above categories allow to regenerate the higher level entity. That's if in #3 if I have a table not in #2 and #1 I should be able to update it.

    If I have something in #2 and not in #1 I should be able to add it as a single table to entity mapping (at the least).

    One issue with the current tabs is that they themselves are activities and not store areas. I am sure you guys have done some study on this and I might be missing a point here but it would be intuitive to have the concept of CSDL/SSDL and database on these tabs. Then we can have links(buttons) to add, delete, refresh/move.

    Another approach will be to make the Model Explorer a bit more functional on the same line. In the current implementation, we are unable to delete the  SSDL. This is  of course for the same valid reason of not touching developer's code but there has to be a prompt/report that the delete operation failed because of references or anything else.

    Then we can then also have a small section for options as described by jrista.

    One Use Case will be very useful
    ================================================
    Start by building a class like in the VS Class Designer then map it to the 2 tables. At present, as per the walk-through/samples, we assuming that we start by inheriting from a table and then direct some properties to a different table.

    And of course, the best thing will be to integrate the Class designer to SSDL. This could be a little wild but just wanted to put it out there.


    All said, I like the entity modeller, I am glad that we madde this an integrated part of ADO .NET




    Tuesday, September 09, 2008 12:46 PM
  • Thank you,

     

     We agree with your points: We've discussed using the class designer with the EF before and you will see steps in the next release that will get us quite close to this.

     

     Regarding deleting SSDL objects in the explorer, we are currently working on this feature and are hoping to get it into the next release. In fact, we started real work on it today, nice timing!

     We are also discussing the automatic, though user-overridable, deletion of SSDL when the corresponding CSDL is deleted. I've posted a pair of RFCs on this message board - your thoughts on this here or there would be appreciated.

     

     Wholesale changes to the update wizard UI are not forthcoming, as we are focused on finding ways to preserve user edits to the SSDL - see my other RFC.

     

     Thanks again,

       Noam

    Tuesday, September 09, 2008 4:57 PM
    Moderator
  • Really appreciate all the hard work you guys are putting into this. I agree with you that: User update should be preserved and be warned for in case of a delete operation

    I hope in the next release we will get : Control over Pluralization and the Use Case to build an independent Entity (as described in my last post)


    Just one more thought:
     
    1. Multiple EDMX (or EDMX part) files (NOT like partial classes but the notion of Entity Universe containing multiple EDMXs)
    2. When entity is defined in one EDMX file, make it available in the Wizard to drop it in another design surface but keep it locked

    This will be particularly helpful if we are dealing with large DB schema. I have seen that the ER diagram can get real messy for big models.

    Cheers Smile
    Tuesday, September 09, 2008 7:06 PM
  • Agreed, we do appreciate the interaction and hard work you guys are putting into EF. I'm really looking forward to the next release.

    I would like to second the need for something like partial EDMX files, or perhapse something more advanced such as EDMX views. When you have a model with more than a couple hundred entities, managing and arranging it (not to mention updating it) can become quite a hairy process. It would be AWESOME if we could set up "views" on our model so that we can pick an organized subset of entities to manage. Some things in this regard might be a bit tricky, such as handling changes to entities with "off-view" references where those changes affect non-visible entities...but I think those could be worked out. Model views would allow those individuals with really huge databases (more than a couple hundred to thousands of tables) to be able to use the visual designer without having timeout or system hung issues. I can also see it being useful when certain subsets of a database are used in isolation for different projects and there is no crossover, but still being able to manage it all in a central location.

    Is there a link to this RFC page? I have some other ideas I'd like to throw out as well.
    Tuesday, September 09, 2008 7:18 PM
  • Hi,

     

    I'm having the same problem as well. It must say I was surprised when the table was not deleted when I removed an entity from the model, and there is no option to do it in the model explorer either...

     

    However I found a workaround. The update wizard has logic for removing tables, but only if the table is not in the database. What I did was: Rename the table in the database. Run update wizard an choose the table for deletion in the delete tab. Update model. Rename table back to original name. There you go, no XML hacking and table is gone!

     

    I know it might not work for all scenarios, but it worked for me without destroying table relations and such.

     

    /Fredrik

    Wednesday, September 17, 2008 6:47 AM
  • Thanks Fredrik, that worked for me. But seems to be a very serious bug to be in the final version shipped in 3.5 SP1... hotfix please?
    Monday, December 01, 2008 10:54 AM
  •  Johan Wikström wrote:
    Thanks Fredrik, that worked for me. But seems to be a very serious bug to be in the final version shipped in 3.5 SP1... hotfix please?

     

     

    I have added a "cleanup" feature to my toolkit, Huagati DBML/EDMX Tools.

     

    The first version of this feature allows you to view a list of 'orphaned' SSDL entities and gives you two choices: re-create the corresponding CSDL+MSL, or remove the orphaned SSDL, or remove unmapped CSDL. No more xml editor needed for removing entity sets/types (or for re-adding entity sets/types that were accidentally removed from the CSDL).

     

    This feature is described in more detail here:

    http://blog.huagati.com/res/index.php/2008/11/27/tools-part-7-add-ins-how-to-deal-with-the-entity-framework-designer-and-orphaned-entities/

    Updated link: http://www.huagati.com/dbmltools/

     

    Monday, December 01, 2008 11:27 AM
  • I have the same problem.  If I delete an entity from the designer then at least if I could somehow add it back to the designer.  For example, being able to drag and drop from the "model browser"/"Tables views" window.

     

    Monday, December 01, 2008 9:04 PM
  • Hi Noam,

    Thank you for active interest in this thread.  It is refreshing to know Microsoft is embracing open communication with its developer community, particularily on the new features being enhanced such as the Entity Framework.

    I am an old ASP.NET programmer - been working with the technologies since the very first betas of .NET were introduced.  I love the ASP.NET platform and quite frankly the Entity Framework has excited me as much as the original launch of ASP.NET.  Entity Framework means I can spend more time building features, and less time on plumbing.  This being true, I share the concerns expressed by other developers in this thread.

    I am new to developing applications that use the Entity Framework.  Quite frankly, I am building my first application that uses the Entity Framework.  I am getting scared quickly that the Entity Framework is not ready for prime time yet because making changings to the database model is a normal procedure in the Agile/Scrum process we use while buiding software.  Unfortunately, everytime we make a change to the database it becomes a nightmare to keep those changes up-to-date in the entity model designer.

    My initial impression was the "Update Model from Database" feature would basically keep things simple and synch everything.  Not the case under a few scenarios I've encountered:

    scenario 1) we added a new field to a table and forgot to create the foreign key.  Ran "Update Model from Database" and the entity model was updated with the new property.  We quickly realized our oversight in adding the foreign key on the database table and corrected the database.  When we ran the "Update Model from Database" again it seemed to work, however we ran into all kinds of compile time errors.  My best guess is the entity model may have kept the records referring to the property as scalar in addition to treating it as an association.  I am just guessing that this may have been the cause, as I never did figure it out.  I thought I could work-around the problem by creating scenario #2 ;)

    scenario 2) I deleted a table from the entity model and attempted to run an "update model from database" to re-add the table.  This is where I have ran into the same issue everyone else has been talking about.  I am basically out of luck now and my only option is to edit all of that messy XML directly?  Not exactly the "efficiency" I was hoping for by adapting the Entity Framework.  Quite frankly, working with ADO.NET and Stored Procedures is starting to look like the best option given the Entity Frameworks lack of a polished designer.

    At this point, I am thinking the best fix for my problem is to simply DELETE the Entity Model and start all over again.  This seems like a rather sad thought: the best approach is to really delete my code and start over again???!  The Java guys are going to have a good belly laugh when they hear what Microsoft is putting us poor .NET guys through here.  The kicker is, if I delete the model and start all over again I have the tedious job of renaming all of my associations again from the beginning!!  This takes a lot of work for the project I am working on.  This is another issue, frankly, that I am having with the Entity Model Designer.  Like most databases, my tables have several references to the same foreign table - which leaves me with a bunch of entity associations called "xxxx1, xxxx2, xxxx3" - this requires a lot of renaming which I am happy to do once - but the thought of having to re-do that everytime the Entity Designer breaks hardly seems enticing!  Here is a sample DB model to illustrate the motivation behind all of this:

    Table: UserAccount
    - UserAccountID
    - Username

    Table: Project
    - ProjectID
    - CreatedBy (reference to UserAccount.UserAccountID)
    - LastModifiedBy (reference to UserAccount.UserAccountID)
    - ProjectName
    - ProjectOwner (reference to UserAccount.UserAccountID)

    I suppose I am simply out of luck right now.  I have to either decide to start all over again with my entity model or go back to my trusty ADO.NET and Stored Procedures.  If I knew I only had to start over again one more time with the Entity Framework Model it would be an easy decision - my fear is I may have to start all over again another 8 times before this project is done.

    Thanks again Noam for your collaboration in this forum.

    A frustrated Entity Framework developer wishing Microsoft would release a service pack soon!!

    M.S.
    Thursday, November 05, 2009 4:06 PM