If I run the following code it throws the following error:
An entity object cannot be referenced by multiple instances of IEntityChangeTracker
public void Save(Category category)
{
using(var db = new NorthwindContext())
{
if(category.CategoryID == 0)
{
...
Hi,
I've got an application where I'm implementing a singleton pattern in the database, and I'm running into huge problems.
I've got the following Table, SingletonTable
+-------------+-------+------------+
| Column Name | Type | Allow Null |
+-------------+-------+------------+
| Id | Int | No |
| VarType |...
I was surprised to find a public letter proposing a vote of no confidence in the entity framework (see http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/)
Would the reasons stated in the letter keep you from using the current version of the entity framework? Would you rather wait for v4.0? Or rather use anothe...
Is there a way to delete an entity by its EntityKey witout loading it?
...
Hi, I'm trying to learn how to use the Entity framework but I've hit an issue I can't solve.
What I'm doing is that I'm walking through a list of Movies that I have and inserts each one into a simple database.
This is the code I'm using
private void AddMovies(DirectoryInfo dir)
{
MovieEntities db = new MovieEntities();
foreach ...
I have a relational model with an associative table. But in addition to the related keys, this table also has a flag. I would like to define two associations: one where the flag is true and another where it is false. The EF designer can add a condition to an entity, but not to an association.
The associative table looks like this:
User...
My data model contains two tables with composite primary keys and an associative table. Part of the composite primary key is common between the tables.
SitePrivilege
-------------
SiteId
PrivilegeId
UserSite
--------
SiteId
UserId
UserSitePrivilege
-----------------
UserId
SiteId
PrivilegeId
I have created a SitePrivilege entity and...
Hello,
We are considering/evaluating EF for a new ASP.NET project.
Please tell if you are using, or have used, EF v1 on a project ?
Please also tell how was your experience with EF in web or desktop application ?
Thank You.
...
Good Morning!
Given:
public class FooClass
{
public void FooMethod()
{
using (var myEntity = new MyEntity)
{
var result = myEntity.MyDomainEntity.Where(myDomainEntity => myDomainEntity.MySpecialID > default(int)).Distinct(new FooComparer);
}
}
}
public class FooComparer : IEqualityComparer<MyEntity.My...
I've got the latest Mysql connector that allows you to use the Visual Studio Entity Framework designer. It's been working great, but I just added a stored proc.
The Server Explorer loaded it up fine with the parameters specified, but then I added it to the Entity Model & the code it generates doesn't have any input parameters.
Here'...
Hi Guys,
I am using unity & entlib for logging and caching in my Azure webapp - I have strange problem in that the web browser takes a very long time to load.
It seems there is a conflict with the web.config file but unsure what to do ? I need to wait 1-2 mins for the start page to display, sometimes it doesn't display at all - clean...
As the result of a form post, I'm trying to save a new Brand record. In my view, Gender is a dropdown, returning an Integer, which is populated from ViewData("gender")
I've setup my link as follows:
gID = CInt(Request.Form("Gender"))
Brand.GenderReference.EntityKey = New EntityKey("DB_ENTITIES.Gender", "Id", gID)
TryUpdateModel(Brand)
...
I have three tables, Professors, ProfessorStudent, Student.
I want all Professors + How many Students each Professor have.
I can do this:
context.ProfessorSet.Include("Student")
context.ProfessorSet.Include("Student").ToList() will read all three tables.
But i dont wanna get Student table, I want that Linq just get "Professor Table...
Hi to all,
For several reasons that I don't have the liberty to talk about, we are defining a view on our Sql Server 2005 database like so:
CREATE VIEW [dbo].[MeterProvingStatisticsPoint]
AS
SELECT
CAST(0 AS BIGINT) AS 'RowNumber',
CAST(0 AS BIGINT) AS 'ProverTicketId',
CAST(0 AS INT) AS 'ReportNumber',
GETDATE() AS 'C...
I have the following type of situation:
TABLE Customers (
CustomerID int,
etc... )
TABLE Orders (
OrderID int,
CustomerID int,
Active bit,
etc... )
I am using this in an ASP.NET MVC web application using Linq-to-Entities. I want to select all Customers and populate the Customer.Orders navigational property, a...
When I have entity B inherit from entity A using table-per-type for storage and try to write a Linq query that filters on a property on B, for example
Function(b) b.name="Joe"
I get the error
The specified type member 'name' is
not supported in LINQ to Entities.
Only initializers, entity members, and
entity navigation proper...
I keep getting an exception about Linq to Entities not supporting certaion query expressions like this:
MyDataContext db = new MyDataContext()
Brand = db.Brands.First(b => b.BrandId == Int32.Parse(brandIdString))
I'm not attempting to pass along the string parsing on to the entity store, I just want to parse that string into an integ...
Hi,
I've got a project in written in the EDM. Does anyone know how to get the value of the discriminator column from an entity in a TPH inheritance tree? I can't add the property to the entity. Is there any other way to get the value?
Thanks,
Roy
...
Error 3007: Problem in Mapping Fragments starting at lines 186, 205: Non-Primary-Key column(s) [WheelID] are being mapped in both fragments to different conceptual side properties - data inconsistency is possible because the corresponding conceptual side properties can be independently modified.
I found several p...
I have what I thought was a very simple piece of code, but the results are baffling me. I'm querying entities using LINQ, and then iterating over the results to create an array. I'm watching the traffic to and from the database, and everything looks good there. When I copy the query that LINQ is sending to SQL and run it directly agai...