This repository was archived by the owner on Feb 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +78
-298
lines changed Expand file tree Collapse file tree 8 files changed +78
-298
lines changed Original file line number Diff line number Diff line change 1- namespace Community . OData . Linq . Demo
1+ namespace Demo
22{
33 using System ;
44 using System . Collections . Generic ;
55 using System . Linq ;
66
7+ using Community . OData . Linq ;
8+
79 public static class ExpandDemo
810 {
911 public static void SelectExpand1 ( )
Original file line number Diff line number Diff line change 1- namespace Community . OData . Linq . Demo
1+ namespace Demo
22{
33 using System ;
44 using System . Linq ;
55
6+ using Community . OData . Linq ;
7+
68 public static class FilterDemo
79 {
810 public static void BySimpleProperties ( )
Original file line number Diff line number Diff line change 1+ namespace Demo
2+ {
3+ using System ;
4+ using System . Linq ;
5+
6+ using Community . OData . Linq ;
7+
8+ public class Entity
9+ {
10+ public int Id { get ; set ; }
11+
12+ public string Name { get ; set ; }
13+ }
14+
15+ public static class GetStartedDemo
16+ {
17+ public static void Demo ( )
18+ {
19+ Entity [ ] items =
20+ {
21+ new Entity { Id = 1 , Name = "n1" } ,
22+ new Entity { Id = 2 , Name = "n2" } ,
23+ new Entity { Id = 3 , Name = "n3" }
24+ } ;
25+ IQueryable < Entity > query = items . AsQueryable ( ) ;
26+
27+ var result = query . OData ( ) . Filter ( "Id eq 1 or Name eq 'n3'" ) . OrderBy ( "Name desc" ) . ToArray ( ) ;
28+
29+ // Id: 3 Name: n3
30+ // Id: 1 Name: n1
31+ foreach ( Entity entity in result )
32+ {
33+ Console . WriteLine ( "Id: {0} Name: {1}" , entity . Id , entity . Name ) ;
34+ }
35+ }
36+ }
37+ }
Original file line number Diff line number Diff line change 1- namespace Community . OData . Linq . Demo
1+ namespace Demo
22{
33 using System ;
44 using System . Linq ;
55
6+ using Community . OData . Linq ;
7+
68 public static class OrderByDemo
79 {
810 public static void BySimpleProperties ( )
Original file line number Diff line number Diff line change 1- namespace Community . OData . Linq . Demo
1+ namespace Demo
22{
3+ using System ;
4+
35 class Program
46 {
57 static void Main ( string [ ] args )
68 {
9+ GetStartedDemo . Demo ( ) ;
10+ Console . WriteLine ( ) ;
11+
712 FilterDemo . BySimpleProperties ( ) ;
813 FilterDemo . ByRelatedEntity ( ) ;
914 OrderByDemo . BySimpleProperties ( ) ;
Original file line number Diff line number Diff line change 1- namespace Community . OData . Linq . Demo
1+ namespace Demo
22{
33 using System . Collections . Generic ;
44 using System . Linq ;
Original file line number Diff line number Diff line change 1- namespace Community . OData . Linq . Demo
1+ namespace Demo
22{
33 using System ;
44 using System . Collections . Generic ;
55 using System . Linq ;
66
7+ using Community . OData . Linq ;
8+
79 public static class SelectDemo
810 {
911 public static void OnlyNameField ( )
You can’t perform that action at this time.
0 commit comments