Questions tagged [savechanges]
DbContext.SaveChanges method in an Entity Framework method that saves all changes made in a context to the underlying database.
417
questions
0
votes
1
answer
31
views
Entity Framework duplicating records when calling SaveChanges
I am using Entity Framework 6:
JObject jCardRecord = JObject.FromObject(record, _ignoreCircularReferenceJsonSerializer);
JObject jProduct = JObject.FromObject(product, ...
0
votes
1
answer
21
views
Updating database using SubmitChanges
I'm trying to update a record in a database through C# code. I found a solution that I think should work using SaveChanges. However, I'm getting an error from my catch statement that says: "An ...
0
votes
0
answers
16
views
EF Core 6 randomly and rarely inserts multiple records
On a simple form, with one textbox not readonly, I am getting multiple records generated which are identical except for the Id and UpdatedDate. I am using Entity Framework Core 6 and Razor Pages. This ...
0
votes
0
answers
20
views
Save salesforce marketing cloud automation via API call
We have created code to pause/activate scheduled salesforce marketing cloud automations but we noticed that those actions doesn't actually being saved within automations. Those actions only change the ...
0
votes
1
answer
24
views
Getting generated value from Identity Column in EF Core 7
I still get zero as response on my Edentity Column after SaveChangesAsync().
Here's my entity
public class Person
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
...
0
votes
0
answers
12
views
MS Access query with "Subdatasheet Expanded" property set to Yes always asks if I want to save changes to the layout when closing
I need to view data with expanded sub-data in a continuous view. I have a query with subdatasheets that does the job, except it keeps asking to save changes to layout.
My query is not in a form. I'm ...
0
votes
1
answer
65
views
setTimeout only on first visit
I want to show my hidden div in 3 secs and after that, it will show even after the refresh, but the problem is when I reload the page I have to wait 3 secs again.
So I want to prevent the setTimeout ...
0
votes
0
answers
39
views
Statement expression in .net issue
I have a context in db that contain 4 property that are belong to output of app,
include goTo1, goTo2, goTo3, goTo4 (as string) and also
weightTo1, weightTo2,weightTo3,weightTo4 (as double).
when send ...
0
votes
1
answer
36
views
Instruct EF6 to delete first, then update
I have a join table representing a many-to-many relationship:
CREATE TABLE [dbo].[CoUndertaker](
[ProposalID] [int] NOT NULL,
[CoUndertakerID] [int] NOT NULL,
[Order] [tinyint] NOT NULL
, ...
1
vote
1
answer
29
views
TableAdapter data has changed but property "has Changes" stays at "false" so udate does nothing
It's mostly in the title...
I'm using VB (obviously, see below), but I'm a total beginner with visual studio.
Here is the test code I'm using (it is a simple test button I designed to test the problem ...
0
votes
0
answers
52
views
Whole project resets to default in Unreal
Pretty much; i open a new premade project in Unreal, i modify simple things, such as : place new objects, create simple blueprint in Level Blueprint (so it affects the level) and then save and close.
...
0
votes
1
answer
218
views
EF Core - Error message when calling SaveChanges(): "The association between entity types has been severed, ..."
I have following data model
public class SportEvent
{
[Key]
public int Id { get; set; }
public int QualifierLeaderboardId { get; set; }
public Leaderboard QualifierLeaderboard { ...
0
votes
0
answers
25
views
Fill elements on save
I'm looking how to make EF core to fill the elements automatically.
I have a DbDirectory Object with a CreatedBy type User.
On the creation I fill the CreatedById.
How to make EF core to fill the ...
0
votes
0
answers
30
views
Randomly the Save menu item greyed out when editing files in VS Code
I encounter the "Save" and "Save As" menu items greyed out randomly and regularly while editing files in VS Code. Been happening for a few years. Most of the time it's while I'm ...
1
vote
1
answer
23
views
Please tell me why I am constantly getting a settings sync fail error message when I open VS code
I made the mistake of following a youtube video to improve setup of VS code, after making the adjustments I always get the settings sync error message. I click on show error file, and highlights the ...
-1
votes
1
answer
320
views
Does CountAsync method in EF Core results to SaveChanges or not?
I have an important question which I couldn't find the answer anywhere!
Suppose we call the Count or CountAsync method in EF or EFCore like this:
public async Task<int> Count()
{
return ...
0
votes
0
answers
50
views
C# ef-core -> what is the end result of calling savechanges for multiple instances with potenial DbUpdateConcurrencyException for one instance?
I have a ef-core + sql application with a model named "indicator". It has a ConcurrencyToken set to property "TimeStampUpdated".
In a long running task I read all indicators that ...
0
votes
1
answer
46
views
VBA Powerpoint how to Macro_BeforeRun?
is it possible to trigger event s.t. that a document is saved before Macro ∀ VBA Module run ?
0
votes
1
answer
238
views
How to recreate Execution Timeout Expired in EF6?
I want to recreate one error scenario from application hosted on Azure.
While updating entities ( while importing some files from excel ) there is an error throwed :
System.Data.SqlClient.SqlException:...
0
votes
1
answer
33
views
EF6 SaveChanges fails claiming field supplied is NULL
I have been using EF for awhile but I am not sure what is missing as I am following a pattern I have used several times in the past. This is the SQL table definition:
Table LogTable
Columns
...
0
votes
1
answer
128
views
Why DbContext Save Only One from List of Item?
I am using AspNetNet 6.
In my Page I have two [BindProperty]:
tblUserToRoute Class (Entity Class)
int[] SelectedRouteIds (Get Selected Item By User)
When client select several item in ListBox and ...
0
votes
1
answer
42
views
Using UnitOfWork design at different endpoints. Can't tracking entity updates when I try to apply savechanges. #.net (UnitOfWork design)
If I use the two service's method at same action like below It is working.
[HttpPost, Route("save_changes")]
public async Task<IActionResult> SaveChangesAsync()
{
...
0
votes
0
answers
18
views
Await within a waited dbcontext, should one use SaveChangesAsync on a context that is waited on using or SaveChanges() is enough
If a dbcontext is waited on using should one still use SaveChangesAsync() or SaveChanges() should be enough?
await using var dbContxt = new dbContxt(con);
public async Task<bool> SaveData(strig ...
0
votes
1
answer
39
views
Failed to update database with SqlCommand and also with DB Entity in C#
I have made a program with a simple SQL Server .mdf database file.
First: I have connected to the database using SqlConnection and tried to insert some data using SqlCommand. The ExecuteNonQuery ...
0
votes
2
answers
218
views
Using EF Core with WPF and I'd like to revert to initial state when a user press Cancel instead of OK on a dialog, is that possible and how?
I'm using EF Core with WPF and I'd like to revert any changes done on any objects to their initial state when a user press Cancel instead of OK on a dialog, is that possible and how?
I'm using a ...
1
vote
0
answers
264
views
SaveChangesAsync not updating navigation property
I have users public virtual ICollection<File> Files navigation property. And im trying to remove file
var user = await _unitOfWork.UserRepository
.GetUserByName(User....
0
votes
0
answers
21
views
How to Save Color with QColordialog in Qt C++
Can someone help with this problem,I am using the QColorDialog in QT c++ ad can't figure out how to save the selected color so it would be the same color after an app is shutdown and then restarted. I ...
1
vote
0
answers
276
views
EFCore: Changing a property during a StateChange event called from SaveChanges and DetectChanges is not updated
I have an EFCore entity that contains an UpdatedTime property that I would like to always have set to DateTimeOffset.UtcNow when the entity's State changes to Modified.
Using sample code found in ...
0
votes
0
answers
396
views
SSIS doesn't save any changes
I have an SSIS project on VS2017 and in it, I have a connections manager. I also have connection strings to files on the server. I am in the middle of the migration process, so I have to replace the ...
0
votes
2
answers
240
views
Save variable in pc python
I want to save a variable (user input fo mail) in pc. Because I don't want it to ask to login again and again. So please help me with how to store email variable in pc and also how to access it. Thank ...
-2
votes
1
answer
240
views
Save a value in HTML after it is changed
I have a problem, I am trying to save a value when it's changed, also this changes for everyone i.e whoever sees it online. So take this site for example: https://scorecount.com/tennis/ when the click ...
0
votes
0
answers
475
views
C# EF Core call multiple SaveChangesAsync in Transactionscope throw timeout exception
im really confused. When im calling multiple times SaveChangesAsync in a transactionscope the second SaveChangesAsync throw a database timeout exception.
I need the transactionsscope because i have ...
0
votes
0
answers
101
views
issue when adding an item to a many to many relationship .net core
i have a course management app and i have an issue when i try to add a student to a course studentsList.
when save changes run the student list changes from a list which contains old elements+ the new ...
0
votes
1
answer
693
views
How To Get Logged In UserID In Repository Pattern IdentityDBContext Class For SaveChanges() Method Overriding?
I am working on the .Net Core 5.0 Web Application and following the repository pattern with the Unit Of Work Pattern for database operations.
I am accessing and working with the Repository Pattern's ...
-1
votes
1
answer
46
views
Entity Framework Core, DB First. Beginner questions about losing data accidentally
I haven't written a single line with EF Core yet but I have been reading tutorials and trying to get a grasp of the concept first. I have not been abl to find any answers to these questions regarding ...
0
votes
1
answer
30
views
EF Core 3.x: copying record does not work as expected
I have the following model:
public partial class Device
{
public string Id { get; set; }
public string IMEI { get; set; }
public virtual DeviceVerizon VerizonData { get; set; }
}
public ...
0
votes
0
answers
91
views
EF 3.x: Change Primary key value
I have the following model:
public partial class Device
{
public string Id { get; set; }
public string IMEI { get; set; }
public virtual DeviceVerizon VerizonData { get; set; }
}
public ...
1
vote
1
answer
504
views
why dbcontext.savechanges() donot clear tracked entites of this dbcontext in efcore
I have an error on update entities use efcore and automapper:
Entity cannot be tracked because another instance is with the same key value
I saw some answers and solved the problem,but I confused why ...
1
vote
1
answer
100
views
Strange SaveChanges behavior in Entity Framework and SQL Server
I have some code, you can check project github, error contains in UploadContoller method GetExtensionId.
Database diagram:
Code (in this controller I sending files to upload):
[HttpPost]
...
-1
votes
1
answer
223
views
How would I save a int value upon exit
I have a cookie clicker like game. How would I make so that my score in my clicker game saves to a file on close. Code for score: int points = 0; Code for exit: this.Close();
2
votes
1
answer
1k
views
Updating/inserting into a table with Always Encrypted columns using EF Core 5
I'm having trouble using Entity Framework Core 5 with the "Always Encrypted" feature in a ASP.NET Core 5 API. I've configured an Azure Key Vault and updated the connection string as ...
0
votes
1
answer
105
views
JavaScript save value of div element
I have a simple text editor and I want to save its content, but it doesn't work because it is not an input element. It is a div element which has contenteditable='true' so I can write inside it. My ...
0
votes
0
answers
32
views
Why does my database not get any data which I insert into it? (using ADO.Net Entity Data Model)
Database properties
Database
The program doesn't throw any errors, but when I check my database's table it is empty.
ProductTable productTable = new ProductTable();
TilerQuoteDataBaseEntities entities ...
1
vote
0
answers
69
views
Thread concurrency when commiting changes Entity Framework
I have three threads consuming a method that Adds an entity in the database with a repository
this is the method that gets used by three consecutive threads:
public async Task SaveAssets(string ...
0
votes
2
answers
109
views
How to insert child data first and then parent data and child inserted identity using Entity Framework Core
I have a requirement where I need to insert data in child table first then its parent and then child inserted record identity into parent table and this is what I am doing while updating the existing ...
0
votes
1
answer
34
views
How to control data repeatation in Laravel?
I have a quiz. The quiz has 10 questions. First time I saved 7 questions of the quiz using the below code.In the second case I wanted to save the quiz questions again. But in this case the data is ...
0
votes
1
answer
91
views
db.SaveChanges() taking long time to save data into DB
So I am using db.SaveChanges() to save 2500 records into DB. It is taking > 1 min to insert all the records. Then I saw a post here recommending bulkinsert from ZEntityFramework but the problem is ...
0
votes
1
answer
243
views
How to clear an optional foreign key in EF Core
I've got an optional 1:1 relationship between two entites. When I set them like so its fine:
entity.Role = roleObject;
I can then run _context.SaveChanges() and it will update in the DB. I can update ...
0
votes
1
answer
566
views
Reset EF DBContext after SaveChanges Rollback DbContextTransaction
I use DbContextTransaction in UOW design pattern with EntityFrameWork 6.1, all is ok except Rollback the DBContext after Rollback of transaction
Which I mean is like below :
DBContext is on initial ...
0
votes
2
answers
165
views
new in python. I want to apply an algorithm to different images from a folder and save the new ones in another folder. Biology research images
I want to inverse colors in a black and white image and then change the background in transparent, with the following codes:
imgg = Image.open('HSPl4_E5_LP8.png')
data = np.array(imgg)
converted = np....