Exemple #1
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);
 });
Exemple #2
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));
        }
Exemple #3
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));
 });
Exemple #4
0
 public void Where_None()
 {
     Assert.AreEqual("?$select=Id,Name,Dob,Salary,IsAwesome,RecCode&$top=100", new ODataTest().CreateQuery <Person>(ODataArgs.Create()).GetODataQuery());
 }
Exemple #5
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));
        }
Exemple #6
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));
        }
Exemple #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));
        }
Exemple #8
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));
        }
Exemple #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));
        }
Exemple #10
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));
 });