All Questions

Filter by
Sorted by
Tagged with
67 votes
4 answers
15k views

WPF Programming Methodology

In my APP I'm using an API of a software that my tool is managing. I've DAL that contain 16 classes, 3 of them are singletons. I've some logic in the .cs files and XAML's off course. My question is, ...
SigmaOmega's user avatar
45 votes
4 answers
32k views

Entity Framework - Migrations - Code First - Seeding per Migration

I am looking into Migrations in an effort to clean up our deployment processes. The less manual intervention required when pushing a change to production the better. I have run into 3 major snags ...
Talon's user avatar
  • 3,545
35 votes
2 answers
50k views

Serialization of Entity Framework objects with One to Many Relationship

I am attempting to use EF with Code First and the Web API. I don't have any problems until I get into serializing Many-to-Many relationships. When I attempt to execute the following web api method ...
Blake Blackwell's user avatar
30 votes
4 answers
20k views

Can anyone spot why I keep getting this error testing the EF 5 beta

Installed visual studio 11 beta as wanted to test EF 5 beta but keep hitting this an error. Method not found: 'Void System.Data.Objects.ObjectContextOptions.set_UseConsistentNullReferenceBehavior(...
Drauka's user avatar
  • 1,217
25 votes
1 answer
3k views

Enum as Key in entity framework 5 throwing error on many to many joins

OK, this is a bit lengthy / obscure, but I'm getting an odd error in specific situation where I use an Enum as a table Key and attempt to query against the table while including more than one many-to-...
Gene Reddick's user avatar
  • 4,655
22 votes
6 answers
45k views

EF6 DBContext Dynamic Connection String

