All Questions
33,061
questions
0
votes
1
answer
53
views
Good practice for implementing interfaces for 2 databases [closed]
I'm using 2 databases for my project: SQLite and SQL Server.
I have an interface with all the needed methods but should I make 2 separate implementations for those 2 db engines?
One has:
using (...
0
votes
1
answer
62
views
String interpolation inside a formattable string in C#
I am in the process of replacing Dapper with EF Core in a project. Specifically using the new Database.SqlQuery and Database.ExecuteSql functionality with EF Core. I like how they use ...
0
votes
0
answers
28
views
How to map value objects in dapper
i have the following entity
using MedRaise.Domain.Enums;
namespace MedRaise.Domain.Entities;
public class Appointment : Entity
{
private Guid _clinicId;
private DateTime _date;
private ...
2
votes
0
answers
53
views
How to convert this SQL query to NHibernate IQueryable query?
I have to create a query similar to the one below to paginate a parent-child query:
SELECT v.ProductId, MAX(v.Price) AS Price
FROM Variant v
GROUP BY v.ProductId
ORDER BY Price ASC;
I am using C# ...
1
vote
2
answers
104
views
Multiple tables query with repository pattern
I have an ASP.NET Web API project, and have implemented repository and unitOfWork patterns.
I currently have a big SQL query that I want to implement in code, it includes a lot of tables and joins.
My ...
0
votes
0
answers
43
views
How to pass a specific parameter to my dataset
I have DataTable as a result of executing a stored procedure. The stored procedure is returning a number of tables, therefore Tables[0], Tables[1], etc.
I'm trying to query the first table, Tables[0], ...
1
vote
1
answer
55
views
Join tables based on StartsWith function
I have two tables to join. The joining condition is a column that should be like or starts with the other column, not exactly equal. How to do that in Linq? This is my function:
public async Task<...
1
vote
1
answer
90
views
How to properly manage and dispose SqlConnection with SqlCredential in EF Core using Dependency Injection?
I am working on an ASP.NET Core project where I am using SqlCredential for database authentication, provided by a SqlCredentialProvider which is designed as a singleton to ensure a single instance ...
0
votes
0
answers
25
views
Nhibernate get max items
I have a plan table which is having the following structure
id plan_id plan_number
1 1 1
2 1 2
3 1 3
4 2 1
5 2 2
for each plan I would like ...
0
votes
2
answers
93
views
Convert a string to base 64 using T-SQL
I'm having the issue while converting the string to base 64 for encoding using T-SQL. As I use chatgpt to search and some function like
SELECT BASE64_ENCODE (CAST ('hello world' AS varbinary))
SELECT ...
0
votes
1
answer
62
views
Error in Uploading an Image to a localhost SQL server using ASP.NET Core and C#
I want to send image itself to a SQL Server on localhost (send an image from my computer to localhost using ASP.NET Core web service written in C#).
I tried this in my client side:
OpenFileDialog opf =...
0
votes
1
answer
33
views
How to select where in dataGridView C#
I using microsoft visual studio, and i have box number in datagridview as follows
Box Number
4433002
4433006
4433011
I want do some sql query like "SELECT NOTE FROM TABLE WHERE BOX_NUMBER IN ...
0
votes
0
answers
33
views
Entity Framework Core not recognising mapped user-defined function
I'm using Entity Framework Core with .NET 8 and trying to call a user-defined function from C# code.
I'm following the instructions here but have a slightly different use case. Rather than having the ...
0
votes
1
answer
33
views
local sqlite locked after executing SQL query [duplicate]
i am trying to debug a very strange behavior of my application: the problem is that when the code reach the blob.UploadFileAsync i have an exception saying that the file in question is used by another ...
0
votes
2
answers
110
views
Why isn't searching on an indexed column faster than a string comparison?
I was asked for a demonstration of how searching on an indexed column is faster than searching for a string prefix, so I created a quick test but the results were surprising and I can't see why.
The ...