entity-framework

Custom property error in linq to entities

Hi, I am using EF4 and I am getting an error with my custom property. I have 2 properties in my Application class, namely Initials and Surname. It is a partial class. I created a custom property in my Application class called Owner, and it looks like this: public partial class Application { public string Owner { get ...

Entity Framework - redundant connection string.

Hello, I'm using Entity Framework in my project. The Framework has created its own connection string, so my web.config connectionStrings section file looks following: <connectionStrings> <add name="ApplicationServices" connectionString="data source=TEST186;user id=vnkuser;pwd=vnkuser;initial catalog=VNK" providerName="System.Data....

Entity Framework 4.0; Is there a limit on the number of objects(tables,views,sprocs) it will handle?

I have a database with many tables, views and sprocs. If I try to create a data model that includes everything, it errors out on the creation of the class file. If I try to create a model with just the views, it works fine. Is there a limit or is there something in a config file somewhere that needs to be tweaked? ...

Is it really necessary to implement a Repository when using Entity Framework?

I'm studying MVC and EF at the moment and I see quite often in the articles on those subjects that controller manipulates data via a Repository object instead of directly using LINQ to Entities. I created a small web application to test some ideas. It declares the following interface as an abstraction of the data storage public interfa...

Entity Framework - add to join with only foreign key values

OK, I have 3 tables, call them: Person PersonID Name Store StoreID Name PersonStore PersonID StoreID Now, I have a form which allows you to add stores to a person. However, I am getting the store ID back from the form. I don't really want to do a query to get the store object from Entity Framework. I just want to add to t...

Returning nested complex types from EF4 using Stored Procedures

Is it possible to return nested complex types from multiple different Stored Procedures using EF? (e.g. ClientSelect, ClientAddressSelect) I have imported a few stored procedures and added function imports and created a Complex Type for each of the return types. (e.g. Client and ClientAddress). Now, for example, I want to add the Clien...

Compiled LinQ query with with expressions in functions

I would like to create a compiled query which uses reusable where predicates. An example to make this clear: ObjectContext.Employees.Where(EmployeePredicates.CustomerPredicate) EmployeePredicates is a static class with a property CustomerPredicate that looks like this: public static Expression<Func<Employee, bool>> CustomerPredicate ...

. The An object with the same key already exists in the ObjectStateManagerObjectStateManager cannot track multiple objects with the same key.

I am trying to simply update the entity object and I get this error.. All the googling on the error I did takes me to complex explanations... can anyone put it simply? I am working of of this simple tutorial http://aspalliance.com/1919_ASPNET_40_and_the_Entity_Framework_4__Part_2_Perform_CRUD_Operations_Using_the_Entity_Framework_4.5 ...

EntityFramework mappings - what is wrong with this mapping?

I'm kind of stuck working out where I'm going wrong with the below entity framework mapping. What I've done is: a) created a Sqlite database (see below, noting Sqlite doesn't allow FK constraints) b) created a blank Entity Data Mode & then created the model from the database c) issue is then trying to add the Model association so it pi...

Can I use custom delegate method in Where method of Entity Framework

Where<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate); I pass parameter to Where method as follows: "f => f.Id > 4". Can i pass a delegate method instead of "f.Id > 4"? ...

Is it mandatory of using 3 tier archeticture while using Entity FrameWork?

Hi everyone!I have a web application where i need to use entity frame work.Actually i came to know that Entity follows 3 layered model.So is it mandatory to use again 3 layered model while using entity?Can any give your valuable idea's and link's regarding this. ...

Organizing large no of tables in Entity Framework

I have a couple of queries with regards to entity framework: My database has over 100 tables including of master, lookup and child tables. One operation of save may save data in 25 different tables. I am trying to figure out the best possible way to organize my entities. Whether I should do table wise or should do it operation wise. Do...

pagination in entity framerowk

What is the best practice for pagination in Entity framework? Should one hit database twice, one to get total record count and second to get the records? Thanks in advance. ...

Entity Framework select from link table with list

Using the following database table structure: Order Table: OrderId OrderName OrderItem Table: OrderId ItemId Item Table: ItemId ItemName I have an 'Order' entity that has an 'Items' collection. What I need to do is return all orders that contain certain items. Example: All orders with items with id: 1, 4 and 5 (I don't care if it ha...

how to 'not' a lambda expression for entity framework

Hi Given the following Expression<Func<T,bool>> matchExpression; How can i create another expression that is a 'not' of the existing one. i have tried Expression<Func<T, bool>> func3 = (i) => !matchExpression.Invoke(i); but this is not supported by the entity framework... Regards ...

Mapping a navigation property to a stored procedure

Hi, I have any application class. Entity framework created a navigation property called Assistants. When I run my web application Assistants is populated for me by the framework. I wrote a stored procedure called GetAssistantsByApplicationID. I need to map this stored procedure to the Assistants property and pass it the application ...

Entity Framework 4 - Sorting by foreign entity

I get "'System.Windows.Data.BindingListCollectionView' view does not support sorting." when I use the following CollectionViewSource: <CollectionViewSource Source="{Binding Path=CourseSessions}" x:Key="cvsCourses"> <CollectionViewSource.SortDescriptions> <ComponentModel:SortDescription PropertyName="StartDate"/> ...

How would I do Subsequent sort on a child table in asp.net mvc2 using Entity Framework

I am trying to do something like this: ViewData.Model = _db.Questions .Include("QType") .Include("QTags") .Include("SubQuestions.Options") .Where(q => q.Active == true) .Orderby(q => Questions.Order) ...

What is the plurality naming "problem" in context of Entity Framework?

What do the people mean when talking of the plurality naming "problem" in context of Entity Framework? ...

EntityDataSource Show Entity Data With It Navigation Properties

Hi i have a entity that cold Users that have a navigation property UsersData that have a field "LastLoginDate" what i want to do is use EntityDataSource to display some information of the users inside a GridView (I don't want to do it from code behind with linq) . I tried to use Include property of EntityDataSource but i don't know how u...