Stack Exchange Network

Stack Exchange network consists of 175 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

Questions tagged [asp.net-core]

ASP.NET Core is a lean, composable and cross-platform framework for building web and cloud applications. It is fully open source and available on GitHub, and is currently in version 1.1.0. ASP.NET Core can be run both on .NET and .NET Core, and can be hosted on Linux and MacOS under .NET Core.

4
votes
1answer
59 views

Unit testing extension method adding view location expander

Introduction I'm writing unit tests for an extension method I wrote. Its only purpose it is to wrap startup logic which extends ViewLocationExpanders list by an ...
2
votes
0answers
62 views

Create an isolated dependency scope with “overrides” in Asp.Net Core

Some of the classes in my multi-tenant Asp.Net Core application depend on database repositories which in turn depend on a delegate called GetCurrentTenantKey. In ...
2
votes
0answers
39 views

WebAPI: Async Filtering CSV content + Json/XML Serialization

I am coding a csv file filtering api in ASP.NET Core, which takes a csv file located at a given uri (and retrieved via the query string) convert the content to a collection of records, then apply a ...
3
votes
0answers
32 views

Controller in an ASP.NET Web API application which generates a CSV file

I have a controller in an ASP.NET Web API application which generates a CSV file. The controller looks like this: ...
-2
votes
1answer
56 views

AspNetCore - Injecting a Func<T> [closed]

I have an ASP.NET Core controller I am creating. The controller endpoint looks something like this right now: ...
4
votes
0answers
75 views

Safely executing background tasks in parallel in ASP.NET Core

Context and initial idea I'm trying to teach myself the CQRS and Event Sourcing patterns by developing a simple ASP.NET Core application, loosely following Greg Young's example CQRS implementation on ...
0
votes
0answers
69 views

.NET core controller method to populate jQuery datatable of users and roles

I want to know whether I am following the best practices of using jquery datatable with .net core. In Controller ...
4
votes
0answers
53 views

MVC Controller Error & Exception Handling .NET Core

I'm putting together a basic web app in .NET core 2.1 MVC to try and better understand how it works. Currently I'm working on returning validation to the UI. Once I have this working I then want to ...
4
votes
1answer
63 views

User controller for a .net core WebAPI dating app

I have this user controller that follows the repository pattern. It works perfect, but is it easy to understand? Is this good quality work? ...
1
vote
1answer
58 views

Passing restored packages as artefacts in GitLab Continuous Integration

Introduction I'm writing a script in YAML for building ASP.NET Core 2.2 project using GitLab Continuous Integration. In all YAML samples I could find (and there are not many) for building .NET Core ...
1
vote
0answers
28 views

Transparent proxy using HttpClient

I'm looking for feedback on some code I've written to work as a transparent proxy. I'm developing a web app that needs information from another web site's API, but that web site has disabled CORS and ...
4
votes
2answers
138 views

Generate secure URL safe token

...
1
vote
0answers
28 views

Modeling the Aggregates in the following Bounded Context - Domain Driven Design

I'm currently developing an application in ASP.NET Core 2.2 with Domain Driven Design. What you see in here is a Unit Creation page. A Unit is composed of competences. A unit must have at least one ...
3
votes
0answers
80 views

Auto register Func<T> for .net core dependecy injection

The default .net core dependency injection doesn't support building Func<> for injection automatically, see question. I wrote an extension method to go find all the Func in register types ...
0
votes
1answer
40 views

Hide parts of menu based on user role

I have menu that contains links to sections of website: ...
2
votes
0answers
45 views

Conditional AsyncLock implementation

I have a case where I match data from DB by the various filters. Until the match is updated in the DB, I don't want to accept requests for matching with the same criteria, as this could produce ...
5
votes
3answers
465 views

Length units converter

I am creating a very small application to demonstrate solid principles and also a brief implementation of a builder pattern, does anyone have any feedback as to how this could be improved or how it ...
2
votes
1answer
79 views

Repository of trainers

This is my first asp.net core web api and i did followed the Repository pattern but i don't know whether this approach is good practice. ...
1
vote
1answer
142 views

Extracting a list of objects from a repository as JSON

Currently, I am using the below code to make JSON data from list of objects. ...
2
votes
0answers
57 views

A custom session with transaction support using Dapper

I wanted to write a custom session to act as proxy for a Dapper connection that could support transactions without having to expose any other DB related entities. At first, I thought of opening a ...
0
votes
1answer
111 views

Asynchronously fetching data from the database

The following C# code is written to fetch the Categories data from SQL Server Database using Asynchronous Task for HttpGet. The Dapper library is used as ORM. I ...
1
vote
2answers
393 views

Creating an instance of an unit of work (NHibernate)

I'm trying to figure out how to create a NHibernate UnitOfWork using .NET Core Dependency Injection. I was just hard-coding the ...
3
votes
1answer
2k views

asp.net core - get User at Service Layer

I use ASP.NET Core 2.1 and would like to fetch User at a service level. I've seen examples when HttpContextAccessor gets ...
5
votes
2answers
137 views

Filter Producs by any property

