locked
Can't set DefaultContainerName property of an EntityDataSource control in C# from wizard or designer RRS feed

  • Question

  • I am trying to configure an EntityDataSource control in a C# application. After creating the Entity Data Model, I start the Configure Data Source wizard and select a connection, but no default container name is listed. I have tried setting the DefaultContainerName property from the Properties window too, but it's not available from there either. The only way I can enter it is to type it into the asp tag for the control. I am able to set this property from both the wizard and the Properties window in Visual Basic, so it seems odd that it doesn't work in C#. Any suggestions?
    Thursday, May 21, 2009 11:38 PM

Answers

  • Hi AnneMMA,

     

    Based on my test, we need to first set the Named Connection, and then the same connection string will be set to the DefaultContainerName.

     

    Besides, please make sure that when we create the ADO.NET Entity Model, in Entity Data Model Wizard, we have selected the checked box, Save entity connection settings in Web.Config as: “EntityConnectionStringName”.  Then the “EntityConnectionStringName” will be in the Named Connection drop-down list. 

     

     

    Best Regards,
    Lingzhi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Saturday, May 23, 2009 3:19 PM
    Moderator
  • Hi Anne,

     

    I recommend you to reset the Visual Studio settings first and then create a new C# web application to have another try.   For resetting Visual Studio settings, please check the menu Tools à Import and Export settings à Reset all settings.  

     

    Besides, you can also consider deleting the hidden .suo file which is in the same directory of the your project’s solution file.  Because there might be some metadata corruption in the current project.   The .suo file records all of the options that you might associate with your solution so that each time you open it, it includes customizations that you have made.   For detail, please see http://msdn.microsoft.com/en-us/library/xhkhh4zs.aspx. 

     

     

    Best Regards,
    Lingzhi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Wednesday, May 27, 2009 6:49 AM
    Moderator
  • I had exacly the same problem!

    This was caused by i do not click to add App_Code folder to the project, even is still there, so the Model.edmx was placed in the Website Root. After delete and then choose yes to include App_Code folder Model was placed in the App_code and problem was fixed. 

    Regards
    Joao
    Tuesday, September 8, 2009 9:38 PM

