Questions tagged [objectcontext]

Core class within Entity Framework. Provides the methods to retrieve, query and manipulate entities within the entity model.

302 questions
0
votes
1 answer

ObjectContext in ViewModel (EF + MVVM)

I'm currently writing my first MVVM application which uses EntityFramework for data access. The Application relies heavly on the underlying database and has to add new Data to the DB in many cases. However, I'm uncertain about whether or not it is a…
0
votes
2 answers

Object out of context

My object eventTypeList goes out of context, even if its in the using. Any advice? error message: The ObjectContext instance has been disposed and can no longer be used for operations that require a connection. public ActionResult…
user2205196
  • 113
  • 1
  • 2
  • 10
0
votes
1 answer

set new entity property to property of existing entity in ObjectContext

I've created a new Entity Object: mplToCreate = this._context.MasterPartsList.CreateOBject(); then, I want to set the parentPnID to an existing item's property that I tried querying for using the following IQueryable…
Rachael
  • 1,965
  • 4
  • 29
  • 55
0
votes
3 answers

Entity Framework Get Entity By Primary Key

Some time ago, I wanted to implement a method that was able to determine whether do an insert or an update on a given entity, so I didn't have to expose "Insert" and "Update" methods, but just a simple "InsertOrUpdate". The part of code that finds…
Matteo Mosca
  • 7,380
  • 4
  • 44
  • 80
0
votes
2 answers

Entity Framework - ObjectContext or DbContext when AuditLog and CreatedOn/ModifiedOn and DB Modeling Team

Which one to choose either ObjectContext or DbContext, when the requirements are, Data Modeling done by Modeler and provides the DEV team a sql script. Due to this we have opted Model First. Is this a correct choice ? Existing denormalized db will…
CGSK
  • 43
  • 8
0
votes
1 answer

Create two entities with the second one depending on the first in entity framework

i have a class library in c# and entity framework that has a payment model. My payment model have one table called Payment, and then another table called PaymentSolid, this last one saves the solid values of the first one like if the first one have…
Phoenix_uy
  • 3,173
  • 9
  • 53
  • 100
0
votes
1 answer

What Provider DLL does the EntityConnection use to create its StoreConnection

I setup an object context like this: public MyObjectContext(....) : this(contextName, new EntityConnection(connectionString)) The connection string is a connection string to an Oracle database. I use DevArt as a provider btw. Everything works fine.…
0
votes
1 answer

ArgumentException when creating instance of object that inherits from ObjectContext

I'm loosely following an excellent series of blog posts by Kazi Manzur Rashid as a learning exercise for learning how to implement some new (for me at least) design patterns, but I'm getting trouble from the start. I've basically copied his code for…
Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402
0
votes
1 answer

Entity framework object context saves new entities that were not added

I have been working with Entity Framework (VS2010 Framework 4.0) in my proyect. I had some trouble with using a different object context per form. What I did then, was to create a object context in the Main Menu Form (stays opened) and everytime I…
Andres
  • 2,729
  • 5
  • 29
  • 60
0
votes
1 answer

ObjectContext from DataSet

I'm trying to compile a linq query. Func> s_compiled = CompiledQuery.Compile
clarity
  • 421
  • 1
  • 8
  • 19
0
votes
0 answers

Losing ability to update after recreating context

I have this design problem. I have a bulk update/insert feature built into my EF generic repository. Two things can happen within that feature: I'm just adding the entity to the context and incrementing a counter or actually committing changes to…
Francis Ducharme
  • 4,848
  • 6
  • 43
  • 81
0
votes
2 answers

Detaching an entity and saving the context on another attempt

I am trying to handle a situation in a bulk insert process where there may be entities with the same primary key, which of course is going to make SaveChanges throw an exception. Here's what I have: try { _context.SaveChanges(); …
Francis Ducharme
  • 4,848
  • 6
  • 43
  • 81
0
votes
0 answers

How can I intercept the retrieve of EF POCO object?

I have some code which encrypts and decrypts data using EF POCO. To implement this I intercepted the Saving Changes and ObjectMaterialized events and it works (most of the time). The issue I have is if I try to read back the encrypted object…
John Kattenhorn
  • 839
  • 11
  • 25
0
votes
1 answer

EntityFramework and ont-to-many CRUD operations

I'm really trying hard to put everything on my project to work with the EF, but it's really getting difficult and sometimes it makes me wonder if it's really the smart move (to rely on EF against coding all the ins and outs of the database). Well,…
Marcelo Myara
  • 2,841
  • 2
  • 27
  • 36
0
votes
1 answer

ObjectContext Error in Dev but Not when Published

Given the classes below, firing up the website in Visual Studio gives me the following error when home/index is called (this is actually the inner exception). A transport-level error has occurred when receiving results from the server. (provider:…
glosrob
  • 6,631
  • 4
  • 43
  • 73