entity-framework

Entity Framework 4 Code Only Error "Multiple objects sets per type are not supported"

I have two "Code Only" POCO's using EF4 and the latest CTP, running against an existing, legacy database. Running a LINQ query against PocoA worked until I added a public virtual PocoB pocoB { get; set; } to PocoA. I was trying to add a relationship. Once I did that, I started getting the following error: Multiple object sets per typ...

Accessing current DomainContext from Entity on client side

I'm extending a partial class that was generated from an Entity Framework domain service (it inherits from System.ServiceModel.DomainServices.Client.Entity). In a property in this class, I want to be able to access a complete entity set from my DomainContext and run a query on it. From within the * : Entity class, is there any good way...

Websites and Database Views

What are the security implications of websites accessing database views instead of using stored procedures? The views in question are only being read from; not written to. Edit The applications in question are ASP.Net MVC 2 using the Entity Framework (v.4). ...

Entity model assembly build on command line

Is there an alternate way of building an entity framework assembly (i.e. with csdl, storage and mapping resouces) at the command line (i.e. csc etc) without the use of msbuild. Our build process and environment is a bit out of date. ...

Can you place a Defining Query (Entity Framework) in external XML?

For example in my Model.edmx file I have: <Schema Namespace="dbModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl"&gt; <EntityContainer Name="dbMode...

Dynamically select a list of properties from an entity.

I have a collection IEnumerable. In a LINQ query, preferably, I would like to select only the properties in this collection from type T, into an anonymous type, where T is a POCO business object. Example: My IEnumerable contains properties "Name", "Age". My POCO is: public class Person { public string Name { get; set; } publ...

How can I provide dynamic filtering on an entity collection?

Good day, I have a class ShipmentsCollection that inherits ObservableCollection which contains shipment objects (entities). This is displayed in a listbox on my ShipmentsView UserControl. My intent is to allow a user to type into a textbox above the list and filter the list with items that contain that string, as well as filter based ...

Entity Framework 4 CTP 4 Code First: how to work with unconventional primary and foreign key names

Is there a way in Entity Framework 4 (using CTP4 and Code First if that matters) to change the conventions used to automatically identify primary and foreign keys? I'm trying to use EF with a legacy database that uses a "pk/fk" prefix rather than an "id" suffix to mark keys. Also, it's not uncommon to have multiple foreign keys to an A...

Entity Framework Many-to-Many Clustered vs. Nonclustered Index

I designed an entity data model with two entities between which there exists a many to many relationship. When I auto-generate SQL code to generate the database for this model, it has generated a table (two columns) to keep track of this many-to-many association. However, this table has a PRIMARY KEY NONCLUSTERED on both columns. Since ...

SQL Caching and Entity Framework

I have put together a small ASP.NET MVC 2 site that does some very extensive date mining/table-joins/etc. Using MVC, I have a controller that returns the data in many different forms (tables, images, etc). To save hitting the database frequently I have a dual cache mechanism: For identical parameters to the same action I use the O...

Reporting Services with Entity Framework

I am using SQL Reporting services to hit a WCF web service. My query is: <Query> <Method Name="GetADTHistory" Namespace="http://tempuri.org/"&gt; <Parameters> <Parameter Name="personId"><DefaultValue>7885323F-DE8D-47E5-907D-2991C838FF3E</DefaultValue></Parameter> </Parameters> </Method> <SoapAction> http://tempuri.org/IRe...

Cant Update row with Decimal DataType in Entity Frameworking using mySql

I have been working on this problem for too long. All of my select and insert commands work fine but when it comes to updating decimal columns i get errors. I am using the following software ASP.Net v4 MySQL Connector Net 6.3.3 MySql Server 5.0.51a Product Class public class Product() { public int ProductID {get;set;} publi...

Binding a combobox to a database and gridview

Hi, I am displaying a database table on a grid view and displaying a selected item's details in a detailsview. Here's the problem: There's a combobox in the detailsview and I want to display the added value's string on grid and I want the combobox to select this value. It will be possible to update, delete the selected item from grid o...

Entity Framework, extending adding "filters"

Hello I have lots of extended "filters" such as this one: public static IQueryable<Customer> ByCustomerID(this IQueryable<Customer> qry, int customerID) { return from c in qry where c.CustomerID == customerID select c; } To GetCustomers() (IQueryable), such as .ByCompanyID() etc etc, and I would like to...

Entity Framework and multithreading

Hi, I have a WCF service that processes some messages. I use EntityFramework to retrieve the messages. I add these messages to a ThreadPool queue and then process them. After processing all the messages, I call an update on the Entity Framework to update the status of the messages. Durng this operation, I randomly get the error - "Enti...

EF 4.0 - mapping to readonly property with private field

Is it possible to map following POCO class with EF 4.0? public class MyClass { private string _myData; public MyClass() { } public MyClass(string myData) { _myData = myData; } public string MyData { get { return _myData; } } } In NHibernate I think it is possible when I use Access attribute ...

Entity Framework - Watch changes happening in the ObjectContextManager while updating data

I just wanted to see the data (which peroperties getting changed) in the ObjectStateManager while I am updating data in my POCO class:- using (POCOObjectContext context = new POCOObjectContext()) { SeeDataInObjectStateManager(context.ObjectStateManager); Contact contactObj = context.Contacts....

Added a field to a table in the database - how to make Entity edmx respond?

I tried rebuilding but it seems that the edmx file doesn't update itself with the changes I made. Any suggestions besides removing the edmx and remaking it? ...

Entity Framework and dependency injection

Hello world! I'm using Entity Framework and the Unity as IoC. I want to use constructor injection within entities with ability to configure them from both config and run-time. I don't want to use the injection via properties. I want to make it the way so I don't need and any handlers in object context that supports injection for my enti...

Using the Entity Framework with multiple identical databases

I have a system where there are two identical databases. One is for back of house work where data is imported, edited generally worked on. Once the data in the first database is as required it is coped to the second database, which is used to drive a public facing (read only) site. So once a month, or so I will need to push data from da...