All Questions
Tagged with .net-4.5 entity-framework-5
69
questions
53
votes
1
answer
44k
views
Non-static method requires a target. Entity Framework 5 Code First
I am getting the error "Non-static method requires a target." when I run the following query:
var allPartners = DbContext.User
.Include(u => u.Businesses)
...
44
votes
4
answers
37k
views
EF5 Starting a Project:Error Running transformation: Please overwrite the replacement token '$edmxInputFile$'
I'm creating a Console Project in VS2012 with .Net4.5.
After it I "Add", "New Item" to the project, and choose "EF 5.x DbContext Generator".
Then, after a couple of seconds the following error message ...
28
votes
2
answers
29k
views
Unit Of Work & Generic Repository with Entity Framework 5
I'm using ASP.NET MVC 4 with Entity Framework 5. I have model classes and Entity Maps to map existing tables to those model classes. All this is setup fine and works great.
Now I want to mock this. I ...
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-...
19
votes
5
answers
14k
views
Does Entity Framework 5 support unique constraints?
Wondering if Entity Framework 5 supports unique constraints on entity properties? If so, how can I specify that a property should be unique?
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?
...
14
votes
2
answers
6k
views
'Enable-Migrations' fails after upgrading to .NET 4.5 and EF 5
I just upgraded my MVC4 project to .NET 4.5 and EF5 and started using VS2012.
After realizing I needed to set-up auto-migrations in the Package Manager again I ran Enable-Migrations - ...
13
votes
4
answers
7k
views
Is EntityFramework available for Windows 8 Store Apps?
Is EntityFramework available for Windows 8 Store Apps?
I'm using Visual Studio 2012 Express for Windows 8.
I'm starting to wonder because I can't make it work.
I installed the Entity Framework ...
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 { ...
10
votes
3
answers
15k
views
Found conflicts between different versions of the same dependent assembly.MVC3 -> MVC4 / EF4 -> EF5
The question is how to resolve conflicts between versions of assemblies in my project that was upgraded to MVC4 and EF5?
The problem is manifest in the fact that my controllers and models can include ...
10
votes
1
answer
4k
views
Are there technical reasons EF 5 isn't fully supported on .NET4.0?
I wanted to upgrade my app to EF 5 to take advantage of features like support for enum spatial etc. However, I was not able to upgrade unless I move to .Net 4.5.
I would like to know what features of ...
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 ...
9
votes
1
answer
5k
views
DbGeography.PointFromText 24141: A number is expected at position
I have WCF REST service which contains following code
var geo = DbGeography.PointFromText(string.Format("POINT({0} {1})", longitude, latitude), DbGeography.DefaultCoordinateSystemId);
Unit test ...
8
votes
2
answers
3k
views
DbGeometry makevalid?
I'm new to this. I don't know how to use the SqlSpatialFunction MakeValid.
I have a DbGeometry which is a polygon. This polygon is not valid and I want to
make it valid.
Can anyone explain how to use ...
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 ...
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 ...
6
votes
1
answer
11k
views
Can't get the ApplyCurrentValues(Entity) to work in Entity Framework 5
Comrades, can anyone help me out here, entity framework 5 seems not to have ApplyCurrentValues() method. Is there another way to update the database object in entity framework v5. here is what am ...
6
votes
2
answers
5k
views
DbContext code generation stategy fails with Entity framework 5 and VS 2012
I have a WPF project in .NET framework 4.5 (VS 2012) and downloaded Entity Framework 5 using NuGet package to the solution.All the documentation regarding Entity Framework 5 says that the Default Code ...
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&...
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 ...
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:
...
4
votes
2
answers
2k
views
.NET 4.5, EF 5 and MembershipProvider
Does anyone know if there is going to be created a default MembershipProvider to use with EF 5 (like SqlMembershipProvider and ActiveDirectoryMembershipProvider) or we will still have to create custom ...
3
votes
1
answer
1k
views
How can I debug the SQL generated by EF5 during runtime?
So I am pretty new to EntityFramework, actualy in the POC stage right now, and one of the questions I am trying to answer is how can I visualize the query generated by EF through the debugger or other ...
3
votes
1
answer
1k
views
How to solve combined one-to-one and one-to-many relationship in EF 5 Code First
I´m using Entity Framework 5 and Code First.
I have two domain entities Question and Answer for a quiz application. One question has several possible answers. A question also has one correct answer ...
3
votes
1
answer
1k
views
How to Serialize in EF5 with ICollection<T>
I'm using .Net 4.5 and Entity Framework 5.0.
I have 3 basic entity classes created using the Code-First approach. Now I'm trying to serialize it and am unable.
Here's the basics of the classes:
Base ...
3
votes
1
answer
323
views
EF5 many-many relationship entities
We are using the pre release version of EF5 and doing code first. I have an Orders model and a Products model (many<>many relationship). I created OrderItems model with OrderID, ProductId and ...
2
votes
2
answers
2k
views
Table Valued Functions in EDMX with Entity Framework 5 / Visual Studio 2010
If it possible to use table valued functions in an EDMX with Entity Framework 5 RC / Visual Studio 2010?
I cannot see the option in the EDMX designer, I have a feeling that the designer is in .net 4....
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; ...
2
votes
1
answer
1k
views
Entity Framework Code First: Table Per Hierarchy, doesn't popluate custom discrimiator field
I am using Table Per Hierarchy (TPH) architecture to work with an existing database schema. When I attempt to use a custom Discriminator field name a DbEntityValidationException:
Property: ...
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 ...
2
votes
3
answers
3k
views
NotMapped Error in EF5 and .NET 4.5
In VS2012(.NET 4.5 and Entity Framework 5 )
When exposed the inheritance relationship,caused the compile-time errors:
You cannot use Ignore method on the property 'InnerString' on type
'MrTree....
2
votes
2
answers
4k
views
Entity Framework 5 Enum Naming
I am using EF 5 with migrations and code first. It all works rather nicely, but there are some issues/questions I would like to resolve.
Let's start with a simple example. Lets say I have a User ...
2
votes
2
answers
2k
views
SqlGeometry / DbGeometry Isvalid exception when hosting on Azure Web Role
I'm trying to create a DbGeometry type polygon. it works fine on my local machine but I am getting an error on the return statement when hosting my website on an Azure Web Role.
Code:
string ...
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.
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 (...
2
votes
0
answers
471
views
Is it possible to use a .Net 4.5 assembly (using Entity Framework 5) from a .Net 4 project?
I have a project written in VS2012/.Net 4.5 that is essentially a bog-standard, database-first Entity Framework 5 entity model and context, and associated business domain classes. That all works fine ...
2
votes
0
answers
274
views
Cast reflected object to reflected generic interface
I am working on a project that is built on .NET 4.5, EF5 and GenericRepository.EntityFramework. I am trying to create a publication service that will take some actions on records in an database used ...
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 ...
2
votes
1
answer
1k
views
Can I target .NET 4 and .NET 4.5 in the same Visual Studio solution (when using Entity Framework)?
I have a Visual Studio 2012 solution that consists of both a web application and some client-side code. The way the application is structured, there is a shared class library used for data access.
...
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)\...
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 ...
1
vote
1
answer
2k
views
Adding methods to EntityFramework DBset
I am working with EntityFramework 5, .NET 4.5 C#. I want to add custom SQL to the Member DBset. I want to be able to select by Name and Surname using the following statement
RosteringDBContainer db = ...
1
vote
1
answer
657
views
Entity Framework 5.0 Conventions
I am just beginning to learn Entity Framework (starting with 5.0) and running into some issues. After watching a few videos on Pluralsight, I decided to get creative and created an abstract base class ...
1
vote
1
answer
241
views
Avoid updating non nullable field
When updating a row from a detached entity, I'm trying to avoid updating fields which haven't changed, using this:
DbEntityEntry<Type> entry = context.Entry(entity);
entry.Property(p => p....
1
vote
1
answer
158
views
Table Valued Function in Entity Model Not Visible Through WCF
I have successfully imported a Table Valued Function into our entity model using EF5, which we expose via WCF DataServices.
From within the project that houses the model and WCF service, we can ...
1
vote
1
answer
1k
views
How to create GeometryLineString with System.Spatial in c# 4.5
I am trying to create & store line with Geometry data type in sql 2012, as I have never used this data type I was wondering how do I manipulate data in C#, then I found System.Spatial.
MSDN Link ...
1
vote
1
answer
282
views
What is there for a service tier that can access SQL Server
I've never built anything to work with a service between my Windows Forms Application and SQL Server. Now I have a need to.
Anyone have suggestions on where to start? Or if there is a simple way to ...
1
vote
1
answer
3k
views
System.ComponentModel.DataAnnotations.Schema not found in VS2010
I'm trying to use EntityFramework 5 (not 4.4, because I want to use some new features - enum support, spatial types, etc.) with Visual Studio 2010 on the machine with .NET 4.5 installed.
To configure ...
1
vote
1
answer
476
views
Do I need to upgrade to Entity Framework from 4.0 to 5.0 to improve SQL generation with a TPT schema?
I have an application using EF 4.0/.Net 4.0 and I'm using a TPT model, causing some performance issues when the size of data gets too large.
As far as I understand, .Net 4.5 is supposed to improve ...
1
vote
1
answer
2k
views
Entity Framework 5 RTM Code First enum support broken: enums in other namespaces
This is about Entity Framework 5 RTM Code First.
When I map an entity having an existing enum I get this error:
No corresponding object layer type could be found for the conceptual
type '[FULL ...