Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8228875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:36:39+00:00 2026-06-07T16:36:39+00:00

I’ve been struggling to try and get Data Services to work with the new

  • 0

I’ve been struggling to try and get Data Services to work with the new LightSwitch 2.0 OData Data Source.
Noticing that OData 3.0 is still not supported I had to fall back to 2.0 version.

It happens that my Data Context is nothing but wrapper over some xml serialized object to enable OData access.
This “magic” happens using the Reflection Provider and it works fine regarding all the CRUD operations.

The problems start when I try to use this service in LightSwitch, and realize that all my entity associations are wrong.

The situation I have is exactly the same as if you look at Microsoft’s sample code.

So, using this data model:

[DataServiceKeyAttribute("OrderId")]
public class Order
{
    public int OrderId { get; set; }
    public string Customer { get; set; }
    public IList<Item> Items { get; set; }
}
[DataServiceKeyAttribute("Product")]
public class Item
{
    public string Product { get; set; }
    public int Quantity { get; set; }
}

It’s obvious the “one-to-many” relationship between Order [1 – *] Items.
But looking at the xml metadata of this service, the association is declared as “many-to-many”:

<Association Name="Order_Items">
    <End Type="WEBfactory.StreamInsight.Adapters.Carel.DataServices.Order" Multiplicity="*" Role="Order"/>
    <End Type="WEBfactory.StreamInsight.Adapters.Carel.DataServices.Item" Multiplicity="*" Role="Items"/>
</Association>

Now, this doesn’t really bother much when using a “Service Reference” client, but since LightSwitch doesn’t support “many-to-many” relationships I always get a warning when trying consume this service and the relations are neither imported, nor possible to manually define.

Does anyone have a clue how to work enforce a relationship type using the Reflection Provider?

Thanks!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:36:43+00:00Added an answer on June 7, 2026 at 4:36 pm

    The relationship between Order and Item in this case actually is many:many – if it were 1:many as you propose, an Item could only be in one Order.

    That said, you can create the 1:* relationship by adding a corresponding property to the Item class:

    [DataServiceKeyAttribute("Product")]
    public class Item
    {
        public string Product { get; set; }
        public int Quantity { get; set; }
        public Order Order { get; set; }
    }
    

    That results in the following $metadata, which may or may not cause the same problem:

    <Association Name="Order_Items">
      <End Type="Scratch.Web.Order" Multiplicity="*" Role="Order"/>
      <End Type="Scratch.Web.Item" Multiplicity="*" Role="Items"/>
    </Association>
    <Association Name="Item_Order">
      <End Type="Scratch.Web.Order" Multiplicity="0..1" Role="Order"/>
      <End Type="Scratch.Web.Item" Multiplicity="*" Role="Item"/>
    </Association>
    

    This is likely a limitation of the Reflection provider (I’ll edit this answer if it turns out not to be), so the only workarounds today are to use either the EF provider or a custom provider.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.