Questions tagged [savechanges]

DbContext.SaveChanges method in an Entity Framework method that saves all changes made in a context to the underlying database.

DbContext.SaveChanges method is Entity Framework method that saves all changes made in a context to the underlying database. More info: https://msdn.microsoft.com/en-us/library/system.data.entity.dbcontext.savechanges%28v=vs.113%29.aspx

421 questions
0
votes
1 answer

Overriding SaveChanges() Chicken and Egg

I was wondering if there is a better way to update an entity property from inside of an overridden SaveChanges() method. I am currently using straight SQL. Here is the snippet from SaveChanges() public override SaveChanges(){ …
Slinky
  • 5,662
  • 14
  • 76
  • 130
0
votes
1 answer

Overriding SaveChanges to Implement a Business Rule

I created a working solution, which overrides SaveChanges() but would like to know if there is a better, cleaner way to do this. I really don't like the switch statement. Below, I have described the problem and illustrated my full solution.…
Slinky
  • 5,662
  • 14
  • 76
  • 130
0
votes
1 answer

How to save a int in a android app for when the app is reopen

When my app is running it receives a number(id) that it's used for a notification. I need to save this number for when i reopen the application, the number can be retrieve, and the application doesn't trow a notification of the same id. Any…
BAcevedo
  • 105
  • 3
  • 12
0
votes
2 answers

Save all changes of the application at exit

I have an windows forms app in C# where I can add multiple controls at runtime. What is the best/easiest way to save all the changes after I close my app? Basically if I add two buttons at runtime, after I close the app and open it again, I should…
alex Alex
  • 373
  • 6
  • 25
0
votes
1 answer

Failing to insert new item in database(db.saveCHanges fails)

at the line db.SaveChanges(); of the execution. I get the following error. Note: I am performing an insert. ERROR : Cannot insert duplicate key row in object 'dbo.ProductVariant' with unique index 'ProductVarioant_Barcode'.The statement has been…
Nishant Rambhojun
  • 77
  • 1
  • 2
  • 10
0
votes
3 answers

Android - ListView doesn't retain dynamically added items

I'm making an app which will have a ListView and a Button to add new new items to the ListView. What I want to do is that when the user will click the Button an AlertDialog containing a TextView and two Buttons will popup. The user will enter the…
0
votes
1 answer

Embed a config file at runtime in C++

I'm looking for a way to save the configuration of my program and embed it to the executable file at runtime. By the way, if there is a better way to save the configuration of a program without any external files, then please tell me about it. My…
Tomasz Kasperczyk
  • 1,991
  • 3
  • 22
  • 43
0
votes
1 answer

Entity Framework savechanges() update delete insert

I want my SaveChanges() function to update a record in my database and if the return value is '1' which is coming from my stored procedure then and only then 'delete' command (stored procedure) should not be executed. Now, the problem is…
skzac
  • 126
  • 3
  • 10
0
votes
1 answer

Breeze Entity not getting saved after modified with in fetchEntity method

$.each(vm.ListBox2(), function (index2, value2) { if (vm.ListBox2()[index2].IsNewDxCode == false) { return datacontext.fetchEntity("EpisodeDxM00Rel", vm.ListBox2()[index2].Id).then(function (result) { …
user2585299
  • 873
  • 2
  • 19
  • 41
0
votes
1 answer

Save movieclip location Rotation and x and y

I was hoping you could help me ( I'm pretty new to AS3 ) I bumbling through and making gradual progress. I'm wanting to have it so that when I drag my movie clip x and y across the stage and rotate it, the rotation is saved to the sharedOject. It…
0
votes
1 answer

QML store user settings

I am working on a mobile app using Qt, in which user needs to log in by using Ip, Port, Username and Password values. Each time app is closed those values are lost. I want to be able to store the last login values for the user. I did try to use…
user1031204
  • 701
  • 1
  • 8
  • 30
0
votes
1 answer

Kendo Grid Save Changes

I have a kendo Grid that I make changes to and this saves to database. There is a button on the form that I submit additional information to a different database. I would like to check that the kendo grid has all changes saved when I click this…
mick
  • 139
  • 3
  • 16
0
votes
0 answers

AS3 simple save function in flash for desktop application xml

I'm making a basic drag and drop application in flash. I would like all that is in the current flash screen to be saved into an XML file. (or any other straight forward solution) How should I go about this? I want a simple save function on a mouse…
user3082874
  • 61
  • 2
  • 11
0
votes
2 answers

breezejs cancel saveChanges due to validation failure in BeforeSaveEntity

I created my own ContextProvider, sub classed from EFContextProvider. In BeforeSaveEntity I am running some business logic to validate the transaction. I need the updates to be "all or nothing", so if the 3rd entity in the collection fails the…
mwill
  • 424
  • 7
  • 21
0
votes
3 answers

Save user settings in iPhone/iPad app

In my app I let users to pick a colour of background, tint and text. How can I save this settings after the app is closed? I mean when user again starts the app he wants to see the background, tint and text colour from previous usage. This is how I…
TomasJ
  • 289
  • 8
  • 21