none
modify linq to sql (dbml) file RRS feed

  • Question

  • I have the following two questions:

    1. In a linq to sql (dbml) file for a C# web form 2010 application that connects to sql server 2008 r2 database, I want to modify the size of one of the columns in a specific table called main. To do that, I dragged the table off of the designer surface. I then dragged a new table onto the desginer surface that contained the modified table. This worked ok.

    My problem is the table that I modified has has foreign key references to six different tables. Thus on the designer surface, the main table still has the references to all the applicable tables. However instead of showing one line on the designer surface, there are 4 to 5 references of the main table poiner to each of the other tables. In other words you have table main and it has 5 references to submain2. I would think the desginer should have main table only show one reference to submain2 (not 5 references).

    2.  There is a view that uses the table called main where a column size has changed that is contained within the .dbml file. I would think that I need to drag that view off of the desginer surface and drag the new view onto the designer surface, correct? If not, what do I need to do?

    Thus can you tell me what to do to solve the problem(s) listed above?


    Monday, August 6, 2012 8:08 PM

Answers

  • Hi wendy;  

    To your statement, "Can I go into the *designer.cs file and open the file with a xml text editor. I would then go to the field in the two tables I need to change and change the values in those locations?", I am no expert in manipulating the XML by hand but to answer your question yes that can be done but requires more expertise that I can give.


    To your question, "Do you have other suggestions?", If you have not changed any of the table names or columns names in the tables or only changes a small number of names then what I would do is to select all the tables and relationships on the design surface and delete them making sure you save the file after doing that then drag all the tables from the Server Explorer  that you had previously had there recompile making sure that you change any table or column names that you may have changed before.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Tuesday, August 7, 2012 1:39 PM

All replies

  • Hi wendy;

    Try deleting all the tables that the main table had the references to then save the designer and then add the tables back. See if that works for you.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Monday, August 6, 2012 8:30 PM
  • This did not work.

    Can I go into the *designer.cs file and open the file with a xml text editor. I would then go to the field in the two tables I need to change and change the values in those locations?

    Do you have other suggestions?

    Monday, August 6, 2012 8:32 PM
  • Hi wendy;  

    To your statement, "Can I go into the *designer.cs file and open the file with a xml text editor. I would then go to the field in the two tables I need to change and change the values in those locations?", I am no expert in manipulating the XML by hand but to answer your question yes that can be done but requires more expertise that I can give.


    To your question, "Do you have other suggestions?", If you have not changed any of the table names or columns names in the tables or only changes a small number of names then what I would do is to select all the tables and relationships on the design surface and delete them making sure you save the file after doing that then drag all the tables from the Server Explorer  that you had previously had there recompile making sure that you change any table or column names that you may have changed before.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Tuesday, August 7, 2012 1:39 PM