Exemplo n.º 1
0
 public Task <TripPerson> UpdateAsync(TripPerson value) => DataInvoker.Current.InvokeAsync(this, async() =>
 {
     var __dataArgs = ODataArgs.Create(_mapper);
     return(await _odata.UpdateAsync <TripPerson, Model.Person>(__dataArgs, Check.NotNull(value, nameof(value))).ConfigureAwait(false));
 });
Exemplo n.º 2
0
 public Task DeleteAsync(string?id) => DataInvoker.Current.InvokeAsync(this, async() =>
 {
     var __dataArgs = ODataArgs.Create(_mapper);
     await _odata.DeleteAsync <TripPerson, Model.Person>(__dataArgs, id).ConfigureAwait(false);
 });
Exemplo n.º 3
0
        public void Where_WildcardContains()
        {
            var q = new ODataTest().CreateQuery <Person>(ODataArgs.Create()).WhereWildcard(x => x.Name, "*b*");

            Assert.AreEqual("?$select=Id,Name,Dob,Salary,IsAwesome,RecCode&$filter=((Name ne null) and contains(toupper(Name),'B'))&$top=100", GetODataQuery(q));
        }
Exemplo n.º 4
0
 private IBoundClient <Model.Product> GetByArgs_OnQuery(IBoundClient <Model.Product> q, ProductArgs args, ODataArgs _)
 {
     return(q.FilterWildcard(p => p.Name, args?.Name)
            .FilterWildcard(p => p.Description, args?.Description));
 }
Exemplo n.º 5
0
 public void Where_None()
 {
     Assert.AreEqual("?$select=Id,Name,Dob,Salary,IsAwesome,RecCode&$top=100", new ODataTest().CreateQuery <Person>(ODataArgs.Create()).GetODataQuery());
 }
Exemplo n.º 6
0
        public void Where_StringNotEqual()
        {
            var q = new ODataTest().CreateQuery <Person>(ODataArgs.Create()).Where(x => x.Name != "abc");

            Assert.AreEqual("?$select=Id,Name,Dob,Salary,IsAwesome,RecCode&$filter=(Name ne 'abc')&$top=100", GetODataQuery(q));
        }
Exemplo n.º 7
0
        public void Where_DecimalLessThanEqual()
        {
            var q = new ODataTest().CreateQuery <Person>(ODataArgs.Create()).Where(x => x.Salary <= 99999.99m);

            Assert.AreEqual("?$select=Id,Name,Dob,Salary,IsAwesome,RecCode&$filter=(Salary le 99999.99)&$top=100", GetODataQuery(q));
        }
Exemplo n.º 8
0
        public void Where_GuidEqual()
        {
            var q = new ODataTest().CreateQuery <Person>(ODataArgs.Create()).Where(x => x.RecCode == new Guid("D2798DAB-B288-489E-B2BB-04E594F79088"));

            Assert.AreEqual("?$select=Id,Name,Dob,Salary,IsAwesome,RecCode&$filter=(RecCode eq guid'd2798dab-b288-489e-b2bb-04e594f79088')&$top=100", GetODataQuery(q));
        }
Exemplo n.º 9
0
        public void Where_IntGreaterThan()
        {
            var q = new ODataTest().CreateQuery <Person>(ODataArgs.Create()).Where(x => x.Id > 20);

            Assert.AreEqual("?$select=Id,Name,Dob,Salary,IsAwesome,RecCode&$filter=(Id gt 20)&$top=100", GetODataQuery(q));
        }
Exemplo n.º 10
0
        public void Where_DateTimeGreaterThanEqual()
        {
            var q = new ODataTest().CreateQuery <Person>(ODataArgs.Create()).Where(x => x.Dob >= new DateTime(2000, 01, 01));

            Assert.AreEqual("?$select=Id,Name,Dob,Salary,IsAwesome,RecCode&$filter=(Dob ge 2000-01-01T00:00:00.0000000)&$top=100", GetODataQuery(q));
        }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ODataQueryAggregator"/> class.
 /// </summary>
 /// <param name="args">The <see cref="ODataArgs"/>.</param>
 public ODataQueryAggregator(ODataArgs args)
 {
     _args  = args ?? throw new ArgumentNullException(nameof(args));
     Paging = args.Paging ?? new PagingArgs();
 }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ODataQueryModelVisitor"/> class.
 /// </summary>
 /// <param name="args">The <see cref="ODataArgs"/>.</param>
 public ODataQueryModelVisitor(ODataArgs args)
 {
     _args       = args;
     _aggregator = new ODataQueryAggregator(_args);
 }
Exemplo n.º 13
0
 public Task <Product?> GetAsync(int id) => DataInvoker.Current.InvokeAsync(this, async() =>
 {
     var __dataArgs = ODataArgs.Create(_mapper, "Products");
     return(await _odata.GetAsync <Product, Model.Product>(__dataArgs, id).ConfigureAwait(false));
 });
Exemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ODataQueryExecutor"/> class for an <see cref="ODataBase"/>.
 /// </summary>
 /// <param name="odata">The <see cref="ODataBase"/>.</param>
 /// <param name="queryArgs">The <see cref="ODataArgs"/>.</param>
 public ODataQueryExecutor(ODataBase odata, ODataArgs queryArgs)
 {
     OData     = odata;
     QueryArgs = queryArgs;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ODataQueryExpressionTreeVisitor"/> class.
 /// </summary>
 /// <param name="args">The <see cref="ODataArgs"/>.</param>
 public ODataQueryExpressionTreeVisitor(ODataArgs args)
 {
     _args = args;
 }