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
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. ...
3
votes
1answer
41 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
75 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 ...
0
votes
1answer
51 views

Is there a better approach to implementing Dapper with Mediatr?

I'm playing around with using Dapper with Mediatr in a .NET Core API. It's all working nicely. Its a learning project for me so I am just putting together a system that will hold user details ...
2
votes
0answers
45 views

Own Authorization attribute

In the existing system, we need to rebuild the user's authorization. The database includes Roles and Rights Roles were previously used but will be skipped in the new version All authorization will ...
1
vote
1answer
23 views

Optimizing calls for reauthentication by caching tokens and cookies

I am currently developing a REST service in ASP.NET Core 2.2 that acts as a wrapper upon a REST API provided by a reporting solution. The reporting systems REST API authenticates the user based on a ...
2
votes
1answer
53 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
0answers
40 views

Retrieve file and other input fields from JavaScript to send to ASP.NET Core

I am currently developing an e-commerce website where users can upload their photos to customise their products. The use case begins when the user selects a product from our website (e.g. shirt). ...
3
votes
1answer
57 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: ...
1
vote
1answer
43 views

Inter module communication

I have two modules, Notification which basically contains SignalR hubs and CoreSetup which contains core setup logic in it. I have a class in CoreSetup module which keeps track of employee location . ...
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: ...
-1
votes
2answers
77 views

Extending IdentityUser with nullable foreign key to another IdentityUser [closed]

I'm working on a framework which builds on .net core Identity. Let's say I wanted to extend the IdentityUser<TKey> class with a ...
2
votes
0answers
51 views

Querying based on condition

I am using Entity Framework Core as ORM in my ASP.NET Core 2.1 project. I want to perform server-side pagination in Career Controller for getting list of careers. I have a model which looks like: <...
6
votes
2answers
67 views

Getting Authors and Books from a simple database

I have simple database with many to many relations. I wrote simple method GetAuthors() ...
2
votes
1answer
669 views

ASP.NET Core Request / Response logging middleware

I am looking for feedbacks about my ASP.NET Core Request / Response logging middleware, in particular in ways to lower the memory footprint and string allocations: ...
4
votes
1answer
76 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
78 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
79 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
71 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
192 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
63 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
1answer
421 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
178 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
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
1answer
83 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
160 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
41 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
415 views

Generate secure URL safe token

...
1
vote
0answers
36 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 ...
5
votes
0answers
139 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 ...
1
vote
1answer
57 views

Hide parts of menu based on user role

I have menu that contains links to sections of website: ...
2
votes
0answers
59 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
583 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
85 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
202 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
93 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
297 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
585 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 ...
4
votes
1answer
3k 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
142 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
169 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
125 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
94 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
2k 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 ...
7
votes
1answer
410 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
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 ...
2
votes
1answer
749 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
808 views

Notification system

I would like to implement a mail notification system Notification.cs ...
2
votes
1answer
459 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
585 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: ...