Support Topics Documentation Slack YouTube Blog

Problem creating DataQueryBuilder in .NET environment

(mike turner) #1

Hi trying to retrieve some data in a .net environment. It is a version 5.x app and I am referencing v5.1.5.0 Backendless SDK for .NET Framework v.4.5

All works as expected if I don’t use a query.

// IEnumerable result = Backendless.Data.Of().Find(); // find all - this is working well.

however if I follow the docs and try and use a query builder like so…

DataQueryBuilder queryBuilder = new DataQueryBuilder.Create();

I get a build error on line above in Visual Studio. BackendlessAPI.Persistence.DataQueryBuilder.Create is a ‘method’ but used like a ‘type’

…rest of code to get the users…
String whereClause = “name LIKE ‘mike’”;
IEnumberable result = Backendless.Data.Of().Find(queryBuilder);

(Anton Govorushkin) #2

Hi @mike-turner

We’ll look into it and will get back to you with results asap. Ticket ID: BKNDLSS-18104


(mike turner) #3

Hi Anton, any update on this? I don’t seem to able to progress past this stage. If I say

DataQueryBuilder queryBuilder = DataQueryBuilder.Create() and not
DataQueryBuilder queryBuilder = new DataQueryBuilder.Create();

this will compile, but I get a null object error at runtime. I think the new keyword should be there in C#

(Vladimir Yalovy) #4

Hi @mike-turner

Not yet. We’ll notify you as soon as the issue is resolved

(Mark Piller) #5

Hi @mike-turner,

The problem is in the following line of code:

Remove the new operator, since the code requires that you use the static Create() method and you should not instantiate DataQueryBuilder.


(mike turner) #6

Hi Mark, I did try that early on as I found that in another thread, but it just leaves me with a null object not instantiated error at runtime when I try and reference queryBuilder? Will have another go…

(Mark Piller) #7

Hi Mike,

Are you saying that the Create() method returns null? I cannot see how that could happen. Please give it a try and let me know what you get.