Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

An ORM built by Microsoft and is available as part of .Net framework 3.5 and later.

0
votes
3answers
86 views

Updating nested entities with constraints without getting spaghettimadness

I have an endpoint "import" that is supposed to accept an entity. This entity can contain several sub-entities with yet again some sub-entities. Since this is an "import" endpoint, some of the entites ...
5
votes
2answers
137 views

Is it worth implementing Entity Framework when calling a single stored select?

I'm currently building a web application for my enterprise level business internship. This web application will track data from three different sources: a DB2 database, a SQL Dynamic database, and an ...
0
votes
3answers
99 views

Repository Pattern and Joined Queries

In conjunction with Unit Tests and Dependency Injection I (and my primary coworker) are exploring Repositories. However we cannot come to a solid plan of action for implementation. In a basic ...
2
votes
1answer
64 views

Best practices for translatable models in Entity Framework Core 2.1+

I'm building an Entity Framework Core-backed ASP.NET Core RESTful service and I have entities / models such as Product, Document etc with description in multiple languages. I want to be able to ...
1
vote
1answer
48 views

Entity Framework Entity Names

As an example, I have a POCO called Person which is used in my presentation layer and my business logic layer. I don't want to use this POCO in the Entity framework because I don't want that class ...
-1
votes
1answer
132 views

ORM vs Web API differences

I'm struggling to understand the differences between an API such as a REST API and an ORM such as Entity Framework. I would also like to understand the benefits of each and in what situations either ...
0
votes
1answer
113 views

Is my DataAccessLayer well implemented?

I have 3 projects in my solution : An ASP MVC project A console app project A class library project (the DataAccessLayer) I didn't want to recreate an ADO.net entity data model for each project so I'...
-2
votes
1answer
184 views

Convince manager, to switch from EF db first to code first

I really hate dealing with DB first, it is honestly the bane of my existence. How can I convince my manager that, although the work to switch is a lot. It will be worth it.
-2
votes
1answer
210 views

Role-based declarative security for C#

According to Domain Driven Design and Development In Practice: Spring Security (a sub-project in Spring Portfolio) provides a fine-grained access control in both presentation (URL based) and ...
0
votes
2answers
142 views

Nullable foreign keys and creating join tables

I'm not that experienced in sql modeling and i'm looking for input on this because it's important for me to get it right. I use mssql and entityframework core in an asp.net core web app. The app ...
0
votes
0answers
56 views

How to implement M-N relationship to reflect the domain correctly

