Dear All,
I am developing ASP.NET application and I have problem with the EF 4.0 model.
The EF model detects the newly added and deleted data, but not the modified data from the database.
Here is an example of the problem what I have.
A- Database:
Script to generate the "Employees" database table
CREATE TABLE [dbo].[Employees]
(
...
I have the following layout in my project (quite simplified):
Assembles
App.WinClient <--- client
App.Service.Api <--- Contains models/businessobjects and service interfaces
App.Service <--- service implementation
Namespaces
I got the following namespace layout in App.Service.Api
App.Users (contains User, IUserService etc)
App....
I am attempting to perform the LoadProperty operation from my context to load a navigation property of a navigation property.
My setup is that I have an EntityA, which contains a list of EntityB's, and each EntityB contains a list of EntityC's. I am doing the following programatically:
public virtual List<T> LoadProperty(List<T> entiti...
I am using EF 4.0 and I need to implement query with one inner join and with N outer joins
I started to implement this using different approaches but get into trouble at some point.
Here is two examples how I started of doing this using ObjectQuery<'T'> and Linq to Entity
1)Using ObjectQuery<'T'> I implement flexible outer join but I ...
I have a database, and I have entity POCO's, and all I want to use EF for is to map between the two and keep track of changes for loading, saving, etc.
I have been reading a lot of the literature (such as it is) on "Code First", and I am unclear on how much of the database information I need to supply when there is not going to be a dat...
I have two objects... and if I compile a program with either one, it works fine, but when they both exist in the same program, I get the exception...
*"Entities in 'ObjectContext.UnitSet' participate in the 'Sheet_Statistics' relationship. 0 related 'Sheet' were found. 1 'Sheet' is expected."*
class Unit
{
public int Id;
public strin...
I'm just starting to learn Entity Framework 4, and am a bit confused about how pivot tables enter the mix. Case in point: I'm migrating a video game review site from PHP 5/Kohana framework to ASP.NET MVC 2. I have a few pivot tables to map the many-to-many relationships I have. Example:
Video games can be available for several platfo...
The Entity Framework 4 is driving me mad, This situation is:
Employee entity - many to many association - Department entity
I get employees from the EmployeeRepository and Departments from the DepartmentRepository. Each repository uses its own data context. My UI has a list of departments (from the DepartmentRepository) to select for ...
How to declare a one to one relationship using Entity Framework 4 Code First (POCO)?
I found this question http://stackoverflow.com/questions/2089395/one-to-one-relationships-in-entity-framework-4-v2-with-poco, but the article that the answer references was not useful (there is one line of code that is a 1-1 relationship, but no mention...
With a model such as ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.ComponentModel.DataAnnotations;
namespace Singleton
{
public class Program
{
public s...
I use EntityFramework POCO + proxies + lazy loading in my project. Today I was pretty surprized to see that the class Transaction has its related collection Rows materialized into HashSet (instead of EntityCollection). I need EntityCollection for tracking changes in the collection.
public class Transaction
{
public virtual ICollecti...
I'm just getting into Entity Framework 4, and was eventually hoping to wrap it in a repository pattern using POCOs. I discovered something that I wasn't expecting though. It appears that if you create a context, add an object to it (without saving the context) and query the context again, it doesn't include the new object in the results....
As I began writing web applications with asp.net I started with small projects that used a Linq-To-SQL mapper for database access to a MSSQL Server.
After gaining some expierence I switched into a classic 3 tier with Graphic Layer, Business Layer, Data Layer. The only function of the Data Layer was to provide methods insert/update/delete...
Entity Framework 4, POCO objects and ASP.Net MVC2. I have a many to many relationship, lets say between BlogPost and Tag entities. This means that in my T4 generated POCO BlogPost class I have:
public virtual ICollection<Tag> Tags {
// getter and setter with the magic FixupCollection
}
private ICollection<Tag> _tags;
I ask for a B...
I have an abstract Content entity in my EF4 model with a concrete subclass, MultipleChoiceItem. There is a related table in the case of MultipleChoiceItem accessed by a Navigation property on the MultipleChoiceItem entity called Options. I would like to eager-load the Options result because if you're getting a MultipleChoiceItem, you alw...
If I have an entity that has an association (e.g. Book.Publisher), how do I save a new Book and associate it with an existing Publisher?
BTW I don't want to expose FK associations (i.e. PublisherId) in my model.
I had been using something like this:
var book = new Book { Title="whatever", Publisher = new Publisher { Id = 42 } };
cont...
I have a project that needs to be upgraded in stages. I need to implement Entity Framework v4 first and then eventually upgrade the Silverlight v3 application to v4.
Unfortunately my client is not able to roll out Silverlight version 4 until for at least four months (they do want to move to v4 but they have to go though a company wide ...
I follow by entity framework example :
http://msdn.microsoft.com/en-us/library/bb399182.aspx
and I have problem with Identity Columns.
Here is part of code of creating database:
CREATE TABLE [dbo].[Person](
[PersonID] [int] IDENTITY(1,1) NOT NULL,
[LastName] [nvarchar](50) NOT NULL,
[FirstName] [nvarchar](50) NOT NULL,
...
Here's the table
Users
UserId
UserName
Password
EmailAddress
and the code..
public void ChangePassword(int userId, string password){
//code to update the password..
}
...
I'm using Entity Framework 4. I'm detaching the object graph using Serialization.
Getting the List, bind to a BindingSource, to the GridControl and deleting adding modify rows. Then go back and Attach the object graph back. How to ensure which rows are for deletion, which are modified, added rows is easy for EF to understand. I'm also th...