locked
Using more than one Domain Data Source Control on a page RRS feed

  • Question

  • User334174592 posted

    Whenever I try to use more than one Domain Data Source control on a page I get an error:

    An item with the same key has already been added.

    [ArgumentException: An item with the same key has already been added.]
       System.ServiceModel.DomainServices.Server.DefaultDomainServiceFactory.CreateDomainService(Type domainServiceType, DomainServiceContext context) +125
       Microsoft.Web.UI.WebControls.DomainDataSourceView.CreateDomainService(DomainOperationType operationType) +144
       Microsoft.Web.UI.WebControls.DomainDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +336
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
       System.Web.UI.WebControls.GridView.DataBind() +4
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
       System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
       System.Web.UI.Control.EnsureChildControls() +102
       System.Web.UI.Control.PreRenderRecursiveInternal() +42
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Control.PreRenderRecursiveInternal() +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

    Thursday, March 17, 2011 10:05 AM

Answers

  • User443262777 posted

    I understand you can have multiple data contexts but you can't have the same entity defined more than once. Thank you

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 18, 2011 9:15 AM

All replies

  • User443262777 posted

    I understand you can have multiple data contexts but you can't have the same entity defined more than once. Thank you

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 18, 2011 9:15 AM
  • User334174592 posted

    Thank you. You are correct. It appears to be a problem when trying to consume a Domain Data Source created by lightSwitch. After I read your post I tried with a normal project and it works as you describe.

    Friday, March 18, 2011 9:57 AM