I have Products table which looks like this: I have some data in this table and I want to filter it depending on this columns (Filtering with columns type of string isn't problem). For this I have ...
2
votes
0answers
131 views

Choosing which PDF preview to generate

I have a single controller that has two methods. One generates a PDF preview [GeneratePDFPreview] and then ultimately an actual PDF document [GeneratePDF]. It uses the Rotativa library to generate the ...
2
votes
1answer
108 views

Design Pattern for initializing Properties of a ViewModel which only serves a display purpose

It's a question which lies me for years on the tongue. Given a LoginViewModel: ...
8
votes
1answer
81 views

Shopping cart purchase method in service layer

The following is a class in the service layer of an ASP.NET Core web application, which currently contains a single method: PurchaseCart. The intention is that an ID is passed in to a "shopping cart" ...
0
votes
2answers
1k views

Is it fine to use my domain model as DTO (Entity Framework Core)? [closed]

I was reading about anemic data models and rich domain models in DDD. I don't want to follow DDD completely but take rather pragmatic approach and just take some concepts out of it because clean ddd ...
6
votes
0answers
291 views

Playing Checkers

Continuing with my web-based checkers game, this question is about the actual playing system. I'll ask for a review on my UI system in the next post. First, my BoardController.cs. Note that I have ...
4
votes
1answer
1k views

Linked List implementation Entity Framework Core

I am trying to create a data model where there are Document entities, which need to be in a defined order to each other. Think of an article that has sections which ...
2
votes
1answer
493 views

Tag helper to add class if the model is invalid

I need to add a specific class to the input if the model is invalid ValidationErrorClassTagHelper.cs ...
3
votes
1answer
618 views

Notification system

I would like to implement a mail notification system Notification.cs ...
2
votes
1answer
276 views

Web Service that gets data from multiple tables in a database using EF Core Database-First approach

I have never created a web service before. I followed most of this Pluralsight tutorial to give me an idea of how to create one using ASP.NET MVC along with .NET Core 2.0 and Entity Framework Core. ...
3
votes
1answer
583 views

XML design for parsing in C# [closed]

I am trying to design XML with configuration info so I can parse it into this code: ...
5
votes
2answers
2k views

Load ASP.NET Core plugins and their dependencies

I'd like one of my RESTful services to support plugins. Currently it uses references hardwired at compile-time. The Application Parts seem to be THE solution so I gave it a try and created a small ...
0
votes
1answer
259 views

Configuring certificate signing for development and production environments

The below code works but there's a lot of duplication I wonder if I can get around. I would like to be able to use .AddDeveloperSigningCredential(false) if in ...
5
votes
2answers
120 views

Middleware for sending PartialViews via email

After all partial views are rendered and all styles are inlined my RESTful service is sending them via email. I implemented this feature with a MailerMiddleware. ...
1
vote
1answer
358 views

TagHelper for class inlining

I'm building a RESTful service that sends emails with body rendered by partial views. It replaces my old solution that used hardcoded templates of IHtmlElement ...
1
vote
1answer
67 views

Controller with TemplateService

I am working on my template web api project. I just wanna hear any suggestion how to improve this code. I heard that repository pattern is anti pattern so I want to make code without it. Any opinion ...
2
votes
0answers
2k views

Using IServiceScopeFactory without implementing the Service Locator Pattern

I want to use IServiceScopeFactory in a way, which is not the Service Locator anti-pattern. Therefore I thought about making a generic one, which supports ...
4
votes
1answer
6k views

Adding extension methods to IServiceCollection in ASP.NET Core

I have the following extension method to add themes support to my application: ...
7
votes
1answer
410 views

Computing a hash value of a file

I am trying to see if there is a more efficient way of creating a hash of a file of unknown size (could be gb). My code below works fine but I am sure there is a more efficient way of achieving this. ...
2
votes
1answer
82 views

Class hierarchy for informative exceptions in ASP.NET core

I have a base class called ExceptionPlus(please suggest a better name). Which is being inherited by multiple child class like BusinessNotFoundException, ArgumentInvalidException etc. My question is ...
1
vote
0answers
349 views

ASP.NET Core basic login implementation

I'm fairly new to ASP.NET Core, I've used webforms for years so I naturally want to cling to things I did with webforms. The following code works, but I'm wondering if it can be cleaned up with ...
2
votes
1answer
181 views

Service for querying resource availability, following DDD

I'm writing a service (asp.net core) in charge of determining availabilities of resources (rooms, desks...). I'm also trying to stick to the DDD principles to improve the quality of my code. I have ...
3
votes
0answers
270 views

.NET Core MVC - Future proof Hashing of passwords

I have written a Helper for Hashing passwords in .NET Core. It should have the following constraints: Future proof (It should be possible to upgrade the Hashing Engine to support Legacy and New ...
2
votes
1answer
754 views

Enum synced with Database

Our database has several tables that have a value that can be one of 4 things, so we made these columns instead have an id column with a foreign key to an enum table with an id and a value column to ...
1
vote
1answer
171 views

Perform n mongodb updates at a time using SemaphoreSlim

I have a queue of jobs, and I want to process 20 at a time using asynchronous concurrency. When processing a job, some updates in MongoDb are made an a file gets uploaded to a server, that's up to ...
2
votes
0answers
961 views

wcf service client wrapper for asp.net core

My goal is to grab some data inside asp.net core app on server from external source via wcf service. In future i would like wcf responses to be cached on server and provide asp.net app clients "normal"...
5
votes
2answers
3k views

Insert array items into jQuery / JavaScript variable

This code exists in my view; it makes use of a model passed through from the controller. ...