entity-framework

Entity Framework 4 and Synonyms

Hello, If, in Database A, there exists a table named "MyTable" that actually comes from a synonym pointing to another database (B), can I create this table as an entity in an Entity Framework model that represents database A, since it actually resides in a different database? I'm curious if the situation with EF 4 has improved since th...

Exporting Entity Framework 4 Data Model to Entity Framework 3.5

Is there a way to export a EF 4.0 Data Model to EF 3.5? I looked around and found that we are not able to access EF 4.0 from a ASP.Net 3.5 project here: http://stackoverflow.com/questions/2876887/using-entity-framework-4-0-in-a-net-3-5-application Our project is the 1st to go to .Net 4.0 using Entity Framework and we (the team) were wo...

Adding a collection of objects to Entity Framework

I have a domain collection type called SavedAnswers and would like to add that collection to my Entity Framework type Entries. I've been trying to figure out what I need to do but I'm getting confused on all the information out there. Answers has a Identity Primary Key and two Foreign Keys, which brings more issues/questions. publi...

Modifying an Entity Framework Model at Run-Time

This is purely a conceptual and design idea related to EF4. The example/scenario is a large ERP or CRM type system where companies may need to add traditional "user defined fields" to capture additional data. I know that the EF has some capabilities to push out the model to a database at run-time but the question really is can you use ...

Entity Framework - How can I create an array of complex property?

In Entity Framework v1, can I create an array of complex property? Assuming I've a "Question" entity can it have an array of "Answers" (that compose from text and timestamp)? ...

add/delete table columns at runtime using Entity Framework

I would like to know if is it possible to add/delete table columns at runtime using Entity Framework 4 ? I can't find any real solution for this problem, only theoretically answers without proves. Could you help me? Thank you very much! ...

Returing multiple Model objects from LINQ Joins

I am using ASP.NET MVC framework and accessing DB records with Entities. I am doing some joins like this: public IQueryable<...> GetThem() { var ords = from o in db.Orders join c in db.Categories on o.CategoryID equals c.ID select new {Order=o, Category=c}; return ords; } I need to use/pass 'ords...

How to use .Top() with Code First

Is this possible with Code First? I could do this if I only used Entity Framework: var q = from m in context.Products .Top("0") select m; ...

How to debug WCF Data Service?

Hi, I have created a WCF Data Service and using it in a web application which is the part of same solution. The WCF service holds the reference of another DLL(Utility.dll) which is also part of the same solution. I have added the service reference of the WCF service in the web application. So the structure is Solution | |-...

problem with take n rows and skip m rows entity framework

Hi, Im computing data from database (~130 000 000 rows). Because of big amount of rows I select 1 mln compute them save results then select another 1 mln and so on. I use select .. orderby .. skip m... take n...ToList() because I want to have this objects in memory. When I skip 1 mln then 2 mln then 3 mln ... then lets say 6 mln its...

ADO.NET Entity Framework SaveChanges is not working

Hi, I have a .NET 4 WinForms app that uses the ADO.NET Entity Framework. Some code that was working perfectly has decided to stop working and although I've tried to figure out what changed that could cause this, I am stumped. This code looks perfectly functional to me and WAS working as intended. Anyone have any ideas? Here is the code...

Entity SQL - Retrieves bytes data in chunks

The following code retrieves all bytes data at once. I'm wondering how to access byte data stored in chunk using entity framework. Since files are so big (around 50MB), I want to send it to user by chunks as soon as I get partial bytes from database. using (Entities context = new Entities(EntitiesConnectionString)) { byte[] data = ...

Entity Framework 4.0, Can't find connection name

I am trying to run a unit test with N-unit in a project. The project has the .edmx file in it, so it's not a multi-project problem that I see a lot of people. I kept all the defaults from what was auto generated by the Tool. My Web.config file appears to have the connection string in the <connectionStrings>: <connectionStrings> <add nam...

Trouble with metadata in Entity Framework connection string

I have a Silverlight 4 app using RIA Services in which I moved all of the RIA Services-specific code to a separate module (a WCF RIA Services class library) called "AppServices". Let's call the main app "Silverlight4App". I need to authenticate the users against a different database than the database where the rest of the data is stored....

Most Important Limitations Of The Entity Framework

What are the most important limitations of the ADO.NET Entity Framework 4.0 that business application developers should be aware of? I have used it in some pet projects of mine and it seems very efficient, but I am concerned about the problems I will face when I am building large, more complex data-driven business applications. I am es...

Update existing EntityCollection in Entity Framework

I try to work with link to entity, and i want to work directly with my entity in my application. using System; using System.Collections.Generic; using System.Linq; using System.Text; using Calandar.Business.Manager.Data; namespace Calandar.Business.Models.Args { public class SaveExpertArgs { public ExpertEntity Expert {...

How do you tell if an EF4 entity is new or an existing record?

In my application I have an entity which is being used essentially as a complex many to many between my User and Project entities. I am trying to determine how to figure out if my service layer needs to add the entity to the context or attach the entity (for updating an existing entity) and I am at a loss of how. This is easy to determ...

How to connect Controller to Service layer to Repository layer

Lets say I have the following entities that map to database tables (every matching property name can be considered a PK/FK relationship): public class Person { public int PersonID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } } public class Employee { public int EmployeeID { get; set; ...

Based on a declared constraint, the navigation property is required.

Hi! Im dealing with code first .NET 4 and i'm having trouble with a 1 to 1 relation. breifing of database: -POccurrence -Id -POccurrenceRiskAssessment -OccurrenceId in my class Poccurrence I have a property named RiskAsessment, of the type POccurrenceRiskAssessment. Not all POccurrences have riskassessments, so it needs to be null...

Entity Framework CTP 4 - Code First Custom Database Initializer

I would like to implement a custom database initialization strategy so that I can generate the database schema and apply it to an EXISTING EMPTY SQL database using a supplied User ID and Password. Unfortunately the built-in strategies don’t provide what I’m looking for: // The default strategy creates the DB only if it doesn't exist -...