entity-framework

Jira using enterprise architecture by OfBiz

The 'open for business project' is an enterprise framework. It so happens Jira uses this, and I was pretty shocked at how much work is involved to pull data for a particular entity (say a issue/bug in Jira's case). Imagine getting a list of all the issues, it has to first get all the columns (or properties) to display for the table col...

Can I use Entity Framework with ASP.NET Membership?

I'm creating (really, re-creating) an app that has existing user and other data in MS-Access databases. The data will be moved to SQL Server, and part of that involves migrating users. I want to use EF to do ORM, and I am pretty sure I know what the data model will be in SQL Server. I am new to EF but not to ASP.NET, and I'd like to t...

How to get the foreign key in Entity Framework?

Hello, I am developing StudentApp in .NET 3.5 SP1 MVC Application. I have two tables Course CourseID, course_Name Students studentID, student_Name, courseID(fk) Now I made StudentApp.dbml which is having both table as entities. As Foreign key will not be present in student entity, I can not display courseID in student mode...

Data Transfer Objects and Entity Framework

Hi, I am working on a 3-tier web application where I am using the microsoft Entity Framework. To make a loose coupling between the different layers I using data transfer objects to transfer between the Entity Framework objects and my custom objects, but I have a problem with the speed of translating between the entity framework and my cu...

Update entity framework objects

Hi, I transfer data between the entity framework and the business layer and user layer by using Data Transfer Objects. I do have some doubt, if I retrieve an object which is converted to a DTO, how do I update the correct object in the entity framework and not just insert a douplicate? ...

How to keep related entities on object when returned from ASP.NET MVC view

I am working on an ASP.NET MVC RC2 app using Entity Framework. This is my Entity diagram. In my repository I get the entity like this: public Product GetProduct(int id) { return (from c in _entities.ProductSet.Include("User") where c.Id == id select c).FirstOrDefault(); } My view: <%@ Page Title="" Langu...

"Visual studio 2008 SP1" ADO.NET Entity Data Model template not found

Hi! I have installed Visual Studio Team System 2008 Architecture version: 9.0.30729.1 SP and Microsoft Net Framework 3.5 SP1. When I'm going to add a new item I can't find ADO.NET Entity Data Model template. What's happening? Thanks! ...

Best practices for using the Entity Framework with WPF DataBinding

I'm in the process of building my first real WPF application (i.e., the first intended to be used by someone besides me), and I'm still wrapping my head around the best way to do things in WPF. It's a fairly simple data access application using the still-fairly-new Entity Framework, but I haven't been able to find a lot of guidance onli...

Can I use the Entity Framework like I use LINQ to SQL?

I've begun experimenting with LINQ to SQL and what I am doing is basically creating classes with LINQ mapping decorators - thereby choosing which parts of the db table schema I want to incorporate into my classes. A simple example: private DateTime? _LocalCopyTimestamp = (DateTime)SqlDateTime.MinValue; [Column(Name = "recaLocalCopyTime...

How best to filter entities exposed by ado.net data services on top of entity framework?

I want to expose a simple set of blog posts, tags and categories through an API provided by ADO.NET data services. It looks easy in the demos: create your entity data model using the entity framework designer, add in the data service, point it to the entities, done. So far so good. But some posts, tags and categories are unpublished (p...

Business Validation Logic Code Smell

Consider the following code: partial class OurBusinessObject { partial void OnOurPropertyChanged() { if(ValidateOurProperty(this.OurProperty) == false) { this.OurProperty = OurBusinessObject.Default.OurProperty; } } } That is, when the value of OurProperty in OurBusinessObject is changed, if the val...

Entity Framework: How can I enable a one table per class inheritance with a rowversion field?

Why can't I define a member with the same name in subclasses? I have a one table per class inheritance with a rowversion timestamp field in each table. It seems like the Entity designer should allow for this and use the new keyword on the property to make it happen. What is the workaround? How can I specify the same field in an inher...

How to handle "secondary" keys in Entity Framework

I'm evaluating using EF against an existing schema - the problem is that I can't work out how to set up associations between tables where the foreign key is NOT the primary key of the master table. As an example, a "foo" may have many "bars" is defined like this (forgive the pseudocode) table foo { int foo_id pk, char(10) foo_code...

Entity Framework get CurrentContext

I'm extending an entities' partial class to have a method. How do I get a reference to the context that the entity is attached to (if any) to get more entities from the same context. If that's not clear, basically the code I'm looking to write is along these lines (air code): public void AssignSize(int width, int height) { var siz...

Can an ASP.NET MVC View use a Model from a different project?

I've got an ADO.NET Entity Framework class called Node in a WPF project. I want to use it in a different ASP.NET MVC project within the same solution. My Node controller: Public Class NodeController Inherits System.Web.Mvc.Controller Function Display(ByVal id As Guid) As ActionResult Dim db As New WpfApplication1.Mod...

What am I doing wrong to get "Two Entities with different keys are mapped to the same row

See images: EF Designer SQL Tables "Two entities with different keys are mapped to the same row. Ensure these two mapping fragments do not map two groups of entities with overlapping keys to the same group of rows." In fact, only one of the two (or 6 here) entities will have the key for the single row. How may I overcome this? SQL...

EFExtensions With MVC ~ Materializer

I am using EFExtensions with a typed view in mvc and am getting The model item passed into the dictionary is of type 'Microsoft.Data.Extensions.Materializer`1+d__0[MvcCms.Web.Models.User]' but this dictionary requires a model item of type 'MvcCms.Web.Models.ViewData.SiteAdminModel'. 'MvcCms.Web.Models.ViewData.SiteAdminModel' contains...

Learning the Entity Framework

I am interested in learning all about the Entity Framework. I have found these videos. I also have the book Programming Entity Framework, 1st Edition by Julia Lerman. Does anyone have any other recommendations for learning this new technology? ...

Is it ok to rely on a try-catch in a CreateOrUpdate method for the Entity Framework?

Is it acceptable to do this? First try to the add the entity. If the add fails, it doesn't matter because that means the entity already exists? Or is there a more elegant/easy solution? EntityFrameworkEntities dal = EntityDataModelHelper.GetEntityDataModel(); try { dal.AddToXXXXXX(xxxxxxx); } catch { } try { dal.SaveChange...

How do you get changes to an entity to show up in a parent entity set that references the record via a navigation property in an ADO.NET Entity OM?

In an ADO.NET Entity Framework object model, I'm running into some trouble with related tables. (Navigation Properties) My backend datastore is a SQL CE database. When I make changes directly to the related table, these changes don't show up through a higher level table ever after calling SaveChanges. My changes are saved perfectly ba...