entity-framework-4

Generic Queries with Entity Framework

I have a Entity model that includes a large number of lookup entities. All have just ID and Name properties. I do not want to build large number of DAL classes to simply have something like: IList<Lookup1> lookup1List= ctx.Lookup1.ToList(); and another class (Or method) with IList<Lookup2> lookup2List= ctx.Lookup2.ToList(); and a...

Asp.net MVC 2 How customize my Model in Framework Entity. Issue For multilang app.

Here is a multilang table design. Is it possible to add a method for my CategoryText model to give me the CatName for a specific langID. LangID will be chosen by the customer and set in Session variable. EXAMPLE :I would like to get the category name like this var a = _db.Categories.Single(a=> a.AreaTypeID == 2); string CatName = a....

Avoiding repeated projection code in Entity Framework

I'm trying to solve a problem similar to the one described here http://stackoverflow.com/questions/1440289/initializing-strongly-typed-objects-in-linq-to-entities only from totally the opposite direction. I have a number of functions in my repository, all of which return identically shaped data. The issue is my projection code: selec...

Entity Framwork 4.0 Relationship map table

I have these tables; Customer - CustomerID (primary key) - Name Car - CarID (primary key) - Model Customer_Car_Map (composite primary key CustomerID and CarID) - CustomerID (foreign key to Customer.CustomerID) - CarID (foreign key to Car.CarID) When I generate the models from the database using EF4, it generates classes for all tabl...

Code First Entity Framework 4 : Failing with SQL Authentication

I'm working with Entity Framework 4 and CTP 4 and am really liking it so far. I can get it working correctly when I'm using Windows Authentication to connect to the database but when I switch to SQL Authentication it fails with the message below. I've given the user a sysadmin role and it's default database is master. Error: This...

Is my understanding of POCO's + Entity Framework v4, correct?

Hi folks, can someone please confirm/correct me, with my understanding of using POCO's with the Entity Framework v4? If I'm going to want to use POCO's with my EF4 context, do I still need to place/create ENTITIES on the designer/.edmx ? Isn't the idea of using POCO's so I don't need to use those 'heavy' entities? or do i still need th...

Entity Framework 4 - How To Map Lookup Table To Enum?

Hi Guys, Suppose i have the following 2 SQL tables: Foo Column DataType --------------------------- Title NVARCHAR(20) Body NVARCHAR(MAX) FooTypeId TINYINT FooType Column DataType -------------------------- FooTypeId TINYINT Name NVARCHAR(10) Now, im using Entity Framework 4.0 with...

Why does ObjectContext class not derive from some Interface ?

I consider folks at MS way more smarter than I am. I was trying to build/test a repository which almost follows this approach except that I want to loosely couple the ObjectContext dependency inside the repository. I found out that in order to do decouple this I need to jump a lot of hoops as shown in this article.Even this approach is d...

Entity Framework CTP4 Modeling and mapping question/problem

I have a site where users are allowed to create as many micro-sites with in the main site as they like. A user can also set other users as moderators of their micro-site and users can follow other micro-site. I am not sure what I am doing wrong, (this seemed to work with CTP3), but when I try to do simple stuff like var site = _siteRep...

RIA with Code First EF - Validating a new entity

My problem is that when I add a new entity with a required field, the entity doesn't show the validation error in the UI. I'm using using EF CTP4 Code First. My setup : I have an entity. public class Category { [Key] public int Id { get; set; } [Required] public string Name { get; set; } public string ImageUrl ...

entity framework code only in release not cpt

how i can develop code-only EF application using release version of EF 4.0 not CPT. release version doesn't include ContextBuilder and DbContext . ...

Entity Framework 4 update and insert one function

I'm migrating from SubSonic to EF4. In SubSonic models had a function called Save, if the key of the model was 0 an insert was done, otherwise an update. Is there a way to make a generic Save function like in SubSonic? For exmaple using an extension method? ...

Is there any way I can store more attributes with fields/classes in Entity Framework?

By default Navigation Properties in Entity Frameworks creates properties at both the end of associations, now the problem I am facing is, I want to mark some associations to generate properties at both ends and some to generate only for child of association. Ok I know I can customize the template, but I have no way to store any informati...

Setting Up Model Approach in Entity Framework 4

Hello, I am beginning a new project, so one of the tasks given to us is to determine whether we should create one large Entity Framework 4 model (don't know how many tables yet), or split the model into separate models, one per module within the application. If we create separate models, we'll have repeated entities within each module,...

Entity Framework Video tutorials

Are there any free video tutorials that talk about EF in depth and not just cover the basics? Thanks ...

Entity framework 4 in a 3 layered environment

I came across the following article and was able to setup a functional test application. Pretty straight forward although the comments related to the article gives me second throughts about using this approach. Opinions? http://aspalliance.com/1943_ASPNET_40_and_the_Entity_Framework_4__Part_4__A_3_Layered_Approach_to_the_Entity_Framew...

EF4 CTP4 Get Poco Entity Instead of Proxy Object

I have a proxy entity but I want to save the poco entity to the session ...

DLinq morphed into which one -- Linq to SQL or the Entity Framework?

What happened to Dlinq? I heard a few years ago that it was abandoned. Was some of its code used to create Linq to SQL or the ADO.NET Entity Framework? Which one? In other words, which of the two latter technologies are a new avatar of the old DLinq? I am learning ADO.NET Entity Framework and since I am just starting out, I believe th...

Unit testing entity framework

When unit testing with NHibernate I will typically have tests that create and save an object, clear the session (session.Clear()) then retrieve the object from the database. What's the equivalent of Session.Clear() with EF4? Example test: [Test] public void Can_create_and_save_a_default_account() { var account = ne...

install entity frmaework 4.0

Hi, How to make sure EF 4.0 installed on my machine if .net frameawork 4.0 install. Thanks for help, Jaydeep ...