entity-framework

Asp.net mvc with entity framework problem : creating or updating an address for a contact . Address Fill with Ajax Request.

I have 2 related entities: Contact and Address. There is a relation between each other. 1 Contact with 1 Address. In the create Form, I fill the FirstName and LastName text boxes. I have a field related to the address. In some situations, I perform an AJAX request to fill automatically the Address Info. The problem is: when I click s...

When can i use EF4's 'Include FK Columns in the Model' ?

Hi, i'm a little confused about EF4, and the EF homepage doesn't help me, so... First thing: is EF4 a separate download or is it a part of VS2010? What version of EF is native in VS2010. Reason why i ask is because i create a .Net 3.5 project in VS2010 (.Net 4.0 is not yet on the production server) and when i want to check the checkb...

Entity Framework testing with IRepository - problem with lazy loading

I am refactoring an MVC project to make it testable. Currently the Controller uses the Entity Framework's context objects directly to ask for the required data. I started abstract this and it just doesn't work. Eventually I have an IService and an IRepository abstraction, but to describe the problem let's just look at the IRepository. Ma...

Entity Framework not actually saving changes

I've just started foraying into EF, and I'm trying to get my head around it (Generally easy enough). However for some reason it's not actually saving the results, though it appears to be maybe cacheing the values for a time, and then rolling back to the previous values? using (IAPlayerEntities IAPE = new IAPlayerEntities()) { ...

Use connection string from different project when using Entity Model

I have a application that uses Entity Framework. I have added some custom tables to the application's db and want to map those tables in a different project using EF model and the POCO entity generator template. My separate project needs to be reusable so I will not know the username/password for the connectionstring. How can I use th...

Entity Framework 4, free Oracle provider?

Can i user ODAC or another free provider in EF4? ...

Is there a way to default the namespace in RC version of STE's with an EDMX?

I have a project utilizing EF4 and Self Tracking Entities (STE). In the pre-release version of STE's you could add the "Namespace" value to each EDMX different from the default Namespace of the current project. (Open EDMX, right click: Properties, Set the "Namespace" attribute.) When you set this in the pre-release version and use the...

How to get an Entity Framework class inherit a base class

I have several classes that inherit from an abstract base class that holds some common utility code. I want to move to EF for data access but I'd still like the objects to inherit the common code in the base class. The EF classes already inherit from EntityObject so I can't have them inherit my base class. What's the right way to handle ...

Does EF4 support mapping 1 component from several tables?

At my company we have a database with one table being so big that it was splitted into 3 tables. They all share an ID and the info is NOT normalized so there is info for several entities in the tables, some entities actually have some fields in one table and some fields in the other tables. There is a new project and they want to use nH...

Wpf and EntityFramework

I'm using WPF with entityFramework. I want the EF's generated objects to notify when property changed. Should I enter to the generated code and implement the INotifyPropertyChanged? maybe with partial class ?! what's the best practice when EF is in the picture ? ...

Can 't create extesion method for LINQ to Enitities link DeleteAllOnSubmit() in LINQ to SQL

Since there is no DeleteAllOnSubmit() method for LINQ to Entities. So I myself create it and named for DeleteAllObjecst as following code. public static void DeleleAllObjects(this ObjectSet objectSet, TEntity[] objects) { foreach(var o in objects) { objectSet.DeleteObject(o); } } However the ...

ADO.NET EF Composite primary key - can not update foreign key

I have following entities: In my code i need to update the FKCategoryID in entity BudgetPost but im getting error: FKCategoryID is part of the object's key information Is it any way to update the key in this case or it's not possible? Thanks in advance ...

sort my entity data source

Hi All, I dragged an Entity Data Source on to my asp.net web page and a gridview. How exactly do I sort my gridview by default on a column (and descending order)? I've tried a lot of things with no luck. Thanks, rod. ...

Is Entity Framework Overkill for Web Applications?

Let's say we are developing an E-Commerce Web application for a small to medium sized business. Let's further assume that the business is likely to scale over time. In other words, the product line will typically grow. Up to now I have developed n-tier solutions using ADO.NET and stored procedures with the help of the SqlHelper class. F...

When calling 'SaveChanges' receiving the exception "Cannot insert the value NULL into column 'XXXXX'"

I have an application that creates entities in offline mode then saves them to the database when it is available. Many entities may be created while the application is offline. Here is a basic version of the method: public void SaveEntityToDatabase(Entity entity) { Context.Entities.AddObject(entity); Context.SaveCh...

WCF Rest/Entity Framework - View Not Deserializing as expected

I have a view that returns data like the following: 1 | Abita | NULL | http://www.abita.com/ 2 | Abita | Abbey Ale | http://abita.com/brews/abbey_ale.php I am using WCF REST to get the xml representation of this view, via an entity framework object. When viewing the returned data as xml in a browser, the first row shows data as I expe...

Entity Framework - Creating an Entity that matches Stored Procedure output

In Entity Framework 4, is there any easy way to create an Entity that matches the output of a stored procedure? I'm not talking about creating a complex type (which is easy), but creating an actual entity. The reason I want an entity rather than a complex type is that RIA doesn't seem to auto-generate an interface for complex types. ...

Is there a way to change EntityKey and ExtensionData access to protected when using Linq-to-entities and WCF?

I have been looking at using Linq to entities with WCF for some projects that we are doing. Everything so far has worked out great but there is one thing that I am not so sure about. Linq-to-entities is creating objects which have EntityKey and ExtensionData properties. I am happy about their access in the service but concerned about the...

Which functions does EF 4.0 support?

Sometimes I get an exception like this: "This method cannot be translated into a store expression". Is there any list what EF 4.0 supports and what doesn't? I have just googled, but nothing ;(. ...

Entity Framework Contextual Validation

How would you implement validation for entity framework entities when different validation logic should be applied in certain situations? For example, validate the entity in one way if the user is an admin, otherwise validate in a different way. ...