entity-framework

How to make "1-to-1" association works correctly in Entity Framework?

I have objects: type A (Id, Name), type B (AId, Description). I want to make relation 1-to-1 (and create it 1-to-[0..1]). All works great exept deleting objects of type A. When I'm trying to delete some object from type A exception occurs. A relationship is being added or deleted from an AssociationSet ‘...’. With cardinality constrai...

3rd party LINQ to SQL / EF designer search features add-on

I am searching for this feature: To search for an entity, relation ... etc in the designer. In EF designer the model browser window make finding entities a little easier but in LINQ to SQL there is no such thing. Also searching in the designer area is not available at all. I am wondering if I am the only one who sees this a s requirement...

Hashed passwords and the entity framework

I've got a Users table and the HashedPassword column is of the binary(16) type. It's used to store an MD5 hash. To generate the hash I created a couple of stored procedures: CreateUser, EditUser and LoginUser. They have a parameter that accepts a password in plaintext, convert it to the MD5 hash and store/lookup the hash in the table. T...

Multiple joins in SQL generated with Entity Framework

I have Tasks table with two navigation properties - VersionReported and VersionResolved, both stored in table Versions. When I try to get Task list with included both properties, I get too many joins in SQL (this is only part of sql from profiler): LEFT OUTER JOIN [dbo].[Versions] AS [Extent4] ON [Extent1].[IDVersionReported] = [Extent4...

Optimizing a RESTful Query in the client...

READ FIRST before answering! I have a RESTful service which wraps around the Entity Framework. Basically, all I did was create a database, add relations between the tables, create an Entity model around this database and finally expose the whole thing as a RESTful *.svc service. This is done, cannot be changed either. Now I need to que...

Entity Framework caching under ASP.Net

I was trying to find out which Entity Framework objects, if any, remain live after the end of an HTTP request that is being handled by ASP .Net? i.e. Does an ASP .Net application benefit from any of the Entity Framework caching mechanisms across different requests? This article describes the operations that are occurring under the hood...

How to support Multiple Entity Framework Models in the same solution

I have begun developing an application using the Entity Framework. I have added a namespace to contain all of my user management code MyApp.Users for example, and this contains a model that has been marked internal to the namespace and only exposes functionality to the rest of the system via interfaces. This is all good. I now wish to ...

Entity framework get latest records in list of records with date

Hi all, i have a sql server table with records (that isn't new) it has 1 or more records (measurements) for a person, and all records have a datetime field. So for person 1 i have 5 records / measurements, dated jan 1, jan 2, feb 8, march 19 and july 2. i have maybe 10 records for person 2, and the dates are different too. Now i want t...

How to handle paging IQueryable with Linq To Entities? (problem with OrderBy)

Hi There, I am currently building a simple ASP.NET MVC site using Linq to Entities. My first foray into this world was nerd dinner, which is where I found the paginated list code that I am attempting to use. The code looks as follows: public class PaginatedList<T> : List<T> { public int PageIndex { get; private set; } public i...

Entity Framework Error: "The container 'XXXX' specified for the FunctionImport could not be found in the current workspace."

I am executing this EntityConnection entityConnection = (EntityConnection)context.Connection; EntityCommand command = entityConnection.CreateCommand(); command.CommandText = "Genesis.AL_Insert"; command.CommandType = CommandType.StoredProcedure; //Parametro de NombrePlantilla EntityPa...

Is there a way to set the DB as Single User Mode in C#?

I have a WPF app that updates my database from an in-code entity model. There may be instances that it updates the DB while there are users connected and I would like to put it in Single-User-Mode to avoid errors. I would also like to avoid using sql. I am aware that I can run sql using: DataContext.ExecuteCommand("ALTER DATABASE..."...

Unable to access oci.dll due to application type.

Hello, I am using attempting to create a connection to an Oracle database via entity framework in Visual Studio 2008. I am running 64 bit Vista Ultimate. At first, I had difficulty even making a connection to the db through Visual Studio, but eventually got things working by installing 10204_vista_w2k8_x64_production_db AND ODTwithODAC...

Entity Framework Multiple Table Entity Key Mapping issue

Ok so here is my issue. I have a QA day log table and a Employee table. I want the NetUserID on the Employee table to be transfered to the QA day log table. I added both tables, cut and pasted in the designer and I edited the mappings like I thought I was supposed to. I get an error about the DL_ID which is the primary key for the QA...

Extending with filter queries with entity framework

Hello I have 3 tables in my testdatabase, Customers <-> CustomersUsergroups <-> Usergroups For customers I have a method that returns all Usergroups like this: public IQueryable<Usergroup> GetUsergroups() { return from ug in _entities.UsergroupSet.Include("Customer") select ug; } And to that I ...

Can Entity Framework do what Linq To SQL does?

I'm a bit confused, I have worked with Linq To SQL and gather we can query anything in the dbml or entities e.g: var query = from i in db.mytable select i; But in the Entity Framework (which supposedly Microsoft are replacing Linq To SQL with) how can we do the same thing? Is it even possible? How does it replace Linq To S...

Asp.Net MVC / Entity Framework. Avoid tag soup?

Ok, I have a new MVC project which uses the entity framework. I'm spitting out messages (This is a bulletin board style section) now depending on some conditional factors the row in the table output must have a differant class style. The model that is passed to the page from the controller is the entity Model (Called Messages and cont...

From old DataLayer to LINQ to SQL / Entity Framework

There are a few "should I chose this or that" questions on SO and Google, as well as a lot comparing LINQ2SQL and LINQ2E. I've seen drawbacks, differences, cons, pros, limitations, etc. I cannot say I'm an expert but I'd like to know "what would you do" if you faced this scenario and why. I have to add stuff to an "old" 2.0 app that ha...

How to work with Enums in Entity Framework?

What is the best way to work with Enums in Entity Framework? Remarks: I'm using EF 3 againts Firebird. ...

What should I know about working with ADO.Net Data Services? (FAQ)

I've been learning by doing with ADO.Net Data Services (Astoria) for the last couple of months, and while I like the technology the learning has been a real trial. Information that you need to use them effectively is spread over MSDN documentation, articles, blog posts, support forums and of course StackOverflow. This question is a place...

Transactional (In-Memory) Edits with Entity Framework

In the olden days of the DataSet (and related objects), the in-memory representations of the data objects--DataRow and DataRowView--supported transactional edits through BeginEdit, EndEdit, and CancelEdit. Having both in place allowed more than simply being able to "undo" changes made to an object and reverting it back to its retrieved (...