Questions tagged [asp.net-mvc]
The ASP.NET MVC Framework is a Microsoft web application framework that implements the model-view-controller (MVC) pattern.
557
questions
0
votes
2
answers
329
views
Mediator Pattern in c# - using a mediator to trigger policies
I'm wondering how i can implement what Im calling "business policies" in my code? For discussion purposes, let's say I have two separate contexts - synchronizeUsers and Licensing.
The ...
-3
votes
2
answers
998
views
Chose between .net 4.8.1 and .net core 6.0 . is the support life cycle an important factor to consider
I want to start developing a long-life ERP system to a customer. now on paper I would chose to develop it using .NET core 6.0 with SQL Server. But one of the main drawbacks which the customer did not ...
1
vote
0
answers
65
views
ASP.NET MVC use ViewModels with Services
I'm trying to make a simple Blog-application, but I'm a bit stuck on the architecture of the application.
I'd like to create a details-page with the content of the blog-post and a form for adding ...
-1
votes
1
answer
1k
views
How are parameters values passed into a MVC controller constructor?
For this MS sample code, I have checked Program.cs, Startup.cs, and other config files, don't see how the two parameters sqlQueryService and sqlCommandService are populated. Appreciate if someone can ...
1
vote
1
answer
945
views
Mapping between Entity and ViewModel
I'm trying to make an application in ASP.NET MVC.
I'm using AutoMapper for the conversion between entities and ViewModels.
In most cases, this works fine, but when I need to add some additional data (...
0
votes
2
answers
397
views
Best practice ASP.NET MVC share code with Web API
I'm trying to develop an ASP.NET MVC-application with an additional Web API.
To reduce code-duplication, I'd like to share as much code as possible, but with the possibility to differentiate between ...
5
votes
2
answers
913
views
Best way to refactor service with too many dependencies
We are creating the backend for a web app using a sort of layered architecture. The service layer is supposed to handle the business logic and passing data to the repositories. This service layer is ...
2
votes
1
answer
480
views
In an MVC Application, What Goes Where?
In an Model-View-Controller (MVC) design pattern, What goes where? What code goes to model and to controller?
I know (do I?) that business logic should be define in a model, but a lot of example I ...
-1
votes
1
answer
46
views
Looking for way to store, get, partially update few relatively small JSON documents which has different unique types
I have an app with many individualistic features which behavior is controlled by settings.
Let's say these are a few utility services with the following settings that are historically stored in ...
1
vote
1
answer
2k
views
How to unit test public method which internally calls many internal or private methods which are already individually unit tested [duplicate]
In our ASP.NET Core application, we have many APIs which are calling public method from the service class. Service class is implementing an Interface. Each service method (depending upon complexity ...
3
votes
2
answers
1k
views
Why do backend web frameworks use "MVC" when they have no persistent UI to update?
Model View Controller (MVC) is focussed on UI based applications. In MVC the model notifies the UI (view) when its values change and the view then decides what and if to update. I can understand this ...
0
votes
1
answer
161
views
Monolithic view model MVC
Currently working on a legacy app. One section deals with generating "reports", each which share some common subsections, that are based on strongly-typed razor partial views. The largest ...
1
vote
3
answers
350
views
Is creating an entity in a database considered to be business logic?
According to my (perhaps incorrect) understanding business logic includes saving/updating entities in the database, as well as connecting with any 3rd party API's or using services and should ...
0
votes
1
answer
1k
views
Right way of folder structure in MVC Project
I'm building a project with C# AspNet.Mvc. I'm using Entity Framework Core. It has Poco which maps in data from DB. On Mvc project itself i've got ViewModels folder where i have models topass between ...
-1
votes
1
answer
54
views
Checking caller has access to an API resource - Design
We have a managers api (/api/managers/-/staff), which will get a list of staff that the currently logged in manager has been granted access to. It is the Managers service.
We also have a staff api (...
5
votes
1
answer
3k
views
Moving shared CQRS/Mediatr Request Handler logic into services and avoiding code/logic duplicity?
We recently embraced Clean Architecture and CQRS, by way of Mediatr, in several of our new applications. A similar (SPA-based) demo can be seen here. For many of our WebApi-based projects, this worked ...
2
votes
3
answers
541
views
Is this approach with JWT tokens wrong?
I have .NET Core WebApi application with JWT token for authorization. I also have roles and permissions.
To make it more flexible for end user, I decided to make permissions like this:
[Authorize(...
1
vote
2
answers
7k
views
How to retrieve a device information (e.g. device name) via web page
What we want to do is very simple
We have a check-in kiosk website (C# ASP.NET MVC), and we are trying to set up 30 kiosk stations at each building (each building is about 200 ft away from each other)....
0
votes
0
answers
59
views
Integrating Blazor Client side into an ASP.Net MVC Core 3.1 app. Is it logical or am I better off building new Blazor app from scratch?
I am in the middle of a project building an internal admin web site using Asp.Net MVC Core 3.1
Some of the features I need in the app could benefit from Blazor Client side. (Single Page App features?)...
6
votes
3
answers
11k
views
Is unit of work pattern really needed with repository pattern
I am trying to use EF6 with my project. I just watched Repository Pattern with C# and Entity Framework, Done Right | Mosh video. I understand the necessity of Repositories but I still don't understand ...
0
votes
1
answer
2k
views
Is it good practice to save an entire ViewModel in Session (C# ASP.NET MVC)
I have an C# MVC Application which is basically a large application form. We are using a large ViewModel to store all the information the user enters as they pass through multiple steps in the ...
-1
votes
3
answers
529
views
Using a separate desktop application for handing scheduled tasks in an ASP.NET MVC Application
I have an ASP.NET MVC application and I will need to execute a task every one minute.
The task is:
-> Go to database
-> Check from Table 1 if a record has value = "something"
-&...
0
votes
3
answers
5k
views
ASP.NET MVC - Using Session Variables or Caching to prevent unnecessary calls. Is it a good practice in general?
I have an application that consists of multiple sections of which each section will need to load data from various API calls.
Now I'm thinking of taking advantage of Session variables(or caching) to ...
-1
votes
1
answer
184
views
How shall I implement a MVC program into presentation, business logic and data access layers?
Here is part of an ASP.NET MVC program, from https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/controller-methods-views?view=aspnetcore-3.1 :
A model class Movie:
public class ...
0
votes
2
answers
59
views
where to put presentation data formatting method
I am trying to display a specially formatted dropdown list as part of a view. I have a controller action which fetches the data for the dropdown, then needs to format it by fetching certain other ...
1
vote
1
answer
648
views
Does Asp.Net Identity worth the overhead?
I'm creating web applications using Asp.Net Core Identity with N-Tier architecture. Lately I've been discovering many properties of this library that I didn't know before as I need to configure the ...
0
votes
1
answer
247
views
Using WebAPI as infrastructure layer in ASP.NET MVC
I'm starting a new asp.net mvc core project and for my infrastructure layer I'd like to use WebAPI as this layer should be usable in other solutions besides this one.
I'm not really experienced with ...
0
votes
0
answers
272
views
Is it the right pattern for Razor Pages' private methods to return IActionResult to handler?
Is this a good code pattern in ASP.NET Core Razor Pages, for private methods to return IActionResult to the calling handler?
// Public handler
public IActionResult OnGet()
{
var result = ...
1
vote
2
answers
312
views
Class property re-use vs redundancy
TL;DR - When designing classes for MVC use, is there "best practice" for how classes should be structured to eliminate property duplication and/or redundancy? I'm trying to avoid large (one-size-fits-...
-2
votes
1
answer
557
views
MVC Routing (attribute routing) and project structure
how would i organize my project structure, areas or folders to
support logical grouping structure within my project.
www.mysite.com/org/{dynamic}/Importer/{controller}/{action}
Currently i have two ...
4
votes
2
answers
824
views
Multiple Applications, how to bring them together?
I have 7 different .NET Core applications (solutions). All supporting a different workflow such as customer request, request for change and much more. However, they do share a similar goal (that is to ...
1
vote
1
answer
107
views
Best practice for multi-application communication and events?
Essentially, I have a web application and a console application. The web application allows users to configure what will be processed, which is just a big information processor. From the web UI, a ...
0
votes
0
answers
260
views
DDD with web api, how to correctly display error messages that caused by domain to the client?
I asked a question about duplicate validation in domain or application layer.
Now, I decided to put all the business rules in the domain layer.
I have a value object like this, it has a method for ...
5
votes
1
answer
3k
views
DDD with web api, validation in domain or application layer?
I saw a lot of discussion, but I don't know how to do it in a real world.
I understand that validation duplication in the client and server is needed.
But how to elegantly validate in server and ...
2
votes
2
answers
816
views
What do I misunderstand about the mediator pattern?
I decided to use Mediator Pattern (with Mediatr) to call my application layer.
It's cool and I got how to work with it sometimes, but sometimes I get confused.
For example, when we publish a document ...
1
vote
2
answers
314
views
Downloading and appending data from AWS S3 whilst avoiding clashes
I have to upload a TSV file to an S3 bucket, the content is form submission data. Another service will consume and do things with this data as soon as possible. The service would like one large file ...
6
votes
5
answers
3k
views
Is it valid to let view models populate their own lists for dropdowns in mvc?
I've struggled to find any discussion on this.
If you have a simple MVC page for updating a User, and you put a dropdown list on it of Country, you need to populate the dropdown list in the viewmodel....
0
votes
1
answer
1k
views
Where to store calculated values of an entity
Trying to figure out the best place to store calculated properties related to a base entity class for use through out the application, namely in view models and DTOs.
For example, a base entity class ...
0
votes
2
answers
340
views
Building Client Specific Application on Top of Standard Application
I have a standard application and in this case, it is an Accounting ASP Net MVC application. Now, I have a new client that has their own specific requirements like other fields and some custom ...
1
vote
1
answer
2k
views
Simple Audit Logging Design
I have a C# MVC application. One of the requirements of the application is to maintain an audit log of everything that happens to a particular 'entity' page. To make the example concrete, lets say ...
0
votes
1
answer
176
views
Authorization & Profiles considerations for ASP.NET MVC Customer Portal
there's an up and running self-serve customer portal built that I'm trying to make a bit better when it comes to displaying proper items for different client types and auto-logging users. Here are a ...
1
vote
1
answer
116
views
Should all my asp.net MVC controllers use Web APIs?
The thing that I don't understand is the prioritization between MVC Controllers and Web APIs.
Consider I want to make a website. I can either program to APIs and for the presentational layer, force ...
5
votes
4
answers
2k
views
Clean Architecture - What is the difference between Use Cases and Core Services?
I'm trying to apply Clean Architecture to a simple ASP.NET MVC Core app by following Microsoft's ASP.NET architecture guidelines and their eShopOnWeb sample project.
In the standard Clean ...
1
vote
4
answers
6k
views
How do you manage objects that are shared between back-end services and front-end services/apps?
I have multiple REST-ful APIs that I'm using as my "back-end". I also have multiple web apps (.NET MVC). These web apps make calls to the APIs for data. So, an object being returned by an API will be ...
1
vote
1
answer
356
views
MVC Controller calling UoW (unit of work) directly instead of going through Service Layer
Currently im injecting my Unit of Work inside the controller.
I figured out that in most of the designs, controllers calls the service layer and service calls the repository/DAL layer.
Most of the ...
1
vote
2
answers
458
views
Handling Authentication with both Web App and API
Not sure how to handle this. Our current app (.Net MVC) is accessed via companyname.appname.com, authentication is handled via forms (cookie) authentication.
Within the app there is a global search ...
3
votes
4
answers
1k
views
Is dependency injection always a best practice?
Recently I started working on a rather large monolithic system. The solution has web, app and api parts and in general just a lot of stuff.
It relies heavily on dependency injection and I noticed ...
6
votes
2
answers
4k
views
ASP.NET Core - Is using [FromServices] attribute bad practice?
I have a Controller in ASP Core MVC. I'm trying to trim down the dependency injected services in the constructor so I can start building unit tests more easily. However, I have some services being ...
-1
votes
2
answers
93
views
Is there an accepted way to track record metadata, CreatedOn/By etc?
I've worked with a lot of off-the-shelf systems and generally speaking they all, at a database level and above, have metadata such as CreatedBy/On, ModifiedBy/On etc against records/entities to give ...
-1
votes
1
answer
41
views
where to put business constraints
We have a 3-tier architecture: Web, Business, Models using the MVC pattern. Models are Code-First using EF6. Currently we access the dbContext directly in our Controllers to query and save changes. We ...