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.

26 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
281 views

Unit of work with Repository pattern

I am trying to work on a WPF application and decided to go for Unit of Work and Repository pattern, along with MVVM. I am using Entity Framework as my ORM. Could ...
3
votes
1answer
99 views

Initializing entity framework context in constructor

We use the architecture shown in the code below to initialize the DB context for our MVC 5 project using entity framework 6 We have the following questions related to it: Is it safe to initialize ...
3
votes
0answers
2k views

Custom generic repository pattern

This weekend I made an attempt at a generic repository pattern for entity framework in .NET after reading this blog post. I was wondering how it could be better. I specifically have a couple questions....
3
votes
0answers
497 views

Deriving classes to decorate auto-generated base class code with attributes

Background: I am currently in the process of abstracting and refactoring out EF for Dapper with ...
2
votes
0answers
1k views

Using Entity Framework to Call an Oracle Stored Procedure with Multiple Cursors

I wrote the following code to use Entity Framework 6 and Managed Oracle Providers to call an Oracle stored procedure that returns multiple cursors. Would like some input about the code I used to ...
2
votes
0answers
112 views

How to optimize code to only pull separate table rows that are necessary

I have a Company Class, and separate normalized Address Class. I did this because the Address table will hold more than just Company Addresses, so I don't want "CompanyAddress", "EmployeeAddress", "...
2
votes
0answers
966 views

Entity Framework with two databases (with UoW, Repository and Service Layer)

I have two databases: one for a warehouse, second for the office (The db design is out of the scope of this question). There are MANY cross-database funtions. One of those functions is ...
2
votes
0answers
137 views

EF mapping complex type to JSON in DB

I am trying to map a complex type to Json and store the info as Json in the DB using EF6 Code First. Here's what I have for now: The complex type ...
2
votes
0answers
726 views

Dynamic context.Set load and update/insert with using dynamic field in C# entity framework

I am writing an importer service. I have different sources and at the end I would like to push them into database tables. For different db tables, I am using different dbset in the context. I also am ...
2
votes
0answers
277 views

Domain Driven Design Model for handling images

I have to create model which will handle various types of images in my app. INTRO Plan is to have one Image type which will be universal and then extended with ...
2
votes
0answers
267 views

Entity Join slow query

I've never participated in a codereview before and I was pointed that I should in another thread for a slow query. ...
2
votes
0answers
2k views

Optimising looping through large data set and updating database

I have a database table storing information about documents (MigrationMaster). There is another table with security information on these (DocumentSecurity). There are 4 steps I can see that I need to ...
2
votes
0answers
926 views

Update Virtual Property in a Code First Model using Independent Association in Entity Framework 6

I have a Model that looks like this: ...
2
votes
0answers
88 views

DataDictionary Application - Controller

This is related to DataDictionary Application - Model I haven't done much on the controllers yet, as it's the first time I've written Controller-type classes and wanted some quick feedback on really ...
2
votes
0answers
12k views

Retrieving Primary Key from Entity Framework entity

Entity Framework (version 6) generates classes based on your tables that look like this (where each property represents a field in the table): ...
2
votes
0answers
514 views

WebApi synchronize database (EF 6) access

I'm working on an ASP.Net MVC 5/WebApi 2 project. I'm using EF 6 code first for my database access. I have a WebApi action method in which I've to update some data in my database based on the request....
1
vote
0answers
24 views

Console app to get XML from API and save to database

I am making a small console app to get XML from an API and then save the data to a database. While this project was not created via test-driven-development, I have tried to make it such that tests can ...
1
vote
0answers
1k views

Transaction integrity in asp.net core with entity framework and generic repository

I am not very experienced in Entity Framework, I previously used ADO.Net and Dapper for data persistence. For now, I only read Microsoft docs and watched a few video tutorials. I tried to stick to ...
1
vote
0answers
43 views

Querying a database to find notifications to comments

I have a solution what I think is not the best, and I want to make this not so expensive. I'm using MVC 5 + SignalR (hubs) + EF + UnitOfWork + Generic Repos. I have a table ...
1
vote
0answers
26 views

get ProductFilters in hierarchy table

I have two tables : Category and ProductFilter. Category table is hierarchy and I have depth ...
1
vote
0answers
2k views

Using IoC Container with Entity Framework Repository Pattern

I am using WPF with Entity Framework 6 (DB first), Caliburn.Micro, and MEF. I am trying to ...
1
vote
0answers
186 views

Join via navigation properties with collection

There are some related collection objects in my table and I'm trying to get list with joining this tables. But this code is seems bad: Entities that shortened: User: ...
1
vote
0answers
69 views

Query against history table

I have this linq query that queries a table that retains any change history done to any of the tables is constructed like this: ...
1
vote
0answers
331 views

Entity Framework 6.0.2 - Performance of Auditable Change Tracking Part 2 of 2

This is Part 2 of a question about performance and general best practices. Part 1 is located here. The body of the messages are the same to illustrate their similarity, the difference is the code ...
0
votes
0answers
41 views

Entity Framework C# updating an entity list generic solution

I have an entity which has a list of other entities in it. for example: class Library { public virtual List<Book> Books{get;set;} } And I would like to ...
0
votes
0answers
49 views

Loading data via Excel to SQL

I am loading data from a excel file to sql, I added comments to the code to further clarify what each lines purpose is. ...