Comments (5)
Driver has a method .Expand(...). You can use it like
Products.Expand(product => product.Supplier).ToList();
See also http://www.odata.org/getting-started/basic-tutorial/#expand
from linqpadodata4.
Thanks. Is there a way to force it to use urls of the form
Product(3)/Supplier
rather than
Product?$expand=Supplier
I need this because the relationship is defined in the OData model, but not in the Product CLR type on the server side. My controller does have a GetSupplier method would provide the related supplier.
from linqpadodata4.
Sure,
Products.Where(p => p.ID == 3).Select(p => p.Supplier).Single()
from linqpadodata4.
Thanks. That does use the Product(3)/Supplier URL when the Product class has a property called Supplier. However, in my real application where I am building up the EDM model manually and adding the navigational property manually without having the Supplier property, LinqPad only makes a call to Product(1). Any ideas? Here is the code I am using to build the EDM model relationship.
EdmNavigationPropertyInfo info = new EdmNavigationPropertyInfo();
info.Name = relationshipName;
info.Target = sourceEntityType;
info.TargetMultiplicity = EdmMultiplicity.Many;
EdmNavigationProperty navigation =
sourceEntityType.AddUnidirectionalNavigation(info);
sourceEntitySet.AddNavigationTarget(navigation, targetEntitySet);
from linqpadodata4.
Correct me: Your model has one Product entity set, two entity definitions Product and Supplier and the Product entity has an Supplier property. And there is no Supplier entity set?
from linqpadodata4.
Related Issues (20)
- Option to accept invalid certificates HOT 1
- Would love to have support for client cert auth...
- Support for Environment with Proxy and Windows Authentication HOT 1
- Support for HTTP custom headers similar to OData v3 client driver? HOT 1
- a HOT 1
- ODataLib 7.0.0 HOT 4
- Cannot compile typed context: { expected (line 12)) HOT 1
- Issue when using lprun: NullReferenceException: Object reference not set to an instance of an object HOT 2
- Error when adding WebApi OData service HOT 1
- CustomizedRequestMessage ignores system web proxy HOT 8
- MTLS support
- Allow invalid/untrusted SSL/HTTPS certificate HOT 1
- OData basic authorization HOT 2
- Any plan to publish a new version for linqpad 6 ? HOT 1
- need more setting for http request head HOT 1
- custom headers HOT 6
- Support for Bearer tokens HOT 1
- OData 4 and SSL Connection HOT 1
- Support open types and dynamic properties
- ODATA 8 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linqpadodata4.