All replies

  • Hi AnneMMA,

     

    From this ADO.NET Team blog article, Tutorial: Entity Data Source Control, after creating the ADO.NET Entity Model, we need to build the project to generate the metadata for the model before we can connect the EntityDataSource control to it.   Then in the Configure Data Source wizard, we select the certain entity model connection in both the Named Connection and the DefaultContainerName drop down list.  

     

     

    If you have any further questions, please feel free to let me know.

     

     

    Best Regards,
    Lingzhi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Friday, May 22, 2009 2:06 AM
    Moderator
  • Lingzhi,

    I tried building the project before configuring the EntityDataSource control, but the object context still isn't available from the DefaultContainerName drop-down list. Any other ideas?

    Anne

    Friday, May 22, 2009 4:33 PM
  • Hi AnneMMA,

     

    Based on my test, we need to first set the Named Connection, and then the same connection string will be set to the DefaultContainerName.

     

    Besides, please make sure that when we create the ADO.NET Entity Model, in Entity Data Model Wizard, we have selected the checked box, Save entity connection settings in Web.Config as: “EntityConnectionStringName”.  Then the “EntityConnectionStringName” will be in the Named Connection drop-down list. 

     

     

    Best Regards,
    Lingzhi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Saturday, May 23, 2009 3:19 PM
    Moderator
  • Lingzhi,

    For some reason, this doesn't work on my computer with C#, although it does work with Visual Basic. I tried it on another computer and it works fine, though. Thanks for your help.

    Anne
    Tuesday, May 26, 2009 5:13 PM
  • Hi Anne,

     

    I recommend you to reset the Visual Studio settings first and then create a new C# web application to have another try.   For resetting Visual Studio settings, please check the menu Tools à Import and Export settings à Reset all settings.  

     

    Besides, you can also consider deleting the hidden .suo file which is in the same directory of the your project’s solution file.  Because there might be some metadata corruption in the current project.   The .suo file records all of the options that you might associate with your solution so that each time you open it, it includes customizations that you have made.   For detail, please see http://msdn.microsoft.com/en-us/library/xhkhh4zs.aspx. 

     

     

    Best Regards,
    Lingzhi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Wednesday, May 27, 2009 6:49 AM
    Moderator
  • Hi Anne,

     

    Would you mind letting me know whether my suggestions help you or not?   If you have any questions or concerns, please feel free to let me know.

     

    Have a great day!

     

     

    Best Regards,
    Lingzhi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Monday, June 1, 2009 7:03 AM
    Moderator
  • Hi Anne,

     

    I am closing this thread by marking some helpful replies as the answers, since you have not followed up with the problem.


    If you have any questions or concerns, please feel free to contact me or unmark the answers here. 

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Thursday, June 4, 2009 7:41 AM
    Moderator
  • Lingzhi,

    Sorry. I was out of the office last week. I have tried your suggestions but none of them worked. I can't imagine what could be wrong. As I indicated earlier, though, I was able to configure an Entity data source without any trouble on another computer. Thanks again for your help.

    Anne

    Monday, June 8, 2009 4:46 PM
  • Hi Anne,

     

    Thank you for following up this question.   

     

    First, I recommend you to try these general workarounds when we encounter unexpected Visual Studio IDE issues: http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a#VS_IDE_unexpected_problems. 

     

    If the workarounds do not help,  I suspect that the Visual Studio 2008 SP1 is not installed correctly on your system, or maybe some part of the service pack is not working correctly (Visual Basic works fine, but Visual C# has this specific issue).  You can consider repairing the installation of Visual Studio 2008 SP1. 

     

    Also, here is some steps to retrieve the assemblies loaded by Visual Studio.  With these information, we can know whether Visual Studio has loaded the correct version assemblies.

    1)      Download Process Explorer from this link: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx.

    2)      Start the Process Explorer as Administrator, select the Visual Studio process instance (devenv.exe) in its process list, when the problem occurs.

    3)      Show the dlls that devenv.exe has loaded by pressing Ctrl + D.

    4)      Make sure that the devenv.exe is selected and then press Ctrl + S to save the info to a text file.  

     

    Please send the text file to me (v-micsun@microsoft.online.com remove “online”) if it is convenient for you.   I will check the file to see whether your Visual Studio has loaded all the correct assemblies as soon as I receive your feedback.  

     

     

    My suggestions may be complicated, but please understand that the issue is very specific which only occurs in the C# projects in one computer.   Also, in our internal database, I cannot find similar problems reported.   So, I think the detailed background information is necessary to do further troubleshooting.   Thank you so much!    J

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi   


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Tuesday, June 9, 2009 10:19 AM
    Moderator
  • Hi Anne,

     

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions? 

     

    If you need further assistance, please feel free to let me know.   I will be more than happy to be of assistance.

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Friday, June 12, 2009 12:15 PM
    Moderator
  • Lingzhi,

    Because your suggestions are complicated, I don't have the time to try them now. I will do so at a later date. Thanks for your help.

    Anne
    Friday, June 12, 2009 4:18 PM
  • Hi Anne,

     

    You are welcome.  Please try these troubleshooting steps when it is convenient for you.  If you have any questions when you try the troubleshooting steps, please feel free to let me know.  

     

    Looking forward to your feedback.

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    Monday, June 15, 2009 1:54 AM
    Moderator
  • This used to work for me and I haven't had any problems, but a client of mine has recently reported this problem to me and we tried to figure out what's going on ... with no luck.
    As of Today, the same started to happen on my computer and nothing has changed as far as VS configuration goes - I only edited the model a bit, but I've done the same many times before and haven't had problems with configuration of EntityDataSource before. The model builds, validates, and works if I enter all configuration parameters in the Source view, it's the Designer that's no longer showing the DefaultContainerName, only the Named Connection ...
    The weirdest thing just happened as I was typing this message - I have opened it once again to see the exact name of the failing property ... and now this works just fine, go figure!

    Tuesday, July 14, 2009 6:53 PM
  • I had exacly the same problem!

    This was caused by i do not click to add App_Code folder to the project, even is still there, so the Model.edmx was placed in the Website Root. After delete and then choose yes to include App_Code folder Model was placed in the App_code and problem was fixed. 

    Regards
    Joao
    Tuesday, September 8, 2009 9:38 PM