The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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.

Filter by
Sorted by
Tagged with
8
votes
2answers
119 views

Wordpress RSS Parser

Follow Up to my earlier question. This is an RSS Parser intended only to parse the feed Wordpress provides (and even then, only what I actually want to display on my website). ...
8
votes
1answer
95 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" ...
7
votes
2answers
1k views

A controller on a .net core API

BACKGROUND I am working on a .Net Core API to drive a lyrics application. Users can sign up, submit artists & lyrics, and earn kudos / XP points in the process. Basically a community-driven ...
7
votes
2answers
9k 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
493 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. ...
7
votes
2answers
8k views

ASP.NET Core singleton acting as an HttpClient provider

I have created an ASP.NET Core singleton service class to act as an HttpClient provider after reading that reusing an instance of HttpClient is encouraged. However, I also want to be sure that the <...
7
votes
1answer
451 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 ...
6
votes
2answers
134 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. ...
6
votes
1answer
581 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 ...
6
votes
2answers
68 views

Getting Authors and Books from a simple database

I have simple database with many to many relations. I wrote simple method GetAuthors() ...
5
votes
3answers
736 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 ...
5
votes
3answers
12k views

Return XML file from Web API

I have a HttpGet method which returns XML file: ...
5
votes
2answers
147 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 ...
5
votes
2answers
9k views

Proper way to work with stored procedures in Entity Framework Core

I need to work with stored procedures, with the help of Entity Framework Core. This is my function: ...
5
votes
0answers
186 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 ...
5
votes
0answers
878 views

OAuth2 login for ASP.NET Core without local accounts

I am using OAuth2 for users to sign in with their Google Account and authenticate Google API requests. I have not used the built-in ASP.NET Identity provider because this requires an app database of ...
4
votes
2answers
599 views

Generate secure URL safe token

...
4
votes
1answer
98 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? ...
4
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. ...
4
votes
1answer
85 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 ...
4
votes
1answer
81 views

Asp.net networking/restclient layer

I have been working on creating maintainable networking layer for our Asp.Net Core Web Api project. Right now I have created Generic methods for Get, Post, Put like this. ...
4
votes
1answer
4k 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 ...
4
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 ...
4
votes
1answer
809 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 ...
4
votes
1answer
2k 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 ...
4
votes
0answers
61 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
0answers
3k 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
0answers
8k views

Logging into Database with ASP.NET Core

In the Startup.cs of my ASP.NET Core application I want to configure the LoggingFactory so that it logs into the database. ...
3
votes
1answer
586 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: ...
3
votes
1answer
882 views

Notification system

I would like to implement a mail notification system Notification.cs ...
3
votes
2answers
528 views

Implementing unified API data flow in ASP.NET Core

I have the API project on ASP.NET Core, and it's quite annoying always write methods like this: ...
3
votes
2answers
153 views

Submitting a form

I am using ASP.NET core entity framework. I am using an input submit button to call a method that has a variable attached to it. I am wondering if there is a way to improve my code. Here is my ...
3
votes
1answer
1k 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 ...
3
votes
1answer
48 views

Sub-Middleware like options builder for an Asp.Net Core Middleware

Building upon a recent question I answered here Simple middleware pipeline builder (similar to asp.net-core) I came across a cross site question Stackoverflow: Adding middleware in Carter ...
3
votes
1answer
80 views

Deserialize with LINQ query code in PageModel or PageView

Today I do something like this, where I get, select and sort some data and pass it on to the view (which loads a partial view) as a list of custom objects Page model ...
3
votes
1answer
60 views

Logic is stored in Components that receive input data and update output data via Observables

I have C# ASP.Net Core Webapi application that makes some calculations for physical models. I have this project class: ...
3
votes
1answer
972 views

WebSocket API that connects to ASP.NET Core Backend

I'm writing this API that connects to my ASP.NET Core Cloud App and listens for potential Database changes from my CMS. The code runs and works fine but I'm not sure if my code is considered "good" ...
3
votes
1answer
381 views

Handling signout flow

There is backend which connects with IdentityServer using WsFederation. The backend is .NET Core project where there is a ...
3
votes
0answers
346 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: ...
3
votes
0answers
1k views

Using websocket to show progress for slow action with ASP.NET Core MVC

I have a process that takes a substantial amount of time (several minutes) and would like to trigger it from a web browser and give feedback to the user that it is working. I created some code that ...
2
votes
2answers
476 views

Download a file given an url to a restricted area and a cookie container

I have a queue of jobs in an ASP.NET CORE Application. Each of the files are in a restricted area and I have to Login first, thats why I use a Cookie Container for my download request. The Job is ...
2
votes
1answer
43 views

Posting images from request to Azure blob

I have base Controller for Attachments, here is code of it In this controller, I pass data from the request and return URL of the posted object. ...
2
votes
1answer
680 views

Using constructor dependency injection in a custom mapper class

I am quite new to DI and its patterns so I decided to place my code for some review. I am working on an digital map application using .NET Core 2.0. I am using the standard DI framework of ASP.NET ...
2
votes
1answer
93 views

Removing a specific key of ModelState for a specific controller's method

I have a controller for Post and Put request for the same entity: MyModelDTO with some ModelState's attributes. The users can make a ...
2
votes
1answer
47 views

API endpoint that returns phone numbers

Background An API endpoint that returns phone numbers. I would appreciate some feedback on this very simple service class that is part of the overall solution. Here is its Interface: ...
2
votes
1answer
139 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: ...
2
votes
1answer
832 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 ...
2
votes
1answer
464 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 ...
2
votes
1answer
211 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 ...
2
votes
2answers
964 views

Injecting the Repository into the business layer

I am developing an application using Asp.NET core with MVC framework. I would like to ask your opinion about whether I inject my repository in a good way into my business layer. First of all, lets ...