Questions tagged [sqlkata]

SqlKata query builder helps you deal with SQL queries in an elegant and predictable way.

Whether you have an extensive LINQ background or you are an experienced SQL developer, you will feel you are at home with SqlKata, thanks to it's clean and predictable naming.

Written in C#, the language we all love, you can check the source code on SqlKata on Github

86 questions
11
votes
2 answers

Get raw sql string in Sql Kata

I am using SqlKata purely to build sql queries in C#. I am wanting to take the output of my built up Query, get the raw (compiled) sql string, and execute it against SQL. I thought this would do it: var factory = new QueryFactory(null, new…
mwilson
  • 12,295
  • 7
  • 55
  • 95
10
votes
2 answers

How to form multiple Join Conditions sql query in Sqlkata

I am trying to build the Sql Query using by using Sqlkata.I am able to build the correct sql query for one join condition ,but for And Condition i am facing issues var empDeptQuery = new Query("employee"); empDeptQuery.Select("employee.Name",…
HCK
  • 103
  • 1
  • 4
6
votes
1 answer

How to join multiple WHERE clauses together in SqlKata?

I am using SqlKata to creating dynamic SQL queries. I have a list of conditions, stored in my database, which are generated according to my business rules. this is my code sample: var list = new List(); foreach(var rule in rules){ var q =…
Navid_pdp11
  • 3,487
  • 3
  • 37
  • 65
4
votes
1 answer

SqlKata with cancellation token

I have some long-running queries that I'd like to cancel mid execution if the API request is canceled by the browser. I'm using SqlKata to execute my queries and I don't see a param for cancellation tokens. How would I be able to have my query…
Moshe
  • 91
  • 7
4
votes
2 answers

SQLKata Dynamic Where Clause

I am using SQLKata to build a SQL statement in C# and found some code posted on the Github forum but it does not compile. I need help getting it to compile. I am receiving two errors on this line query.Where(q => Compilation error (line 17, col…
Rick S
  • 6,476
  • 5
  • 29
  • 43
4
votes
1 answer

C# SqlKata engine update query doesn't seem to execute

I have a C# function which is designed to perform an update on a SQL Server 2016 table. I'm leveraging the SqlKata engine for this purpose. I'm probably doing something very simple / stupid, I have the feeling I'm constructing the query, but not…
JamesMatson
  • 2,522
  • 2
  • 37
  • 86
3
votes
1 answer

How to add braces to where-query using sqlkata

I have the following concern: I have been dealing with sqlkata for a few hours, but I am not getting anywhere with the following problem: I want to create a select statements with linked where clauses. However, I can't find a way to set braces. My…
Kevin
  • 45
  • 4
3
votes
1 answer

How to ignore a property when doing Insert or Update but not in Get in SqlKata

In MySql database, I have columns "created" and "updated" which are marked with CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP respectively. I never want to manually update these fields, but I do want to read them. SqlKata has Ignore property,…
gajo357
  • 958
  • 12
  • 22
3
votes
0 answers

sqlKata, parameter count mismatch on InsertGetId<>

I am trying to insert a row (working version) _masterDb.Query(table.FullName()).Insert(value.ForDatabase); //raw sql: //INSERT INTO [mst].[TableOne] ([Name], [TableCol]) VALUES ('www', 'ddf') But if I want to fetch Id of last…
harishr
  • 17,807
  • 9
  • 78
  • 125
3
votes
2 answers

SqlKata Transactions

I am looking to use SqlKata for a project. However, part of the project criteria is that queries should be able to be carried out as transactions. Is there a way I can perform a query or multiple queries with MSSQL transactions? Many thanks.
Ben
  • 31
  • 1
  • 3
3
votes
2 answers

Is it possible to query a parametrized table-valued function in sqlkata?

I have a SQL table-valued function like this: CREATE FUNCTION [Foo] (@bar VARCHAR(255)) RETURNS @result TABLE ( [Column1] INT, [Column2] INT, [Column3] INT, [Column4] INT ) .. I'd like to be able to perform queries against it in…
Starnuto di topo
  • 3,215
  • 5
  • 32
  • 66
3
votes
4 answers

Querying into a complex object with sqlkata

I cant built a complex object with a query. How I do? public class Person { public long Id { get; set; } public string Name { get; set; } public Contact Contact { get; set; } } public class Contact { public long Id { get; set; } …
VFB
  • 41
  • 1
  • 4
3
votes
1 answer

is there any way to create query including function in projection and outer apply in sqlkata?

I need some advance feature of SQL inside sqlkata such as outer apply of IIF expression inside the projection. is there any way to create such query inside sqlkata?
Navid_pdp11
  • 3,487
  • 3
  • 37
  • 65
3
votes
1 answer

Execute multiple queries using SqlKata

Is is it possible to execute multiple queries using SqlKata at the same time. Currently I have the following code: var latestUsersQuery = db.Query("tbl_users").Where("created_at", ">", from); var activitiesQuery =…
Dina
  • 41
  • 1
  • 5
2
votes
1 answer

How to page thru sqlkata PaginationResult?

I am using .NET Core and SQLKata to access SQL Server database. I have a method to get all records from the database using SQLKata.Execution.PaginationResult. This is in Repository: public class MyTableRepository : IMyTableRepository { private…
faujong
  • 949
  • 4
  • 24
  • 40
1
2 3 4 5 6