Questions tagged [entity-framework]

The ADO.NET Entity Framework is a set of ORM (Object-Relational-Mapping) tools for the .NET Framework, since version 3.5 SP1.

Filter by
Sorted by
Tagged with
11
votes
1answer
501 views

Wrapper class for the Rotten Tomatoes API

I'm working on a site that has to do with movies. I am consuming the Rotten Tomatoes API to get my movie information and using EF5 with a code first approach to get that into the database. I'm using ...
36
votes
2answers
104k views

Entity Framework Generic Repository Pattern

Thought 1 ...
4
votes
2answers
494 views

Trying to clearly seperate my logic in my program

My problem is I need to know is my code in my CRUD functions structured well and effectively? I plan to implement CRUD for Locations entity too. hopefully without redundant code. you see how one ...
0
votes
1answer
423 views

Making a Custom class less specialized but just as understandable?

In my C# program, I have a class defined as follows: ...
2
votes
1answer
291 views

Am I using too many functions in my DataAccess Class?

I am wondering if in particular the function called AssignDBStatusMessage and TryDataBaseAction are unnecessary. It seems to me ...
6
votes
1answer
9k views

ListBox for a many-to-many relationship

I'm looking for a good and easy to use solution for creating MultiSelectLists in MVC for many-to-many relationships. I have this following example code and it works fine, but it just takes a lot of ...
1
vote
2answers
821 views

Preparing code for more versatile CRUD functions

I am using C# and the .NET entity framework, and I'm also learning how to better use OOP concepts in my program. My code is all displayed below. I would like to ensure my logic is properly organized ...
0
votes
1answer
504 views

using 2D array to read datatable ok? or repeatedly call function that reads record by record?

I am asking this for coding style. I have a program class that calls a function(of a data access class) that reads from a table (using entity framework by the way), and I'm preparing to write the <...
5
votes
1answer
577 views

combining 4 CRUD functions into 1?

I have a console application that I'm trying to make with minimal redundant code. I have 4 functions, Create, Read, Update, and Delete. is it possible or practical to combine the four functions into ...
8
votes
2answers
983 views

How to reduce my code length without changing concept?

There are three servers. I want to assign a job to a server which has least NotStarted jobs. I have achieved this, but my code is very lengthy. I don't know how to ...
10
votes
1answer
3k views

Multiple repository calls or LINQ query

These two methods do the exact same thing (or at least they are supposed to!). They both pass a simple test based on a mock context. Neither has been exposed to any integrated testing yet. Would ...
9
votes
4answers
21k views

Threadsafe DBContext in singleton

I found out the hardway that access to DbContext in .NET is not threadsafe. I have a singleton for logging things using a dbcontext. The original version uses something like ...
22
votes
1answer
17k views

Generic repository and unit of work code

I am writing a WPF application that needs to access information from a database (I am currently using Entity Framework code first, so data access is via DbContext). ...
1
vote
1answer
572 views

Is it proper TPT Inheritance

I have following model and database created using Entity Framework. Is it proper TPT Inheritance? Is it possible to make the base class as abstract? Model Database CODE ...
1
vote
2answers
1k views

Many to many crud using entity framework 4.1

My view submits data to the controller using Json objects which contains child objects.It allows users to add/remove/modify the relationship with child entities(authors,categories,LIbraryBookCopy). ...
2
votes
1answer
7k views

Linq-to-entities query too slow

I am fairly new to Entity Framework and I am not sure I am really using it to it's max potential. I have this query, that IMHO seems to take a little longer than I feel it should. I have tried ...
2
votes
1answer
3k views

Your Thoughts: Entity Framework Data Context via a DataHelper class (centralized context and transactions)

I want to get opinions on the code I have put together for a centralized DataContext via a DataHelper class that I have created to be re-used on projects. NOTE - there is a ton of code here, sorry ...
2
votes
1answer
3k views

IAuditable and IArchivable Repository with Repository Pattern and UnitOfWork

I am quite new to ASP.net and am currently trying to implement my data access layers of my application. I have so far implemented a generic repository pattern as follows: ...
2
votes
1answer
482 views

How could I remove repetition from this linq-to-entities query?

This linq query works, and it does what I want it to do, but is there any other way I could improve the query so I'm not repeating ...
7
votes
1answer
407 views

Comparison table for comparing products

I'm attempting to create a comparison table to compare products depending on the add-ons they have. To grab the data and filter it I'm using LINQ To SQL. Table's Layout (cut short): ...
5
votes
1answer
361 views

MergeUtility for Entity Framework

