entity-framework

ORM: why should i use it?

Possible Duplicates: Are there good reasons not to use an ORM? Why should you use an ORM? Hello, i develop since many years in SQL (many different sql servers like Oracle, MSSql, Mysql) and i always been happy in doing that. I've recently seen a lot of stuff around ORMs and i'm asking why should i move toward this world. Can...

EF/LINQ: Where() against a property of a subtype

I have a set of POCOs, all of which implement the following simple interface: interface IIdObject { int Id { get; set; } } A subset of these POCOs implement this additional interface: interface IDeletableObject : IIdObject { bool IsDeleted { get; set; } } I have a repository hierarchy that looks something like this:...

Entity Framework How to specify paramter type in generated SQL (SQLServer 2005) Nvarchar vs Varchar

In entity framework I have an Entity 'Client' that was generated from a database. There is a property called 'Account' it is defined in the storage model as: <Property Name="Account" Type="char" Nullable="false" MaxLength="6" /> And in the Conceptual Model as: <Property Name="Account" Type="String" Nullable="false" /> When sel...

When I generate the DDL from an Entity Framework 4.0 model can I change how it names columns in a many to many relationship?

I have created a very simple Entity Framework 4.0 model using VS2010 Professional. Ignore the Nationality entity which is a simple one-to-many relationship. I have an Entry entity which has a many-to-many relationship with the Team entity because an Entry can have more than one team. This is represented below: This then generates the...

Why does SQL 2008 Profiler indicate that Stored Procedure run from EF4 is in Master?

Using Entity Framework 4 with stored procedures and SQL Server 2008 SP1... When running SQL Server Profiler (TSQL_SPs template), the lines that show my stored procedure call and its statements say that this happened in DatabaseID = 1 (Master) but it is actually happening in my application database. The procedures execute properly and r...

I have a need to give the users the ability to update a dropdown and apply that to their submission

I have an application that I am writing in ASP.NET MVC 2 following the Nerd Dinner tutorial. I am very much a beginner and was looking for examples/tutorials I could follow that would enable me to learn how to code the following scenario: A user has the option to select an option from a dropdown. If the option is not there then they ca...

Default DateTime Parameter in EntityDataSource

I have a ASP.Net DetailsView, bound to an EntityDataSource control. My EntitySet has a DateTime Property that I want to set to a default value of DateTime.Now I don't want to display this property on the DetailsView. I figure I could use an InsertParameter in my EntityDataSource, but don't know the syntax, or whether this is possible: ...

How to implement SQL "in" in Entity framework 4.0

Hello All: How to implement following query of SQL in entity framework. SELECT * FROM Users WHERE UserID in (1,2,3,4). I am trying to do var users = from e in context.Users where e.UserId in (list of user ids) Thanks Ashwani ...

Entity Framework 1:1 Relationship

I have 3 tables which are having 1:1 relationship and i want to insert a Record problem is that out of these 3 tables 1 table is inturn having 1:1 relationship with Another Table so now when i try to insert record in 3 Table, EF is asking me to get the 4th table as well and adding a empty Record in 4th table which i dont want can anybody...

Association Mapping Details confusion?

I have never understood why the associations in EntityFramework look the way they do in the Mapping Details window. When I select the line between 2 tables for an association, for example FK_ApplicationSectionsNodes_FormItems, it shows this: Association Maps to ApplicationSectionNodes FormItems (key symbol) FormItemId:Int32...

Migrating from LINQ to SQL to Entity Framework 4.0 - Tips, Documentation, etc.

I tried out EF back in .NET 3.5 SP1, and I was one of the many who got frustrated and decided to learn LINQ to SQL instead. Now that I know EF is the "chosen" path forward, plus EF 4.0 has some exciting new features, I'd like to migrate my app to EF 4.0. Can anyone suggest any good resources that are specifically targeted towards 4.0 a...

How to stop automatic refresh of a WPF ListBox Databinded on a EntityFramework object

Hi, I have a Xaml Page with a Databinded ListBox and a detail grid to create or update selected element. My Page.DataContext is binded on a ADO.NET Entity Data Model table ("Univers"). private void Page_Loaded(object sender, RoutedEventArgs e) { SEPDC = new Models.SEP(); universViewSource = new CollectionViewS...

master-detail relation in EF4

Hello, I’m using EF4, I have a master-detail relation, the master entity is “Students” and the detail entity is “Grades”, I can reach the detail entity like the following:Students.Grades My problem is: When I get the master- detail entities I need some columns to show in the detail entity “Grades” that are existing in the other entitie...

How do I setup a really simple WCF Data service and entity model that works?

Ok this is going to seem really daft but but essentially this is what i'm trying to do in a nutshell ... http://msdn.microsoft.com/en-us/library/dd465161.aspx The problem is that when I create the WCF Data Service and browse to it everything looks good at the root level and as soon as I leave the root I get http 500 errors. I get no d...

Entity Framework select single value from row

Hi all. I am using Entity Framework from .NET 3.5 I have two tables with 0-1 to many relation. Let's say Citizen and City. Each citizen has foreign key column (ID) that connects him to City. When i select single citizen, i also need to select the name of the city where he lives. Because city table contains tons of data that is not real...

SQL - Dervied Foreign Key - Possible?

I'm just curious if this is possible, specifically in SQL CE (Express) with support in .NET's Entity Framework: Table1 (primary) -nvarchar(2000) url -... Table2 (with foreign key) -nvarchar(2000) domain -... foreign key on Table2.domain references Table1.url such that Table.url contains Table2.domain e.g. Table1: http://www.google....

Entity Framework 4 - Handling very large (1000+ tables) data models?

We've got a database with over 1000+ tables and would like to consider using EF4 for our data access layer, but I'm concerned about the practical realities of using it for such a large data model. I've seen this question and read about the suggested solutions here and here. These may work, but appear to refer to the first version of th...

How to group methods belong to one entity in one class file in Core Data like in Entity Framework?

How to group methods belong to one entity in one class file in Core Data like Entity Framework? In Linq, we can put all methods in the domain object class and reuse them, in Core Data, is there any way to create different classes for different entities? Or we can only use predicate to retrieve? It seems that I can't define the class f...

One repository per table or one per functional section?

I am using ASP.NET MVC 2 and C# with Entity Framework 4.0 to code against a normalised SQL Server database. A part of my database structure contains a table of entries with foreign keys relating to sub-tables containing drivers, cars, engines, chassis etc. I am following the Nerd Dinner tutorial which sets up a repository for dinners wh...

View - ViewModel - Entity Framework 4

I'm looking for a simple way to link a view to a viewmodel and then to Entity Framework through databinding. Can someout out there give me some pointers. What I'm looking for is a very simple implementation that would allow the view to automatically list all the contents of for example a one field table and for changes in the view to b...