zzz projects Entity Framework 6 EF 6
Home EF Core Articles Knowledge Base Online Examples
  • Home
  • EF Core
  • Articles
  • Knowledge Base
  • Online Examples

Entity Framework 6 - Knowledge Base (KB)

22 results in tag: savechanges

Entity Framework could not be saved. Inherited characteristics

I have implemented some table-per-type inheritance in my data model (basically have a ...BaseEntity... type with all the base information for my items and a ...Employer... type that inherits from the ...BaseEntity... item). Everything appears to be set u...
.net entity-framework inheritance savechanges table-per-type
asked by ChrisHDog

In Entity Framework, how do you rollback a transaction?

string[] usersToAdd = new string[] { "asd", "asdert", "gasdff6" }; using (Entities context = new Entities()) { foreach (string user in usersToAdd) { context.AddToUsers(new User { Name = user }); } try { context.SaveChan...
c# entity-framework rollback savechanges transactions
asked by Shimmy

Changes to a new entity with a two-level connection are not saved by Entity Framework.

I'm building an ASP.NET MVC site using the ADO.NET Entity Framework. I have an entity model that includes these entities, associated by foreign keys:...Report(ID, Date, Heading, Report_Type_ID, etc.)...SubReport(ID, ReportText, etc.) - one-to-one relation...
entity-framework savechanges
asked by Tim Rourke

In Entity Framework, see whether an insert or update was successful.

In ADO.NET, ExecuteNonQuery() "For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command" (...http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery.aspx...)...In EF v1, con...
entity-framework savechanges
asked by dev

When generating 1000s of Entity Framework instances, when should I use SaveChanges()? (For example, during an import)

I am running an import that will have 1000's of records on each run. Just looking for some confirmation on my assumptions:...Which of these makes the most sense:...Run ...SaveChanges()... every ...AddToClassName()... call....Run ...SaveChanges()... every...
entity-framework import loops performance savechanges
asked by John Bubriski

Before storing modifications, EntityFramework displays entities.

Entity Framework ObjectSet with its method ToList shows just saved entities. That means, when I call...context.AddToCustomers(myNewCust); ...and then (without calling SaveChanges)...myDataGrid.DataContext = context.Customers.ToList(); ...the DataGrid does...
c# entity-framework savechanges
asked by Mix Net

Best Practice for EF4/WCF SaveChanges()

This is how we implement a generic Save() service in WCF for our EF entities. A TT does the work for us. Even though we don't have any problems with it, I hate to assume this is the best approach (even if it might be). You guys seem pretty darn bright and...
entity-framework savechanges self-tracking-entities wcf
asked by Jerry Nixon

Exception on SaveChanges in Entity Framework

I have this code saving a simple Entity:...ExecutionEngineEntities db = new ExecutionEngineEntities(); Task task = new Task(); task.Message = "Test"; task.Result = "Test"; task.Name = "Test"; db.Tasks.AddObject(task); db.SaveChanges(); ...This is the exc...
entity-framework savechanges
asked by SexyMF

SaveChanges() in DbContext - Detecting updated entities

I have overridden the SaveChanges() method in the Entity Framework 4.1 DbContext class....My override looks like this:...public override int SaveChanges() { IEnumerable<DbEntityEntry> modifiedEntityEntries = ChangeTracker.Entries().Where( e => e.Stat...
c# dbcontext entity-framework savechanges
asked by FantasticJamieBurns

Can't SaveChanges with Entity Framework in ASP.Net MVC 3 project

Studying asp.net mvc 3 + EF code-first. I am new to both. My example is trivial, but I still can't make it work. Missing something simple and obvious......I've got a class:... public class Product { [HiddenInput(DisplayValue = false)] public int...
asp.net-mvc-3 c# ef-code-first entity-framework savechanges
asked by horgh

Entity Framework 5 Using SaveChanges to add audit log

Seems straight forward override SaveChanges in EF to add an audit logger. See the ApplyAuditLogging method to set the audit properties (created, createdby, updated, updatedby) below.... public override int SaveChanges() { var autoDetectChang...
asp.net-mvc c# entity-framework savechanges
asked by user1538467

SaveChanges has custom atomic UPDATE instructions ()

For various reasons I need to be able to do several custom SQL ...UPDATE... commands when I call ...SaveChanges... on a ...DbContext.... I want this to happen atomically so either both the regular ...SaveChanges... and the SQL succeeds, or neither does...
c# dapper entity-framework savechanges transactions
asked by JulianR

Saving in entity framework

I have read ...this... article and still misunderstanding key moments. Don't we need call..._context.SaveChanges() ...in every Delete/Update/... operations?...If I change property of any entity does ...SaveChanges()... submitted result to database or I mu...
c# entity-framework savechanges
asked by NET

How to get id from entity for Auditlog in Entity Framework 6

I know it's several similar posts out there, but I cannot find any with a solution to this issue....I want to add a (sort of) AudioLog when adding, changing or deleting entities (soft-delete) in Entity Framework 6. I've overridden the SaveChanges and beca...
audit-logging c# entity-framework entity-framework-6 savechanges
asked by baddaydaddy

Entity Framework Db.SaveChanges() not working?

Can u tell me what is the problem?
entity-framework savechanges
asked by PsyGnosis

Calling SaveChanges when database objects have not been changed

I am coding a MVC 5 internet application with EF6 and I have a question about what happens when the context.SaveChanges() method is called....Does the DbContext object store the CRUD actions that occur, such that if the SaveChanges() method is called, and...
asp.net-mvc-5 c# dbcontext entity-framework-6 savechanges
asked by user3736648

Entity Framework 6, Transaction Scope, Context and SaveChanges

Question pertains to transaction scope and ...context.SaveChanges().... If I'm processing a million records with a ...foreach..., and I save after every, let's say, 1000 records by calling ...context.SaveChanges()... inside a transaction scope and somethi...
entity-framework entity-framework-6 savechanges transactionscope
asked by Dee

Invalid ObjectName xxx.dbo.xxx, but it is there

I do not understand, why the following Code does not work:... //Database connection using (var db = new KassenautomatEntities()) { //Create Model var quittung = new WAWI_Quittungen { ...
c# dbcontext entity-framework entity-framework-6 savechanges
asked by Christian Gollhardt

Using TransactionScope with Entity Framework 6

What I can't understand is if its possible to make changes to the context and get the changes in the same transaction before its commited....This is what I´m looking for:...using (var scope = new TransactionScope(TransactionScopeOption.Required)) { ...
c# dbcontext entity-framework-6 savechanges transactionscope
asked by Marcus Höglund

Entity framework 6 ObjectMaterialized event and SaveChanges override

I'm using Model First approach and I have one abstract class MyEntity which have few flags with attribute [NotMapped]. All my entities inherits from MyEntity. Inside the ObjectMaterialized event handler I set those flags to indicate the entity is material...
c# entity-framework-6 savechanges
asked by Steve Li

Page 1 of 2
  • 1
  • 2
  • »

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...

Related

  • EF Extensions Online Benchmark
  • WIN an EF Extensions license
  • EF6 BatchSaveChanges for only $79
Save your entities 20× faster with EF Extensions
SaveChanges vs BulkSaveChanges

EF Extensions
Try for free now
Get monthly updates by subscribing to our newsletter!
SUBSCRIBE!