entity-framework

How to get my SQL DB to match my Domain Driven Design

Okay, I'll be straight with you guys: I'm not sure exactly how Domain Driven my Design is, but I did start by building Model objects and ignoring the persistence layer altogether. Now I'm having difficulty deciding the best way to build my tables in SQL Server to match the models. I'm building a web application in ASP.NET MVC, although ...

ADO.NET Data Services in an ASP.NET-MVC project

I'm trying to add an ADO.NET data service to a vanilla ASP.NET-MVC project. Does anyone know if these technologies are compatible? When I Ctrl+f5 the solution and visit the service URL all I get when is the very unhelpful "Request Error ... See server logs" page. Does the Development Web server even write any logs and if so where? I ...

Visual Studio 2008 SP1 “Package Load Failure” Error

I recently installed VS08 SP1 so that I could use the Entity Framework. However, upon loading projects with edmx files, I get a "Package Load Failure" error that points at "Microsoft.Data.Entity.Design.Package". Unfortunately, googling this turn up only problems dealing with installing SP1 over the Entity Framework CTP, which I have nev...

Performance Comparision of linq 2sql and Ado.net Entity Framework with stored Procedure?

Hi I am devloping the a asp.net site which will have lots of user online at a time. I am writing very efficient stored procedure for it. Which ORM tool should I use? Ado.net entity framework or linq2sql? Performance is needed as our requirement is to load every page in 4 seconds. ...

Entity framework execution

Hi, I am new to the entity framework and wondered, when the data is actually taken from the database. If I e.g. does: from order in orderQuery where order select car; is the data then selected from the database, or is it first when I manipulate it like the code below? (from order in orderQuery where order select car).ToList(); ...

What are the pros/cons of returning POCO objects from a Repository rathen than EF Entities?

Following the way Rob does it, I have the classes that are generated by the Linq to SQL wizard, and then a copy of those classes that are POCOs. In my repositories I return these POCOs rather than the Linq to SQL models: return from c in DataContext.Customer where c.ID == id select new MyPocoModels.Customer { ID = c.ID, ...

Using partial-classes in Entity Framework with custom properties

How should I handle a custom property in a situation where I use partial classes with the EF-generated classes? Here's the setup: TimeSheet Table - this stores an employee's hours - TimeSheetID (auto, int, PK) - EntryDate (DateTime) - Hours (int) - EmployeeID (int) EmployeeHourlyRate table - this stores an employee's current hourly r...

Selecting an entity doesn't subselect associated entities

I'm learning ASP.NET MVC (and MVC in general) and all the help online I find only demonstrates using a single table, not relations between multiple tables. I'm running a query that I expect should also return associated entities, but it's not and can't figure out what I'm missing. I appreciate your help! I have the following data: Ti...

Insert new record in EntityDataSource

Hi, How can i insert new record in EntityDataSource (from gridview) Thanks a lot. ...

Association inheritance with Entity Framework

Consider for instance my following database model. UserTable(Id, Username) TextContentTable(Id, Name, Description, CreatedByUserId, ModifiedByUserId, TextContent) ImageContentTable(Id, Name, Description, CreatedByUserId, ModifiedByUserId, ImageContent) I would like to create the following object model. But is it even possible? For ...

Entity Framework: What negatives can I bump into by not disposing of my object context?

EDIT: Duplicate of Should Entity Framework Context be Put into Using Statement? I've been tossing around this idea for some time wondering what bad could happen by not properly disposing my object context and allowing it to die with the GC. Normally, I would shun this, but there is a valid reason to do it. We are using partial clas...

Is anyone using Entity Framework in production?

I'd like to hear from people who are using EF in production, or made a valid attempt to do so. I saw the When NOT to use the Entity Framework question on this site. I also read Vote of No Confidence. If you played with Entity Framework and decided not to use this, I don't want to hear from you. I understand that EF is not mature as N...

Add a relationship entity in generic/abstract way

Hi, I'm trying to write a WCF method that will receive a detached EntityObject from the client and will be able to tell which properties and which relationships were changed for this entity comparing it with what's already in the context. Of course that if this entity is a new entity or one of its relationships were added/deleted/modifie...

Many-to-many relation insert and delete

Hi I have entities user: id name navigation :group group: id name navigation :user relation: usrgrp iduser idgroup Here I wan't to add data to relation and not the main entities. Please give me example how to delete and insert into usrgrp. Thanks in advance. s. ...

Entity Framework - layered design - Where to put connectionstring?

Hi, I am using a layered architecture with the Entity Framework as my datalayer with a bunch of repositories on top which contain the Linq-To-Entities queries. The data layer is one project, next to that I have a Services layer and the interface, which is a website. I want my website to be responsible of specifying the connectionstring...

Entity - Linq to Sql Only load a part of the entity

If I use entity framework with linq to sql to query it and I have an object Person but I only need two properties of that object, what's in memory will be load, the entire object ? Example : I got the entity Person with properties : Name, Age, Address, Country, Language ... I only need to use the property Name and Age. So I got no ne...

LINQ or ADO.net Entity Framework - which to learn?

A bit of a clarification: I was browsing Julia Lerman's Oreilly title on Entity framework and I got mighty confused. I have Charlie Calvert's essential LINQ, but from my 10 minute session with Lerman's book, it transpires that LINQ is LINQ to SQL which seems underpowered with its DataContext object etc... Whereas Entity Framework is th...

Bulk-deleting in LINQ to Entities

Is there any way to bulk-delete a bunch of objects matching a given query in LINQ or LINQ-to-Entities? The only references that I can find are outdated, and it seems silly to iterate over and manually delete all objects I wish to remove. ...

Adding a property to an Entity Framework Entity from another table

I'm just starting out with the Entity Framework and ADO.NET Data Services and I've run into an issue that I can't seem to figure out. I have two tables, one that has user information and the other that has a created by field. Within the database, there isn't a foreign key between these tables. The user table contains an arbitrary Id, ...

Should I neccessarily have a PK on the source table to create an ADO.NET Entity Data Model?

I'm trying to "Entitify" some external table (which I don't administer) in order to use it within a MVC application and in principle I'm not being terribly successful with the attempt (VS2008 output): Error List [0 Errors] [0 Warnings] [1 Message] Description The table/view 'DATABASE.dbo.table' does not have a primary key defined and ...