public partial class ProcessContext : DbContext { static ProcessContext() { Database.SetInitializer<ProcessContext>(null); } public ProcessContext() : base("Name=...
Gautham Nayak's user avatar
17 votes
7 answers
3k views

Issue Installing Entity Framework 7 RC1

I 'm trying to install EF7 rc1 to an existing project: PM> Install-Package EntityFramework.MicrosoftSqlServer –Pre but I get the following error: Install failed. Rolling back... Package '...
E-Bat's user avatar
  • 4,812
16 votes
3 answers
26k views

Enum Support for Entity Framework Database First

I can find a bunch of tutorials on how to implement enum support for model first and code first like these: http://msdn.microsoft.com/en-us/data/jj248772.aspx http://msdn.microsoft.com/en-us/data/...
TMan's user avatar
  • 4,054
16 votes
2 answers
12k views

How do I kick off an entity stored procedure in EF6 async and not wait for a return?

I'd like to just punt a call over to the SQL Server and not wait for a return. I have an imported Entity Function from a Stored Procedure that I'd like to call asynchronously this way in Entity ...
dirq's user avatar
  • 978
15 votes
1 answer
844 views

Entity Framework entity is not in DataSpace.OSpace (_workspace.GetItemCollection(DataSpace.OSpace)) but is in DataSpace.CSpace

I have been mucking around with XMLs for entity Framework. I tried to create a type of entity that could have properties injected at runtime, First I created DynamicEntity object that is dynamic ...
Matas Vaitkevicius's user avatar
14 votes
2 answers
4k views

Upgrading from EF 4 to EF 5

My application is based on .NET 4.0 and EF 4. I'm now looking at upgrading to the latest versions. Are there any breaking changes or behavioral differences that may adversely affect my application? ...
SimpleUser's user avatar
  • 1,341
14 votes
6 answers
17k views

Watch for a table new records in sql database

I am using EF in a windows application and I want my application to do some tasks when a new record inserted in a certain table "these new records will be inserted by a website using the same db" My ...
Amr Elgarhy's user avatar
  • 67.8k
11 votes
1 answer
1k views

Does the new Migrations feature of Entity Framework 5 fully support enum changes?

Let's say we have the following simple model: public class Car { public int Year { get; set; } public string Make { get; set; } public string Model { get; set; } public CarType Type { ...
Chad Levy's user avatar
  • 10.1k
11 votes
4 answers
3k views

Execution-Deferred IQueryable<T> from Dynamic Linq?

I am using Dynamic Linq to perform some queries (sorry but it's my only option). As a result, I am getting an IQueryable instead of an IQueryable<T>. In my case, I want an IQueryable<Thing>...
Jaxidian's user avatar
  • 13.2k
10 votes
2 answers
5k views

EF data annotations aren't "working" after targeting .NET 4.5

I've got a project that was targeting .NET 4.0 and using EF 5.0. After changing the target framework to 4.5 (and updating the EF 5.0 reference to use the .NET 4.5 assembly), it seems like the data ...
Rob's user avatar
  • 101
9 votes
2 answers
10k views

MaxLength Attribute in EF4.3.1

The type 'System.ComponentModel.DataAnnotations.MaxLengthAttribute' exists in both [path...]\packages\EntityFramework.4.3.1\lib\net40\EntityFramework.dll and 'c:\Program Files (x86)\Reference ...
Mihalis Bagos's user avatar
8 votes
1 answer
5k views

How to use a dynamic connection string using a Model First approach but still use the data model in the EDMX?

I have created an EDMX using EF 5 with the Model First approach, i.e. I started with a blank designer and modeled my entities. Now I want to be able to use this model defined in the EDMX but supply ...
Jim's user avatar
  • 4,920
7 votes
4 answers
5k views

.NET 4.5 Beta DbGeography NotImplementedException

I have a brand new server which I installed the .NET 4.5 Beta redistributable on. I am getting a NotImplemented exception when trying to use the spatial features. This code... var x = DbGeography....
craig.tadlock's user avatar
7 votes
3 answers
1k views

Use strong spatial types option in model designer locked?

I'm working on a model first EF6 model in model first approach. EF exposes more than DBGeometry and DBGeography and allows me to select specific subtypes when designing the model (like GeographyPoint)...
Ronan Thibaudau's user avatar
7 votes
4 answers
19k views

Entity Framework 5.0 code-first with MySQL Connector 6.6.5.0 on .Net 4.5

For the life of me, I can't get my C# WinApp to work with Entity Framework 5.0 with a MySql database using MySql connector 6.6.5.0 (MySql.Data reference) and MySql Entity 6.5.4.0 (MySql.Data.Entity ...
Joao Coelho's user avatar
  • 3,006
6 votes
2 answers
5k views

EF Core execute sql

Am testing out Entity Framework Core, it's been well so far until i hit an error. I am not able to execute sql from a DbSet with FromSql. Error is dbset does not contain a definition for 'FromSql' ...
Tonto's user avatar
  • 2,960
6 votes
2 answers
4k views

Build error when using VS 11, .NET 4.5 and Entity Framework

In Visual Studio 2010, my solution was using .NET 4.2 (Entity Framework June 2011 CTP) so I could use spatial types in Entity Framework. When I upgraded to Visual Studio 11 Beta, it wouldn't build ...
Ray Saltrelli's user avatar
6 votes
2 answers
2k views

Navigation properties when datatypes does not match in Entity Framework

I am trying to map a legacy database into an Entity Framework Model. The database is very generic, and most data are stored in the tables "Object" and "Event". The columns are named things like "Date1"...
Markus Jarderot's user avatar
5 votes
1 answer
8k views

DBContext conversion from ObjectContext

I'm use this function in EntityFramework 4.0 (ObjectContext). Now i'm using EF 5.0. My problem is DefaultContainerName,GetObjectByKey methods not found in DBContext public static T GetObjectByID<T&...
ebattulga's user avatar
  • 10.9k
5 votes
1 answer
5k views

Entity Framework Code First Self Join, 'Multiplicity is not valid in Role'

I am stuck at this error and can not find the solution to this. I have tried several things but could not come up with a solution. Here is my problem: Code: namespace ProjectTracker.Database....
Naveed Butt's user avatar
  • 2,891
5 votes
3 answers
36k views

Entity Framework with SQLite Error: An error occurred while reading from the store provider's data reader

I'm using SQLite 1.0.89 with EF 5 .NET Framework 4.5 on VS2013 in a WPF application in C#. The DB size is not big and the table that the program use contain max 1000 row. using the program I found ...
abrfra's user avatar
  • 654
5 votes
1 answer
1k views

Easy Way to Perform C# Null Check in a Type Conversion

I am doing some quick type conversions in a project I am not that very familiar with. They look similar to this: var NewType = new { NewTypeId = old.SubType == null ? 0 : old.SubType.SubTypeId ?...
AnotherDeveloper's user avatar
5 votes
1 answer
486 views

"Cloning" EntityConnections and ObjectContexts in Entity Framework

(This used to be a 2-part question, but since the second part is literally the important one, I decided to split this into two separate posts. See Using Serialization to copy entities between two ...
Fernando Espinosa's user avatar
5 votes
2 answers
348 views

One-To-Many AND Recursive relation - Force value to be set

Environment Framework 4.5 Entity Framework 6 (code First) Model MainEntity One to many ChildEntity relationship ChildEntity One to many recursive ChildEntity relationship Model in code Snippet ...
Segers-Ian's user avatar
  • 1,037
5 votes
1 answer
2k views

Entity Framework DB First: Convert Associative Table to Navigation Properties

I am using Entity Framework Database First, but I would like to replicate the following behavior from the Code First paradigm: In Entity Framework Code First, you can do something along these lines: ...
Michael's user avatar
  • 1,585
4 votes
1 answer
3k views

Adding multiple oracle schemas in visual studio 2013 and EF

I have a serious problem that needs to be resolved. In my server explorer in VS2013, I set up a connection to the database with valid user and password credentials. So I have a schema called: ...
sksallaj's user avatar
  • 3,942
4 votes
0 answers
249 views

Listen for EDMX conversion?

When re-targeting a project from .NET 4.0 to .NET 4.5 in VS2012 any EDMX in the project is automatically converted to EF 5, i.e., the namespaces are updated to match the target framework. Is there a ...
Kim Johnson's user avatar
  • 1,229
3 votes
2 answers
2k views

how to configure entity framework 6 for sqlite in visual studio 2013

How can I configure entity framework 6.x for Sqlite in Visual Studio 2013. I want to configure my win-form application for SqLite with Entity Framework 6.x. I need process step by step described. I ...
Haider Ali Wajihi's user avatar
3 votes
5 answers
2k views

EF 6 programmatic Migration with custom connection string

I have an EF6 code first implementation with migrations enabled and a single initial migration. I created a method to programmatically run the migration that looks like the following: public void ...
AC4's user avatar
  • 662
3 votes
1 answer
5k views

ADO.NET Entity Data Model doesn't update Entities

I'm using MySQL .NET Connector in my ASP.NET MVC project. The connection works fine. However, after creating a ADO.NET Data Model from my MySQL database (with "Update Model from Database") for the ...
Gaui's user avatar
  • 8,793
3 votes
1 answer
1k views

Custom entity builder for custom database table

I'm designing a multi-tenant application using Entity Framework 6. A key requirement in this application is that each tenant is allowed to have customized tables. This means that one table with the ...
Sparafusile's user avatar
  • 4,816
3 votes
2 answers
4k views

Failure after upgrading project from .NET 4.0 to .NET 4.5 => the type or namespace name 'MaxLength'/'Column' could not be found

I have a working website targeting .Net 4.0 and entity framework 4.3.1. After installing .Net 4.5 ( with Visual Studio Express 2012 ) I can compile the website on Visual Web Developer Express 2010 ...
Julián Yuste's user avatar
3 votes
1 answer
2k views

Replacing ADO.NET with Entity Framework. Is Entity Framework suitable for following scenario?

Question 1: Should we use Entity Framework in a multi-user environment to implement a functionality which performs multiple updates (100 rows) on a table? Question 2: Are we taking a right decision to ...
Amit Rai Sharma's user avatar
2 votes
2 answers
4k views

Entity Framework Code First: One-to-One where PK is a FK

I'd like to map a one-to-one relationship using Entity Framework 5 Code First like this: public class User { public Guid Id { get; set; } } public class Profile { public User Owner { get; ...
Matías Fidemraizer's user avatar
2 votes
1 answer
2k views

Entity Framework Build Issue in VS 2012 .NET 4.5

Is there any trick/workaround/known "gotcha" regarding Entity Framework 4 and Visual Studio 2012? I have a project that works and compiles perfectly on my Windows 7, VS 2010, .NET 4 box. Over the ...
Taylor Bird's user avatar
  • 7,857
2 votes
1 answer
83 views

Entity framework object not updating after being passed around

I'm working on setting up a new MVC payment site with a dependency-injected database connection in a separate project, and experimenting with some new things as I do. Currently, I'm trying to load an ...
Bobson's user avatar
  • 13.6k
2 votes
2 answers
3k views

Repository pattern with Entity Framework 5. Updating related objects

I am building a repository for a new application which uses Entity Framework 5 as the backend data source. I have the basic CRUD operation working for simple models but I am struggling to understand ...
Phil Murray's user avatar
  • 6,456
2 votes
1 answer
2k views

Entity Framework: Store entity property in json format

Let's say you've an entity that has a property typed as ICollection<string> and I want to store it as varchar in SQL Server in JSON format. How to achieve this? Thank you in advance.
Matías Fidemraizer's user avatar
2 votes
1 answer
129 views

Upgraded to .NET 4.5 and EF5. No longer able to deploy WCF Service.

We have a wcf service that runs as an application in a separate application pool on our webserver in a subfolder. We upgraded to .NET 4.5 in Dec. and EF5 in January. We did our standard web deploy ...
Keith H.'s user avatar
  • 338
2 votes
0 answers
418 views

Entity Framework 5.0 TBH multiple level abstract inheritance hierarchy not saving properties into databse

I have a two level heirarchy of inheritance defined in my EF5 edmx file. A simple example of the class structure: A -> B A -> C A -> D -> E A -> D -> F Where bold classes are abstract (...
James Ferretti's user avatar
2 votes
0 answers
867 views

"Signature of the body and declaration in a method implementation do not match"

UPDATE: I think I've eliminated Unity from the equation. See below for more details. UPDATE 2: I think I may have eliminated Entity Framework fro the equation. See below for more details. I have ...
gilbert's user avatar
  • 318
2 votes
1 answer
1k views

Building business logic on top of entity framework 5 POCOs

I've got an ADO.NET background and its the first time I've used Entity Framework in a serious project so I've gone ahead and got VS2012 and am using .NET 4.5 and entity framework 5. I'm taking the ...
Dan Cook's user avatar
  • 1,992
2 votes
0 answers
315 views

(EF 5 + .net 4,5) escalating transaction to DTC when querying using EF-Linq and SqlConnection

We recently upgraded our project to use .net 4.5 and EF 5. We use traditional SqlConnection to query legacy part of application and EF-Linq for rest. After upgrade code that used to work fine started ...
mamu's user avatar
  • 12.3k
2 votes
0 answers
1k views

.Net 4.5 not installing correctly?

I just downloaded and installed .net 4.5 and it went through the installer successfully, I got all the successful install messages, restarted my machine, and nothing. My C:\Program Files (x86)\...
Rikon's user avatar
  • 2,696
1 vote
4 answers
3k views

EF5 does not create enum columns

I have a model like this: namespace Ad.NegCred.Data.Model { public enum DataKind { F, //Takibe alınıp henüz tahsil edilmeyen ferdi kredi bildirimi FA, //Aynı dönemde takibe alınan ...
koducu's user avatar
  • 85