All Questions
104 questions
0
votes
1
answer
78
views
Should the SqlConnection Be a Class Field or Should I Pass It In and Out Of Functions As Needed?
I am writing a C# Database connection class and I am trying to adhere to best practices and produce clean code.
In the CreateAndOpenDatabaseConnection function ...
0
votes
1
answer
77
views
EF Core code-first "many-to-many-to-many" (Books with many credits with many people)
Let's say you have a book. A book can have an author, an editor, a proof reader, or several other credits. Which credits are available should be dynamic (someone might not want to have the "proof ...
1
vote
1
answer
136
views
Creating database and two tables linked by foreign key
These commands do what I want, but I'm trying to find out the best approach for this. My main areas of concern are: error handling and disposal of resources. In regards to error handling, I'm catching ...
0
votes
1
answer
80
views
Properly implementing HasChanges pattern for model
There is the following method that should get record from the database, apply new data, and if at least one value has been changed, update database and send event
We don't use EntityFramework, it uses ...
1
vote
2
answers
718
views
Database dynamic query
I am working with C#, Npgsql, EF Core and Postgres.
I ...
3
votes
1
answer
86
views
Filtering database with Linq
I'm building an MVC web app with ASP.CORE 3.1 and EF connected to MSSQL.
Today, finally after 3 days, I've somewhat reached a working code for filtering my view.
I've got database of
Date stamps (15 ...
3
votes
0
answers
63
views
SQL database implementation - statement execution
This is another class from my implementation of SQL in C#. It handles the execution of SQL statements, with the core method looking like this:
...
2
votes
1
answer
157
views
Fully buffered stream with atomic commit
This is a class from an implementation of SQL in C# I am writing. It fully buffers all reads and writes, and also logs changes to a log file so that updates are atomic ( all or nothing ). It ...
0
votes
0
answers
84
views
Entity Framework optimization when using transactions
I want to save NUnit local tests in a mysql database hosted in Amazon RDS, and
I'm wrapping up everything in a transaction like so :
...
2
votes
0
answers
59
views
Sharing model for different ORM's
I am building a MySQL to Realmdb converter app.
I use Entity Framework to deal with MySQL, so below is the code of one of my model classes. I don't want to have multiple classes representing the same ...
2
votes
1
answer
2k
views
DataReader to To IEnumerable<object[]> To 2 Dimensional Array
Let me preface this with a few things before I get into my question:
I am making the leap from VBA/VB6 to .NET, (boy is it a big one), so I am noob to .NET best ...
8
votes
2
answers
228
views
Non-Entity framework database interaction model
A C# WPF user interface has been developed for the Book Inventory MySQL database previously shown in this question. Since the database had already been developed this was a database first ...
1
vote
1
answer
161
views
Asynchronous wrapper for database connection
I'm using a database that has a library for access to it. Connection is done synchronously, it's blocking and I do not have a way to abort it. To connect, I have to write:
...
-1
votes
1
answer
132
views
Handling Entity Framework in connected mode within Windows Forms [closed]
I know the difference between the Entity Framework connected mode vs disconnected mode. In connected mode we do all the stuff inside one single DbContext instance. ...
4
votes
0
answers
1k
views
Generic Unit of Work implementation
I am implementing the unit of work pattern to be used in the logic layer of my application. The goal is to abstract away the tasks of managing transactions
/ connections.
My implementation relies ...