I'm working on a project which is using EntityFramework 4 and I am using the entity objects as my business objects. I ran into an issue recently where I had a context declared in a using statement in a user control. The method the statement was in returned an entity object which got used in another control. So I had to detach the entity ...
I am looking up methods of the System.Data.Objects.DataClasses.StructuralObject in Reflector and I see that there's no implementation for any of the methods.
I understand that some of the methods such as most of the SetValidValue overloads have been marked as reserved for future use, as stated by their documentation.
But even the other...
I am using DTOs and converters in an entity framwork scenario. I want to update an entity. So I put this statement:
databasecontext.Tablename(s).Attach(entityobj);
Whenever it gets here the program ends with this error:
An entity with the same identity already exists in this EntitySet.
I felt i could get around this by saying:databaseco...
Hi all,
I am using this
public IQueryable<Document> GetDocuments()
{
return this.ObjectContext.Documents.Include("Company").Include("PostingStatus").Include("DocumentType").Include("Period");
}
in my domainservice but its not returning anything to the client i am using WCF RIA Services and EF4 and Silverlight.
Doe...
Is it possible in EF4 to change conventions for a whole DbContext rather than on a per entity basis?
Currently when I run EF4 queries I'm getting an error on foreign key relationships
Invalid column name 'Account_Id'.
The table being queried (User) has a column named AccountId which is a foreign key to the related table (Account),...
I saw this code work with LINQ to SQL but when I use Entity Framework, it throws this error:
LINQ to Entities does not recognize the method 'System.Linq.IQueryable'1[MyProject.Models.CommunityFeatures] GetCommunityFeatures()' method, and this method cannot be translated into a store expression.
The repository code is this:
public ...
My particular application is an ASP.NET MVC app using Entity Framework.
I have an object Entity0 which contains a reference (* to 1) to Entity1...
public class Entity_0
{
public int ID { get; set; }
public int Entity_1_ID { get; set; }
public Entity_1 Entity_1 { get; set; }
}
I also have some logic in Entity_0, however th...
Hi,
I'm trying to get the following LINQ query to work against the database (3.5 SP1):
var labelIds = new List<int> { 1, 2 };
var customersAggregatedTransactionsByType =
(from transactions in context.TransactionSet
from customers in context.CustomerSet.Where(LinqTools.BuildCont...
Hi everybody im starting to work with Entity Framework 4.0 and ASP.NET 4.0 i'm trying to make a master detail web page and i'm having problems when i try to add new items to a previously recorded items below is the i made for this:
private void guardarOrdenMedicamento()
{
InventarioSIAIplusEntities SIAplusContext = (Inventa...
I've been wading through all the new EF and WCF stuff in .NET 4 for a major project in its early stages, and I think my brain's now officially turned to sludge. It's the first large-scale development work I've done in .NET since the 1.1 days. As usual everything needs to be done yesterday, so I'm playing catch-up.
This is what I need to...
I'm quite a newbie in EF, so I'm sorry if my question has been answered before.. I just can't figure out the syntax..
I have two entities, Category & Product, where one category has many products.
I want to get all categories, with only their latest product (it has a date property named timestamp)
I have no idea how to do that. :-/
I...
I have an asp.net dynamic data website .net 3.5 built on ado.net entity framework with mysql database.
Currently I have just one table in my entity model.
Everything is working fine on my local machine but when i uploaded on my server i got this error message:
"More than one item in the metadata collection match the identity 'mtDBModel...
Hi,
Can someone confirm how to change the auto-generated connection string for an entity framework application so that it is relative?
That is so it will work for anyone who downloads and installs the application. That is, currently the connection string auto-generated for me has an absolute path in it. See below for an example:
<a...
I'm new to EF, and trying to work out the best way to do something
I have a procedure that returns the details of a table, but also a calculated value. What I'd like is for it to return this information to an entity that could contain this, whether it's the original entity, or an entity that's based on the original (so that if the origi...
I'm trying to come up with an compiled query using Entity SQL and I'm getting this error on ToList() line:
LINQ to Entities does not recognize the method 'System.Data.Objects.ObjectQuery`1[BLL.Company] OrderBy(System.String, System.Data.Objects.ObjectParameter[])' method, and this method cannot be translated into a store expression.
He...
Im not used to work with SQL and I hardly know any DDL-scripting at all. Im using ADO.NET Entity Framework 4 in Visual Studio 2010 with EDMX-designer and a Self-Tracking Entity Generator. It does the hard work for me and I get a DDL-script to be used to create the database when it doesnt exist. So far so good...
Then I make a change in m...
Hi all,
I'm currently building an application using entity framework. Normally I would use a stored procedure to get specific data from my database but now i'm experimenting with Entity Framework.
Now i'm facing a small challenge. I have an incident log table with a primary key, an incident id, and some data fields. I need to get all ...
Hi,
I'm trying to map my entities using Entity Framework "code first", but I have a problem with mapping a complex type. Here my simplified exampled:
Domain object looks like:
public class Customer
{
public Address DeliveryAddress {get; set;}
}
public class Address
{
public string StreetName {get; set;}
public string Stre...
EDIT: this happen only on larger scale projects with repositories. Is there anybody using EF4 with code first approach and using repositories? please advice me
Hi. Im currently working with EF4 Code First Classes. In my test project I got two classes, Author and Book (author got books). What I'm trying to do is that I HAve a AddBook in ...
Hi,
I am trying to strongly type a query for 3 ef objects using linq to sql. There are one-to-many relationships with product and category. My classes contain navigation properties and look like this.
public partial class Product
{
public int ID {get;set;}
public string Name {get;set;}
public virtual ICollection<Group> NpGroup {get;se...