Questions tagged [dbextensions]

DbExtensions is a data-access framework with a strong focus on query composition, granularity and code aesthetics. It supports both POCO and dynamic (untyped) mapping.

DbExtensions' most popular component is SqlBuilder, a class for building dynamic SQL queries which is standalone and can be used with other mappers, such as Entity Framework or Dapper.

For more information visit the project site.

13 questions
2
votes
3 answers

DbExtensions - How to create WHERE clause with OR conditions?

I'm trying to create WHERE clause with OR conditions using DbExtensions. I'm trying to generate SQL statement which looks like SELECT ID, NAME FROM EMPLOYEE WHERE ID = 100 OR NAME = 'TEST' My C# code is var sql = SQL.SELECT("ID, FIRSTNAME") …
mahichR
  • 355
  • 3
  • 14
1
vote
1 answer

How to set connectionstring for DbExtensions/SqlBuilder?

I am using DbExtensions/SqlBuilder.md for my project. And during connection I am getting following Error. A default provider name must be provided using the 'DbExtensions:DefaultProviderName' key in the appSettings configuration section. My…
Urvi
  • 220
  • 1
  • 3
  • 11
1
vote
1 answer

DbExtensions - Add Where clause with multiple OR clauses

New to DbExtensions (just this morning), now i have an SQL statement that looks something like this SELECT * FROM myTable WHERE (Field1 LIKE @Word) OR (Field2 LIKE @Word) OR (Field3 LIKE @Word) OR (Field4 LIKE @Word) OR (Field5 LIKE…
Gillardo
  • 9,518
  • 18
  • 73
  • 141
1
vote
1 answer

Multiple queries with DBExtensions SqlBuilder

When using the SqlBuilder class of DBExtensions, is it possible to build multiple select statements that are executed in a single round trip? Something along the lines of: select t1.* from Table1 t1 where t1.Foo = 'Bar 1'; select t2.* from Table2 t2…
DanP
  • 6,310
  • 4
  • 40
  • 68
1
vote
1 answer

Cannot query using OleDb and DbExtensions

this question is about using https://github.com/maxtoroq/DbExtensions DbConnection connection = Database.CreateConnection("name=myconx"); var query = SQL.SELECT("u.username").FROM("Users u").WHERE("Id={0}", 1); IEnumerable products =…
capadleman
  • 85
  • 6
0
votes
0 answers

Why does shelve module create database with .db extension?

I run the code using the shelve module. I expect to get 3 files as a database: .dir, .dat and .bak. Instead, I have a file with the .db extension. I can't read the created database. I work on the manaconda environment on a apple m1 chip, rdkit…
Alina
  • 1
0
votes
0 answers

How I can add Or instead of And in custom QueryableExtension Npgsql text[]? If its possible?

I need help with queryableExtension for Npgsql string array. I have column in database as type Text[]. This contains multiple values and I want to search in them but not with AND but with OR. I have query extension which work fine, search in whole…
daremachine
  • 2,678
  • 2
  • 23
  • 34
0
votes
0 answers

DbExtensions SqlBuilder raw query does not make sense

I've been trying to use DbExtensions.SqlBuilder and have encountered a strange behaviour similar to the one in this question Basically when I do var query = SQL .SELECT("ID") .FROM("TABLE") .WHERE("Column1 = {0}", 1); Rather than getting…
Kakalokia
  • 3,191
  • 3
  • 24
  • 42
0
votes
2 answers

DbExtensions - WHERE with AND and OR

I would like to build an SQL statement using DbExtensions. I need to build a WHERE clause with AND and OR. Something like this SELECT * FROM myTable WHERE (Field1 LIKE '%a%' OR Field1 LIKE '%b%') AND (Field2 LIKE '%a%' OR Field2 LIKE '%b%') I…
Gillardo
  • 9,518
  • 18
  • 73
  • 141
0
votes
1 answer

DbExtensions - WHERE parameter with byte[] value (timestamp)

I am using this code updateBuilder .UPDATE("myTable") .SET("UpdatedDate = {0}", updated.UpdatedDate) .SET("UpdatedByUserId = {0}", updated.UpdatedByUserId) .WHERE("Id = {0}", updated.Id) .WHERE("RowVersion = {0}",…
Gillardo
  • 9,518
  • 18
  • 73
  • 141
0
votes
1 answer

DbExtensions - Cannot Manipulate SqlBuilder

I have an existing SqlBuilder, which looks like this var query = SQL .WHERE("Field1 = {0}", "bob"); Now i want to pass this sqlBuilder into another function, so it can be manipulated, where by a SELECT, FROM and additional WHERE clauses can be…
Gillardo
  • 9,518
  • 18
  • 73
  • 141
0
votes
2 answers

Get raw sql statement with DbExtensions SqlBuilder

I'm using the SqlBuilder to build a dynamic sql statement where the SELECT and WHERE clauses vary. The query is built like this: SqlBuilder sb = new SqlBuilder(); sb.SELECT("id, name"); sb.FROM("products"); sb.WHERE("name LIKE {0}", new…
Ivan-Mark Debono
  • 15,500
  • 29
  • 132
  • 263
0
votes
1 answer

Maxtoroq / DBExtensions How to map child list?

Using Maxtoroq's DBExtensions how can we map an object having list of elements as child property using just one sql builder? My sample DB structure Employee EmployeeId FirstName LastName Department DeptId …
Halley
  • 1
  • 2