entity-framework

A list of Entity Framework providers for various databases

Which providers are there and your experience using them I would like to know about all possible native .net Framework Entity Framework providers that are out there as well as their limitations compared to the default Linq2Entities (from MS for MS SQL). If there are more for the same database even better. Tell me and I'll be updating th...

How to do server side pre filtering with Entity Framework and Dynamic Data?

I use Entity Framework 4.0 and need to prefilter all queries using TennantId. I modified T4 template to add pre-filter to all ObjectSets like so and it works for "regular" part of the application. public ObjectSet<Category> Categories { get { if ((_Categories == null)) { _Categories = base.CreateObjec...

Running an application from an USB device...

I'm working on a proof-of-concept application, containing a WCF service with console host and client, both on a single USB device. On the same device I will also have the client application which will connect to this service. The service uses the entity framework to connect to the database, which in this POC will just return a list of na...

Is it possible to use Entity Framework with MySQL in the Visual Studio Express Editions?

Since 3rd party integration is not allowed in Visual Studio Express Editions, MySQL doesn't show up as an option for adding a data source to the Database Explorer (or Server Explorer?) in Visual C# 2008 Express Editions. This makes it incredibly confusing to try to configure MySQL to work with Entity Framework when you can't use dialog ...

Mapping from Entity Framework to custom domain model classes?

I wonder how could I obtain an automatic mapping between entities generated by entity framework (.NET Framework 3.5 SP1) and custom domain model classes? I know I can create some data converters that translates the objects back and forth between the two worlds, but how could I accomplish this in an automatic way? I started to develop my...

Trying to save an object with the Entity Framework v4 - how?

Hi folks, I've using Entity Framework v4 (that comes with VS2010 Beta 2) + POCO's. I can load the data from the db into the poco's perfectly. Now, i have a single poco instance, and i don't know how to save it to the DB, using EF4. Can someone help please? I'm guessing it's because the EF4 doesn't know that the POCO has 'changed'? anyw...

Using plain sql queries with Entity Framework

I'd swear I've seen this documented somewhere on MSDN site, but I cannot find it now - I'm searching for EF equivalent of Hibernate named queries - ability to encapsulate database specific sql queries in SSDL and then call them just like mapped stored procedures to get Entity Types in return. [Edit] The rationale behind using it is opti...

How do you best offload a database insert, so a web response is returned quicker?

Setup I have web service that takes its inputs through a REST interface. The REST call does not return any meaningful data, so whatever is passed in to the web service is just recorded in the database and that is it. It is an analytics service which my company is using internally to do some special processing on web requests that are ...

Entity Framework TPH with multiple abstract inheritance

I'm trying to do a Table Per Hierarchy model in Entity Framework(VS 2008 sp1, 3.5). Most of my models have been very simple, an abstract type with multiple sub-types that inherit from it. However, I've been struggling with this latest challenge. I have STUDENTS that I'd like to inherit from PERSONS(abstract) that should inherity from ...

Error compiling pre-generated view in VS 2008.

I am created pre-generated views for my EDMX using VS 2008, .NET 3.5 and Entity framework. I have generated using the t4 templates mentioned here and got my mymodel.views.cs file. It's around 40 mb is size. Added the views.cs file to my web application and my web service. When i build the apps, the webservice would build without any er...

Entity Framework in a n tiered architecture - Best Practices to follow?

I have been reading the MSDN article at http://msdn.microsoft.com/en-us/magazine/cc700340.aspx But was wondering if there are other / alternatives best practices to using the Entity Framework (.net framework 3.5 sp1) in an asp.net , n tiered application. ...

Entity Framework: Creating and inserting many to many relationships

I am new to the Entity Framework and am looking for some direction on creating the relationships between an entity and related many-to-many associative entities and inserting them in one operation. The relevant entities in my EDMX: Participant ID Name ParticipantCustomField ParticipantID CustomFieldID Value CustomField ID Name I n...

Binary Operator Equal is not defined... troubles comparing MemberExpressions in a generic repository

I have a generic SelectAllByKey method in my repository: public IList<E> SelectAllByKey(string columnName, string key) { KeyProperty = columnName; Expression rightExpr = null; rightExpr = Expression.Constant(key); // First we define the parameter that we are going to use the clause. var ...

Mapping stored procedure property in ef

Hi I'm trying the entity framework and in my model i have a customer, customer_address and address tables. I've created stored procedures for crud operations for each table. Mapping the sprocs for customer and address went easy but mapping update sproc for customer_address gives me error. I'm confused how to implement this properly. Her...

Entity Framework 4 + SQL Server CE + Generate database from model

The title sums up my problem. I start from an empty model in VS2010 beta2, and then choose to generate my database from model, i then choose to create a new SQL CE database. Up until that moment everything runs fine. EF generates some SQL and saves it as MyModel.emdx.sql. Here comes the problem, the generated SQL can't be executed on the...

How to convert objects with nested objects

I have an entity that is actually tree object structure (defining only relevant properties within my entity): public class TreeItem { public int Id { get; set; } public TreeItem Parent { get; set; } public List<TreeItem> Children { get; set; } ... } Parent and Children properties are correctly defined as navigatio...

Linq filter collection with EF

Hi, I'm trying to get Entity Framework to select an object and filter its collection at the same time. I have a JobSeries object which has a collection of jobs, what I need to do is select a jobseries by ID and filter all the jobs by SendDate but I can't believe how difficult this simple query is! This is the basic query which works: ...

How can I see the SQL generated by EF db.entityset?

I have something like this in a repository: var results = db.EventSet.Include("Events") .Include("TestResults") .Include("Events.Donors") .Include("Events.DonorPanels") .Include("Events.Locations") ...

Using EDMX or EDML for entities design

Two quick quesitons: Benefits of using EDMLs vs. EDMXs - when would you choose to use one over the other DevArt's Entity Developer vs. Visual Studio's Entity Designer - I know this part of the question may be a bit subjective, so I would rather ask which tool does a better job with entity design I've found that some relations in DevA...

Why won't entity framework allow me to do a .FindBy....()

I create a EDM using my database and saw that while it was able to make relations like Customers.First().Orders there is nothing like Customer.First().Orders.FindOrderByOrderID() Customer.First().Orders.FindOrderByOrderName() etc. Maybe I was expecting it to be like that and that's how it doesnt work and I will probably just have...