Core class within Entity Framework. Provides the methods to retrieve, query and manipulate entities within the entity model.
Questions tagged [objectcontext]
302 questions
0
votes
0 answers
Entity-framework 6.1 querystring and ObjectContext
I am new to Entity-framework and MVC and I am trying to make a Data Access Layer (separate layer). I am using VS 2013, Entity-framework 6.1.3 and MVC5. So far I have created Connection Helper class to connect to the database, but I need a little…

aadi1295
- 982
- 3
- 19
- 47
0
votes
1 answer
where condition in include, how?
The code below is not working. I am getting exception "The Include path expression must refer to a navigation property defined on the type. Use dotted paths for reference navigation properties and the Select operator for collection navigation…

LP13
- 30,567
- 53
- 217
- 400
0
votes
2 answers
Am I using and disposing Entity Framework's Object Context (per request) correctly?
I have a web application where I have just began to use Entity Framework. I read the beginners tutorials, and topics about benefits of object context per request for web apps.
However, I am not sure my context is at the right place...
I found this…

Flash_Back
- 565
- 3
- 8
- 31
0
votes
1 answer
.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 Get(SourceKey sk)
{
var query = from SourceKey in _dataContext.SourceKeys
select SourceKey;
if…

Chris Klepeis
- 9,783
- 16
- 83
- 149
0
votes
0 answers
Database First Entity.Add(EntityObject WithAutoIncrementing Key)
I am using Entity-Framework Database First , I have my ObjectContext.Entity bound to a binding source which in turn is bound to my winforms controls. When I change text on my winforms controls it populates down to Current ObjectContext.Entity - I…

Ken
- 2,518
- 2
- 27
- 35
0
votes
1 answer
How to set a value of a non-mapped parameter of an entity during fetch
I am using Database-First Entity Framework and I have modified Model.tt file a bit for my needs. Now, all of my entities are inherited from the following class:
public class EntityBase
{
public string CreateUser { get; set; }
public string…

user3021830
- 2,784
- 2
- 22
- 43
0
votes
1 answer
Executing SQL query against DataBase for an unknown object in EntityFrameworks
Correct me if I am wrong about EntityFramewroks.
As far as I understand, it is impossible to execute a query against the database when you do not know what results (objects) you are going to get in return because it needs to map the results to the…

Moscobutter
- 1
- 1
0
votes
1 answer
Entity Framework with ASP.NET MVC. Updating entity problem
I'm trying to update an entity and its related entities as well. For instance, I have a class Car with a property Category and I want to change its Category. So, I have the following methods in the Controller:
public ActionResult Edit(int id)
{
…

Kitaly
- 23
- 5
0
votes
2 answers
Use of Undeclared Type 'AVCamViewController'
I'm new to the coding industry and am seriously struggling with Swift. I have a situation where I want to go from one page to another, but I keep getting an error of "use of undeclared type AVCamViewController. This is my code:
@IBAction func…

RPMouton
- 161
- 1
- 1
- 6
0
votes
0 answers
HttpContext to ObectContext Connection helper
I had this below connection helper class in Visual Studio 2010
public class ConnectionHelper : IConnectionHelper
{
public ObjectContext Connection
{
get
{
if (_connection == null &&…

aadi1295
- 982
- 3
- 19
- 47
0
votes
1 answer
ADO.net, Check if ObjectContext is writeable
I have an embedded database in an asp.net mvc project. If I try to write to the file, I sometimes get a write failed exception because the SQL Server can't write to the file. How can I check an ObjectContext, if its writeable, without actually…

user287107
- 9,286
- 1
- 31
- 47
0
votes
1 answer
Cannot Resolve Symbol Error When Calling SavingChanges
All,
I am working from the following MSDN Article Yet I am getting: "Cannot resolve symbol SavingChanges"
The call in question is:
contextProxy.SavingChanges += new EventHandler(context_SavingChanges);
contextProxy is of type: public class…

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
Invalid SQL error on ObjectContext Query() -> Execute()
I am trying to update a table from inside my overridden SaveChanges().
This query:
UPDATE NewClub SET LastActivityDate='5/19/2014 10:17:50 AM' WHERE Id=21
Getting this error
The query syntax is not valid. Near identifier 'NewClub', line 1, column…

Slinky
- 5,662
- 14
- 76
- 130
0
votes
2 answers
Round trip logging in entity framework
I know this is possible in Linq-to-Sql, is it possible to automatically log all queries made through a particular ObjectContext in entity framework? In particular, I'm interested in the number of queries that are run in the lifetime of the…

Paul
- 9,409
- 13
- 64
- 113