entity-framework

Entity framework, adding custom entity to diagram

Hello I'm using the entity framework that comes with 3.5sp1, and I'm trying to add a custom entity that I will propulate with searchresults from a stored procedure. But I have problems with the designer....... when I pick "Add + Entity" and give it a name, and hit save, the whole diagram stops working...... blah entities namespace could...

Are there any pitfalls to having two different Models from two different assemblies? (EF)

I have two projects, both of them data access layers, and both using EF. I have another project calling services related to the two different assemblies. Are there any pitfalls on using two different models on two different databases linked to the same database? I'm asking this because I've been getting this generic "EntitySqlException"...

Entity Framework - Condition on one to many join (Lambda)

Hi, I have 2 entities: Customer & Account, where a customer can have multiple accounts. On the account, I have a "PlatformTypeId" field, which I need to condition on (multiple values), among other criterions. I'm using Lambda expressions, to build the query. Here's a snippet: var customerQuery = from c in context.CustomerSet.Includ...

Suggestions on documentation of a DB model when using Entity Framework 4

Any experiences on how to document Entity Framework 4 based Database projects? There is the Document and Summary properties on the Entities, but if we want to regenerate the model from the database at some point, it will be lost! Is there some way to map documentation data inside SQL to the Entities in the EDMX file so it is safe. Sug...

IQueryable and lazy loading

I'm having a hard time determining the best way to handle this... With Entity Framework (and L2S), LINQ queries return IQueryable. I have read various opinions on whether the DAL/BLL should return IQueryable, IEnumerable or IList. Assuming we go with IList, then the query is run immediately and that control is not passed on to the nex...

Using Entity Framework with Oracle pseudo-booleans

I am investigating the use of Entity Framework in my organization. We use Oracle DBMS, and therefore (for good or ill) are using the "pseudo-boolean" pattern common in Oracle where instead of having a boolean column (which doesn't exist in Oracle) you have a 1 character column with a check constraint to force it to "Y" or "N". So, if I...

How to prepare data for display on a silverlight chart using WCF RIA Services + Entity Framework

I've used WCF RIA services with Entity Framework to build a simple application which can display and updates data about school courses. This was done by following the Microsoft tutorials. Now I would like to have a chart which shows a count for how many courses are on a key stage. Example: Key Stage 3 - 20 courses Key Stage 4 - 32 co...

Entity Framework Update Entity along with child entities (add/update as necessary)

I have a many-to-many relationship between Issues and Scopes in my EF Context. In ASP.NET MVC, I bring up an Edit form that allows the user to edit a particular Issue. At the bottom of the form, is a list of checkboxes that allow them to select which scopes apply to this issue. When editing an issue, it likely will always have some Sc...

Change notification in EF EntityCollection

Hi everybody! In a Silverlight 4 proj i'm using WCF RIA services, MVVM principles and EF 4. I 'm running into this situation: created an entity called Category and another one called CategoryLocale (automated using VS, no POCO). The relation between them is 1 to N respectively (one Category can have many CategoryLocales), so trough this...

How to query an Entity Framework entities container for objects of derived entity classes?

I have a complex inheritance structure in my data model. A majority of classes in my model (which is designed in VS 2010 with a DB generated by it after) are derived from 3 basic classes. And only these 3 classes can be found among the context members. How do I use all the derived classes at all? ...

How do I use Entity Framework in a CLR stored procedure?

I am looking forward to move all the logic (which is implemented as manipulating Entity Framework 4 objects) to a server side. It looks going to be simple (thanks to the application structure) and beneficial (as all I have is one oldy laptop as a client and one tough server which runs SQL Server 2008, and building a separate service for ...

How do I use an Entity Framework 4 model without a real database?

I don't need any data to be stored. I'd like an application to start, create an Entity Framework entities container based on the model I've designed but having no data records in it, then generate some data (from user input and other input sources), work with it and discard all the data on close, without propagating any data operations m...

Does EntityFramework Support ComplexType Translate<T> or ExecuteStoreQuery<T>?

When i use ObjectContext.Translate(DbDataReader) to materialize my own Entity which use ComplexType as property. I encounter this error: System.InvalidOperationException: Cannot create a value for property '[MyOwnAttribute]' of type '[MyOwnComplexType]'. Only properties with primitive types are supported. Does EntityFramework Support C...

How to make a data-bound combo box display (like a DisplayMember) a concatenated string?

I have a first name and a surname as separate columns in a table. If I bind a combo box to a query and set DisplayMember property to "Name" then each person a table is represented in a combo box by its name. How do I show each person's full name (built from concatenating 2 columns) in a single comb box item in this case? ...

How do I fix "error 1004, 0, Unable to find property" in an Entity Framework 4 WinForms application?

I've designed an EF4 model (quite complex inheritance, lots of small tables incl. multiple self-referencing), generated (table-per-type) a database and inserted some basic data manually. It works fine in an ASP.Net Dynamic Data Entities web application with full automatic scaffolding. But when in a WinForms application using the same m...

What's the best way to share one Entity Framework 4 data model among multiple applications (meant to access one database simultaneously)?

A project (a "solution" to say in VS terms) of mine consists of an ASP.Net 4 Dynamic Data Entities web application, some WinForms applications, some WPF applications, some services. All they are intended to work with one SQL Server database, generated from an Entity Framework 4 model as table-per-type, with lots of inheritance and multip...

Inheritance vs. common (same named and typed) columns?

What model of these is better? A or B? Considering I have more common columns (5 actually for now), many more entities (over 60) and many more relations, while most of tables are just simple dictionaries (enumerated sets of names) and have no own columns. ...

Entity Framework Performance Inconsistency Compared to Sql Management Studio

I'm getting timeouts with a very basic EF statement. I'm simply doing a select from a single table with a Entity.Title.StartsWith("test") and a .Take(25). When I run this for a search that returns no results I get a timeout. If I profile and grab the sql statement it looks fine, and if I run that sql in Management Studio it runs in a ...

How can i discover that object is attached to specific Object Context?

if i have 2 objectContexts for the same model each one hold some objects.. How can i find that object is attached to specific Object Context? ...

Entity Framework 4 missing features?

I'm well aware that similair topics have been brought up before e.g. http://stackoverflow.com/questions/1639043/entity-framework-4-vs-nhibernate But instead of arguments like: NHibernate have been around longer and is more mature EF4 is drag n drop and not enterprisy EF4 and LinqToSql are ... I would like to see a more detailed lis...