Here is a utility that supports ETL/merging in Entity Framework. If it's not appealing as a general purpose tool, why? If it is appealing as a general purpose tool, how might the design be made ...
2
votes
1answer
1k views

Clever way to build a extension method that ordenate my IQueryable<T>?

I want to create a ExtensionMethod to ordenate my linq query, called Ordenar. I'll sort it depending what columns is in ...
2
votes
2answers
386 views

Am I approaching this ASP.Net MVC/Entity Framework pattern incorrectly?

I have experience is C#/ASP.NET, and I've done MVC in Ruby On Rails, so I figured making the jump to ASP.NET MVC would be a breeze. Unfortunately, I'm second-guessing my every decision. I'd like ...
11
votes
1answer
2k views

Efficient way to deal with maintaining Many:Many relationships in EF Code-First

I've got this all working, but it seems to be quite long-winded, and I thought I'd post here and see if I'm doing it wrong... I have a M:M relationship between an Installer and a MasterInstance. The ...
4
votes
1answer
1k views

LINQ generating chart

I'm generating a table to use on jQuery visualize plugin and generate a chart. The code is pretty good, but maybe there is a way to improve it. Maybe do more work on the LINQ query and less stuff on ...
5
votes
2answers
171 views

Exporting site and address data

These two methods do very similar things. Is it possible to condense these somehow? This is using the Entity Framework. ...
1
vote
2answers
445 views

Review on core EF repository method

What do you think about this core EF method ? Also, Notice that it returns IQueryable: Could that be a performance danger when extended improperly ? How ? Please accept the fact that ...
1
vote
1answer
906 views

Optimising multi-part LINQ to Entities query

I have inherited an application which uses LINQ-to-Entities for ORM and don't have a great deal of exposure to this. There are many examples like this throughout the application. Could you tell me ...
5
votes
1answer
3k views

Entity Framework Code First Data Updater

For a given Entity Framework data set, I have written several adapters to import data into my entity models. Rather than manually write mapping code for each entity model, I tried for a generalized ...
33
votes
3answers
48k views

Entity framework with repository and Unit Of Work pattern and POCO architecture

This is my architecture to EF4 using repository pattern and unit of work pattern with POCO. I believe I made some mistakes. I have a solution with 5 projects: ...
2
votes
2answers
11k views

Importing XML to a database using LINQ to Entities

I am importing XML data to a MySql database using LINQ to Entities. The data represents which students are in which classes, and looks like... ...
3
votes
1answer
1k views

Merge entities which have the same children

The C# code below, using LINQ to Entities, aims to merge all Class entities which have the same SubjectId and the same ...
6
votes
1answer
480 views

The way to realise data access

There are a several articles about true data access in MVC. I tried to make the best one according to the architecture flexibility. My way is following: ADO .NET Entity Data Model (*.edmx from Entity ...
2
votes
1answer
6k views

Creating Extension Method to map entity with subentities object to Poco object

I am trying to create an extension method that builds a POCO object (copies all the fields) for an Entity Object. When Entity object is simple (no navigation, no sub collections), it works fine. I ...
2
votes
1answer
2k views

Advice on approach to organizing my business logic & data access? [closed]

I've been researching various patterns for structuring my business logic & data access, particular in the context of C# and the Entity Framework. I've come up with a basic idea of how I think I'd ...
35
votes
7answers
133k views

Dynamic filtering and sorting with Entity Framework

I'm developing an application using ASP.NET MVC 3 and Entity Framework 4.1. In that application I have a lot of paged lists. Users can filter and sort these lists. This results in code like the one ...
3
votes
1answer
370 views

Dynamic variable - is that best way to dynamically assign?

Normally I could just declare the 'email' variable as the base class for both of EmailInbound & EmailOutbound, then cast-up to the inherited class. However, I don't think when defining EF ...
15
votes
2answers
4k views

Constructing a Data Contract interface that can be used with Entity Framework 4.1 to ensure entity validity

I need some thoughts about an approach a colleague and I am are taking with Entity Framework. Basically, the entities are represented by contracts. These contracts hold a collection of business rules ...
15
votes
1answer
7k views

What is better for Lazy-Loading Navigation Properties of detached Self-Tracking Entities through a WCF service?

I have a WCF client which passes Self-Tracking Entities to a WPF application built with MVVM. The application itself has a dynamic interface. Users can select which objects they want visible in their ...
5
votes
2answers
2k views

Small method for saving student attendance

...
15
votes
2answers
5k views

Dealing with Entity Framework's lack of enum support

I'm using Entity Framework Code First CTP 5 for a current project. There is still no enum support in Entity Framework so this is what I am using in order to avoid having magic numbers or casts ...

1
4 5 6 7
8