Tag: entity-framework

Entity Framework with SQL Server 2000 (APPLY Operator) issue

I have a simple Linq query below: var seq = (from n in GetObjects() select n.SomeKey) .Distinct() .Count(); This query works find with SQL Server 2005 and above. But, this start to give headache when I hooked the EF to SQL Server 2000. Because EF is using APPLY operator which only SQL Server 2005 and […]

Is this a recommended way to use a Stored Procedure with Entity Framework 4?

My code is doing two round trips to the database because I’m not sure if this is the correct way to create a collection of my POCO’s where the first round trip hits a stored procedure because of some specific SQL code. Scenario A user enters some AutoComplete search query into the UI. My code […]

Why would an Entity Framework model generator not create code for a table when I selected it?

I have Visual Studio 2008: I can create Entity Framework models on existing tables in a SQL Server 2005 database. I can create Entity Framework models on tables I create in a local SQL Server 2008 database files. However, when I add a new table to the SQL Server 2005 database, then try to create […]

asp.net Dynamic Data Site and SQL Server image datatype

I’m just now created Dynamic Data Entities Web Site. And I have got a problem with image type. for all sql data types generated html elements by fieldTemplate. So, how can I create fieldtemplate for image-view, and image-upload ?

How to create relationship between two tables with revisions using Entity Framework

So I am in the process of redesigning a small database (and potentially a much larger one) but want to show the value of using revisions / history of the business objects. I am switching the data from Access to MSSQL 2008. I am having a lot of internal debate on what version of “revision […]

Entity framework query designer

SQL Server has great query designer that enable me to write every complex queries easily. recently I’m involving with Entity framework. I know it has three ways to querying data. LINQ to Entites Entity SQL Query Method Is there any query designer for Entity framework like SQL query Designer ? I’m familiar with LINQ PAD […]

Linq to Entities or EF version of Set Identity_Insert <TableName> ON

Similar to This Question using linq to SQL, but I don’t want to just execute SQL commands from the code. I could write a stored procedure. I am writing the year rollover functions for an application and I would like to be able to make sure that the next year uses the next available PK […]

How can I use the EF transaction scope with a SQL Command and only commit both once both succeed?

I have an entity framework data context and a SQL command that both need to update and insert objects in the same database. Either both need to succeed or I want to roll back the operation. This seems like the perfect use of transactions but I can’t seem to figure out how to use a […]

Possible reasons for error: “The cast to value type 'Decimal' failed because the materialized value is null”

I’m getting a report of errors from a production system. I don’t have easy access to the production system. I will get all the data that I need for it in due course, but what I’m trying to do is expedite the process of resolution of this issue. I’m trying to eliminate as much guesswork […]

WCF Data Services updating entity error and type of table's primary key

For some time I couldn’t find out the cause of an error when trying to update a field in a table using WCF Data Services plus Entity Framework: MydbEntities context = new MydbEntities(new Uri(“http://localhost:53051/Services/MydbService.svc”)); MyEntity entitytoedit = context.MyEntity.FirstOrDefault(); entitytoedit.Name = “TheNewName”; context.UpdateObject(entitytoedit); context.BeginSaveChanges(OnChangesSaved, context); … The error was like following: RequestException An error occurred while […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.