locked
What is the difference between DataSource and Container? RRS feed

  • Question

  • What is the difference between DataSource and Container?

    When trying to build add a Relationship to a table in the same DataSource, LS gives us the message:

    "Cannot add a relationship between 'table1' and 'table2', because they are in the same container.

    Please clarify if there is any difference between the term DataSource and "container". 

    It is our understanding that a relationship cannot be built in LS between tables or views that are in the same DataSource.  Please let us know if this is NOT a correct assumption.

    Many thanks in advance.

    Thursday, January 13, 2011 12:26 AM

Answers

  • Hi Garth,

     

    In this context DataSource and Container are referring to the same thing.  Are 'table1' and 'table2' defined within the same DataSource?  If so what kind of DataSource is it?  Is it an attached DataSource?

    You can define relationships between entities within different DataSources and you can define relationships between entities contained within the "intrinsic" DataSource.  You can not define relationships between entities of a single attached DataSource.  If this is the behavior you want, you must define the relationship within the actual source you are attaching to (eg at the database level).

     

    Hope this helps - Michael

    • Proposed as answer by Ben Hayat Thursday, January 13, 2011 5:18 PM
    • Marked as answer by Garth F Henderson Thursday, January 13, 2011 5:32 PM
    Thursday, January 13, 2011 5:12 PM

All replies

  • Hi Garth,

     

    In this context DataSource and Container are referring to the same thing.  Are 'table1' and 'table2' defined within the same DataSource?  If so what kind of DataSource is it?  Is it an attached DataSource?

    You can define relationships between entities within different DataSources and you can define relationships between entities contained within the "intrinsic" DataSource.  You can not define relationships between entities of a single attached DataSource.  If this is the behavior you want, you must define the relationship within the actual source you are attaching to (eg at the database level).

     

    Hope this helps - Michael

    • Proposed as answer by Ben Hayat Thursday, January 13, 2011 5:18 PM
    • Marked as answer by Garth F Henderson Thursday, January 13, 2011 5:32 PM
    Thursday, January 13, 2011 5:12 PM
  • You can not define relationships between entities of a single attached DataSource.  If this is the behavior you want, you must define the relationship within the actual source you are attaching to (eg at the database level).

     

    Hope this helps - Michael

    That's the answer!!!

    ..Ben


    WPF/Silverlight Insider
    Thursday, January 13, 2011 5:19 PM
  • For an attached data source the relationship is already defined in the data source (external) (by PK and FK) and therefore relationship modification in the IDE  is disabled.

    You may test this by removing the primary keys of customer and orders table in Northwind, get it into LightSwitch. The tables Customers and Orders will appear unrelated in the IDE. Now the relationship can be established (is enabled) using the Add Relationship button. (now enabled).

    However, we end up with the 'Container' problem when we actually try to establish the relationship to duplicate the same relationship that holds in a Northwind database with 'keys' defined. The Wizard(Add New Relationship window)to add relationship may also have other 'problems (bugs)'. In the table where you need to answer the question: "which properties on 'order are shared by the 'customer'? ", the CompanyName also shows up as a possible property to be related. Why?
    mysorian
    Friday, January 14, 2011 7:09 PM