If I have three entities like this: WorkingGroup WorkingTime Shift The WorkingGroup has one or more workingTime public class WorkingGroup { public WorkingGroup() { ...
-2
votes
6answers
353 views

Is it good practice to have a unit test for a simple data method?

I have a simple data method that does this: public void Write(Foo foo) { db.Foos.Add(foo); db.SaveChanges(); } I was asked to write unit tests for this. To do so, I had to create a fake ...
6
votes
4answers
309 views

How to incorporate external entity models in conceptual model?

If I want to create a conceptual model for my new application, and during the analysis, I found that some objects like employee, department ..etc are a part of another system. and all the data related ...
-1
votes
1answer
110 views

Iteration inside a using or using inside an Iteration

Is there a best practice for iterations inside of a "using"? which is better? and maybe a why? "using" inside of an iteration... foreach (var currentPerson in Persons) { using (var db = new ...
1
vote
1answer
256 views

Manually disposing Entity Framework Context while using Ninject InRequestScope();

Spending some time sifting through documentation, I'm trying to figure out the best software architecture with or without the dispose pattern. I've built the Repository pattern many time over the ...
-2
votes
1answer
155 views

About Three Layer Architecture

I'm currently developing a minor project for school and I'm supposed to use a three layer architecture in the project. I'm working with C# in .NET and I'm also working on Windows Forms, and with the ...
0
votes
2answers
576 views

Storing a temporary data outside of DbContext in Entity Framework

I have a performance issue with a few methods in my Service Layer. Methods that are causing me troubles have some logic, but it's db connection that takes over 95% exec time. The problem is ...
0
votes
0answers
142 views

Integration Tests of Entity Framework's Fluent API

I have a project using EF6, that was build after the database, but its EF is not DB-first. It's a reversed code-first I would say. The database is very big and really messy, so I didn't want ...
1
vote
0answers
166 views

Create A Complex Resource Atomically With Nested Objects Through REST

Background: There is a UI Client and REST Webservice. The user interface form allows you to create a complex object. The complex object is composed of primitive types (string, integers,...), and ...
0
votes
0answers
28 views

Designing a Data Model For Climbing Gear Checked Out at Events

I am trying to setup an internal use asp.net core 2.0 application to check gear in and out at climbing events. The Model will go something like this: Category.cs (like ice, mountain, etc...) ...
0
votes
4answers
232 views

Avoid type checking but preserve separation of concerns

I'm working on an MVVM project and trying to preserve separation of concerns. Our current architecture has an entity framework model and MVVM light view and viewmodel projects. I'm working ViewModel ...
3
votes
1answer
429 views

Managing Database Access for MicroServices

We currently have a work stream where we are splitting out a Monolith into microservices and there has been a debate as to how we will access and persist data. To give you a good idea of how most of ...
3
votes
1answer
2k views

Generic repository pattern +EF and unit of work

I'm new to this Repository pattern and have seen lot of repository pattern + UoW implementations all over the internet and I'm not able to reach to a conclusion as to which of them is correct . After ...
0
votes
1answer
344 views

What is the best practice for API endpoints for an entity?

I don't know if the title is reflecting the question correctly, but I can explain more than write a good title. If I have a database that has (employees, departments, orders, etc...), and have ...
0
votes
4answers
548 views

Concurrent database access on shared network drive

I'm part of a small team that currently uses an Access database for scheduling a larger team's availability. This has presented some issues with corruption of the Access database. Additionally, I want ...
1
vote
0answers
673 views

Best practice for transaction handling using Entity Framework

I am developing an app which uses Entity Framework for data access. The architecture of the app somewhat like below: As depicted in the drawing, the business service can be consumed from either web ...
1
vote
1answer
202 views

Questions about business logic layer and data access layer in a project

I would separate the BLL from DAL as a best practice. I interact between BLL and DAL via interface. Example: public interface IProductRepository { void Add(Product myProduct); Product Get(...
0
votes
0answers
81 views

Tool to automatically implement Repository pattern from database

I'm looking for some kinda of tool, that will help me to code DTOs based on my database. I know, there is an automatic tool, provided by VS I don't want to use it. I'm not a big fan of "auto-generated ...
-1
votes
1answer
105 views

Connect to different database based on URL

I am developing a SAAS application where : A single web application is hosted in IIS which will serve to multiple companies and each company will have its own database. The web application and ...
0
votes
2answers
82 views

Best practice loading entity with related entities

I am trying to figure what the best practice with loading data from web apis is. Assume you have a model structure as per below: class School { private string name; private List<Classroom> ...
0
votes
1answer
39 views

Is a InMemoryDatabase suitable for store live data?

I'm learning ASP.NET Core 2, with Entity Framework Core. A real use-case scenario is a small management of a production process. I have some persistent table like customers, orders, machines, etc... ...
2
votes
1answer
811 views

Table Per Concrete Type in Entity Framework Core

I'm trying to port code from entity framework 6 (EF6) to entity framework core 2.0 (EF-Core) and have ran into a dead end. In my EF6 code, I have a base class called Record which defines the base ...
2
votes
1answer
177 views

Entity: Inherit class (or interface) or write the code

I want to figure out if its better to inherit a base class or interface or write the code up for entities. To better paint the picture assume the scenario below: Scenario: There are 30 entities All ...
-5
votes
1answer
315 views

Microsoft Entity Framework - when to use it? [closed]

I am researching Microsoft entity framework and I am confused about when it should or should not be used. I am interested in the relationship between entity framework and product management ...
3
votes
1answer
4k views

Dependency Inject DbContext into MVC Controller

I'm having some concerns about injecting my Entity Framework DbContext into my MVC controller. Below is a sample of my code. The way I designed this is so that I can better unit test my Controller ...
1
vote
0answers
251 views

Multi-Tenant & Multi-Object Permision Suggestions

I am looking for suggestions/examples on how to setup permissions for my project. I am using ASP.NET Core 2.0 with EF Identity 2 (on one server) and will be using IdentityServer4 (secondary server) as ...
0
votes
3answers
143 views

Designing a CMS. When to use interfaces properly and dependencies and layering

I am building a CMS and need guidance on how to structure the application. I simply do not understand when I should use interfaces or an abstract class. The system being built is using .Net Core and ...
1
vote
0answers
277 views

Moving Role CRUD operations from the Controller to the Application Service

I am creating an administration facility for an asp.net MVC application. I am currently trying to create a form that will allow admin users to create roles. I see plenty of code, which looks like ...
-2
votes
1answer
667 views

How do I use the same entities in multiple projects with the entity framework?

I have to create two different projects with the Entity Framework: Web API Services UI and Business Logic (MVC). Both the projects have to work with same POCO entities. I see two alternatives and ...
0
votes
0answers
309 views

C# EntityFramework 6 DbContext and data service with dependency injection

I am refactoring an application that collects and displays measurement data that is stored in a database. Currently I have an interface calleIMeasurementsDataService and an implementation ...
1
vote
0answers
698 views

Entity Framework naming conventions for the same table name across multiple schemas

The DbContext of my application's Entity Framework setup (which I will refer to as ApplicationContext, the name of our derived type) contains classes for all of the tables in our SQL Server database, ...
2
votes
1answer
599 views

Avoid core layer referencing DAL when defining repository interface

I'm trying to learn the N-Layer architecture and several other things, and I have a C# solution where I have the following layers: Core/Infrastructure (Folder) Core (Project) ...
2
votes
1answer
80 views

Reattachment of full entity graphs for frontend/backend applications which communicates using REST API/JSON?

I am trying to develop business application with separated backend (persistence, business logic, server side workflows) and frontend (presentation, some business logic) which communicates using REST ...
0
votes
1answer
134 views

Generate GUID in each respositories create method?

Say I have a bunch of repositories: CustomerRepository(); SalesRepositor(); EmployeeRepository(); etc Say each one of these has a create method e.g.CustomerRepository could be: public void Add(...
0
votes
1answer
137 views

EF6 - how to keep track of what's changed when objects are mapped?

In a DB-first EF6 application, we have a data access layer which handles all the interaction with EF. The objects pulled from the context are EF-generated C# classes, these are then mapped to ...
1
vote
2answers
425 views

Entity Framework - Is it bad practice to work with IDs at Business Logic level?

I've recently come across an EF6 application where the logic is driven heavily by the use of IDs, something I hadn't seen before. Once an entity is loaded by EF at the DAL, it is mapped to another ...
0
votes
1answer
266 views

How to design an Excel export class in MVC?

I have a pretty badly designed system on my hands right now written in ASP.NET MVC. It does have a lot of logic implemented inside controllers without any outside models with business logic. I would ...
0
votes
1answer
295 views

How should I organize common linq queries (or even SQL queries)?

I use the Entity Framework. Let's say I have a realy complex linq query, that I need in multiple parts of my application, some services, some controllers. Is there any design pattern I should follow? ...
0
votes
0answers
615 views

What is best practice for handling a DbContext in an ASP.MVC app?

I am in the currently process of writing an ASP.NET MVC app with Entity Framework which ultimately will be a web browser game with a Microsoft SQL Server backend to handle storing of games being ...
1
vote
0answers
1k views

Storing entities with mapped many-to-many relationships

When developing a many-to-many relation I create 3 entities: Car, Part and a CarPart which contains the lists of both entities. On the client-side of the application I want to be able to directly ...