savechanges

C#, LINQ batch items - what is the best way to do this?

I have 2 databases - (1) Feeds, (2) Production. The feeds database is fed from client files that we get on a daily basis and is, from my viewpoint, a read only source of data. When a feed file is received the feed app does its thing then finally calls a web service on the production site. This web service then does a sync between the ...

Saving new indicies, triangles and normals after WPF 3D transform

Hi, I have a 3D model which is lying flat currently, I wish for it to be rotated 90 degrees around the X axis. I have no problem doing this with the transforms. But to my knowledge all the transforms are a bunch of matrices multiplied. I would like to have the transform really alter all the coordinates of the indicies of the model. Is t...

Is there a recommended approach to handle saving data in response to within-site navigation without onunload event?

Hello all, Preamble to scope my question: I have a web app (or site, this is an internal LAN site) that uses jQuery and AJAX extensively to dynamically load the content section of the UI in the browser. A user navigates the app using a navigation menu. Clicking an item in the navigation menu makes an AJAX call to php, and php then retu...

Entity Framework : interrupt running SaveChanges

I have a unique ObjectContext, on which I perform a SaveChanges(). This operation takes some time (~60 seconds). This operation is executed in a thread. My user have a "Cancel" button on the screen. I'm able to stop the thread, but if the SaveChanges() has already started I can't find anyway to cancel it. In fact I found no way to acces...

.Net Entity objectcontext thread error

I have an n-layered asp.net application which returns an object from my DAL to the BAL like so: public IEnumerable<SourceKey> Get(SourceKey sk) { var query = from SourceKey in _dataContext.SourceKeys select SourceKey; if (sk.sourceKey1 != null) { query = from SourceKey in query where ...

Many-to-many map - Not detecting changes to collection.

Hi, I have the following map in my entity: <map cascade="all-delete-orphan" inverse="true" name="ManyToMany" mutable="true" table="ManyToManyTable"> <key column="TableAId" /> <index column="EnumValueId" type="MyEnum, MyAssembly" /> <many-to-many column="TableBId" class="MyBClass, MyAssembly"/> </map> This creates the table fine...

Entity Framework - Initial Save is slow

We are implementing a system using EF4 and WPF. We are noticing an issue with the initial saving of data: when the initial SaveChanges is run there is a 4 to 6 second delay when context.SaveChanges() command is run. Every subsequent SaveChanges is very fast with no noticable delay. This is not a major issue - but an annoyance none-the-l...

Entity Framework persistence problem giving "The ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type.."

In the database I have have: PK CountryID int notnull PK ServiceID int notnull PK TaskID int notnull PK TaskItemID int notnull PK CorrespondentID int notnull PK PreviousTask int notnull IsOnTimeline bit not null ..and 5 other nullable fields I am using this composite key to ensure uniqueness of the "ServiceSchedule" item. The "P...

How to save a canvas drawing?

I have this finger-painting app and I want my users may save what they draw and come back later and keep drawing. What's the lighter way to do this? ...

Entity Framework / EF4: Multiple inserts of related entities in a transactionscope

Hi, I have a similar problem. I want to make two inserts in the same transactionscope. The objects are related and have a FK relationship between them, but for several reasons I do not want to connect them via the navigation property, but only by ID. This is a simplification of what I what I want to accomplish: Order o = new Order();...

ObjectContext.SaveChanges() violates primary key, throws UpdateException?

Paraphrasing from this MSDN documentation ... An INSERT statement is generated by the Entity Framework and executed on the data source when SaveChanges is called on the ObjectContext. If the INSERT operation succeeds, server-generated values are written back to the ObjectStateEntry. When AcceptChanges is called auto...

Entity Framework SaveChanges issue

Hello. I am doing some testing with EF and i was trying to get a hook on the ObjectContext.SavingChanges. Everything works when i add objects directly to their set in the context. But when i add them through an Entity nav property they don't show up in the event. I'll show an example to make it more clear. This is the method registered...

EF ObjectContext.SaveChanges is missing

I am working with Entity Framework on a new Project. I've been using EF since a year ago. Today i've tried to generate Entity Data Model with Visual Studio (2008 SP1 and 2010) and it is generating object context properties and entitysets but has not generated SaveChanges method. I've even tried with databases that i've used previosuly to...

Django: form that updates X amount of models

Hello, I have a page where it displays a filtered model instance list and allows users to update some fields of it or add new fields as a form. I am curious what wpuld be a clever way of doing this, to delete and resave all the input data or make comparison for each data and save edited / new fields& entities. I would like to mind you ...

EF4 - Add object to objectcontext without savechanges

Hi. I have a page like Order - Order lines. Order represents by some textboxes and ddls, Order lines represents by GridView. I want to let users add order lines without save changes to database. For example: he adds 4 order lines, fill order info and then hits Save button. Only an that moment all information should be saved to DB. When...