none
Creating objects in DBML without dragging from Server Explorer RRS feed

  • Question

  • Is there a way to create a new entity or method with the designer in a DBML file without having to drag it over from the Server Explorer? For example, with typed datasets you had the option to drag a table from the Server Explorer or to right click in the empty space in a dataset designer view and create a new table adapter from there.

    Tuesday, April 29, 2008 12:18 PM

Answers

  • Sure, you can drag from the ToolBox Window into the designer and define objects without using the Server Explorer.

     

    regards

    Philipp

    Wednesday, April 30, 2008 8:35 AM

All replies

  • Sure, you can drag from the ToolBox Window into the designer and define objects without using the Server Explorer.

     

    regards

    Philipp

    Wednesday, April 30, 2008 8:35 AM
  • You can also do what Philipp suggested by right-clicking on the design surface for the DBML file, and choose Add. Since you mention this as an option for typed dataset, did you try this and it's not working for your DBML?

     

    Thanks,

    Sarah

    Friday, May 9, 2008 10:49 PM
    Moderator
  • This works, it just means I have to fill everything in manually. I was just hoping there was a way to do that and have it automatically grab the information from the database. It looks like the only way to do that is to drag from the Server Explorer. The other thing I was hoping to find was a way to "refresh" objects in the DBML file if the database table changes. As far as I know the only way to force that is to delete the object and drag it back out from the Server Explorer, or else make all the changes manually.

     

    Tuesday, May 13, 2008 5:33 PM
  • There is one other way, though I doubt it will be appealing - there is a generator called SQLMetal, which takes a db and returns dbml. I don't know how to work it (I'm a windows user specifically because I got tired of command lines, and so I do everything I can not to use them. Why have a GUI (especially one with shinny glass) if I'm not going to use it?), but a quick google search will tell you all you need to know.

     

    //Matt 

    Wednesday, May 14, 2008 4:37 AM
  • In this case, SQLMetal will essentially do the same thing that you would get if you just deleted your DBML file from the project and started over. However, you *could* use it to create a new DBML, then manually merge the changes into the one you already have in your project, rather than deleting the existing one and starting over. But even then, you could do the same thing by just adding a new DBML in the O/R Designer, get the new/changed stuff you need out of it, and merge it back into the existing one. You might want to do this if you had manually customized your existing DBML file, for example.

     

    Unfortunately, there is no way to automatically refresh an existing file from the database with either SQLMetal or the O/R Designer, without just completely overwriting what you already have. For new tables you can just drag them onto the existing DBML from Server Explorer, but for existing tables there is not an automatic option.

     

    Thanks,

    Sarah

    Friday, May 23, 2008 7:48 PM
    Moderator