Questions tagged [.net-core]

.NET Core is an open-source, modular implementation of the .NET Framework. It can be used in a wide variety of applications and verticals, ranging from servers and data centers to apps and devices. .NET Core is supported by Microsoft on Windows, Linux and macOS.

Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

Export csv file using asp.net core web api and react

I'm intend to create an export function that allow user to export filtered into CSV file. I worked on a sample using the following method ...
5
votes
1answer
123 views

Car Showroom Database: Taking user inputs and manipulating arrays

I've been learning C# for around 2 weeks and I'm feeling a bit more confident. I wrote this for general practice and am quite proud but hoping to make it faster and more efficient as I progress and ...
2
votes
0answers
56 views

Generic search service to filter entries in lists

I'm in the process of implementing a fully generic service to filter out entries (of any type), which are contained in a ICollection. As it is generic, without any ...
1
vote
0answers
69 views

Dependency Injected StackExchange.Redis Client

I am currently building cache for my application, and I would like to have my redis cache client work the same way you would dependency inject a DbContext. I am using StackExchange.Redis to manage my ...
1
vote
0answers
49 views

.NET Core Service/Console App Architecture

I have the following setup code for my .NET Core 3.1 console application/microservice app and I want to learn and improve what I have - I have a feeling I could be utilizing the core Microsoft .NET ...
2
votes
1answer
85 views

Vectorization, 7-bit encoding

I was curious how vectorization works and how to write suck code. To start simple I choose 7-bit encoding as my test suspect. I'm not expecting improved throughput in any way. My implementation works ...
3
votes
0answers
108 views

C# Rest Client Benchmarking

I build a C# Rest Client library / framework. I noticed that it seemed to be significantly faster than RestSharp for GET at least. So, I decided to put together some benchmarks comparing it to other ...
1
vote
1answer
103 views

String Split a phrase into sentences

Hello this is a Console App(.Net Core) in Visual Studio 2019 and i am trying to split a string into sentences and then add them into a dictionary with Key the first word of the sentence and Value the ...
5
votes
2answers
74 views

NewSequentialId - pure net core 2.2 implementation of sql server function

i'm currently trying to rewrite sql server newSequentialId() function in pure c# that is performing as fast as possible and eats minimum memory. Question is can I it be done better - current ...
4
votes
1answer
83 views

Prime Number Table, i.e. List<int>

I have written many variations of the Sieve of Eratosthenses, which is the fastest way to generate a large collection of primes. (@slepic asked for clarification, which I provide in an answer below. ...
5
votes
0answers
90 views

Using ClientFactory-pattern with Dependency Injection

I initially posted this on Stackoverflow but was recommended to try here instead. I'm looking for feedback on why the implementation of my ClientFactory is probably bad, from a Dependency ...
4
votes
1answer
284 views

Dapper “async” and “await using”

I have been building my data access layer and performance is key for the project I am working on. I have chosen to use Dapper and dotnet core 3. I want to make use of the latest and greatest async ...
3
votes
0answers
68 views

ASP .NET Core DI: Dependency on single implementation of multiple registrations of service type

Problem I have a DI scenario where I have multiple classes that implement a common interface (IModelService). I'm using a generic framework class (...
3
votes
1answer
59 views

Formatting a type's name

I'm writing a code generation library, I've exposed a couple of methods and of course in order to define a member you need to specify it's type, the easiest way is to use ...
1
vote
1answer
38 views

Small service for hashing and validating passwords, using PBKDF2

As part of a larger authentication/authorization system, I've developed a small .NET Core 3.0 service for hashing passwords using PBKDF2 (with a salt) and validating passwords against a stored hash/...
12
votes
4answers
2k views

C# Toy Robot Simulator

I did this coding exercise for a potential employer who failed it on the basis of unspecified style and structure issues and would appreciate any thoughts on what flaws this contains, in particular in ...
2
votes
1answer
78 views

Hosted service which perform CRUD operations in high update environment

I have this hosted services which garbs the data from the API and save it in the database. But before saving it checks if the data already exists in the DB if not it creates the new row and if it ...
5
votes
1answer
390 views

Simple HttpClient usage for integration tests in .NET Core

I have this simple setup for a .NET Core project which is just a very basic HttpClient usage to do some simple integration tests to a RESTful API. For now the test project remains separated from the ...
8
votes
5answers
2k views

Bidirectional Dictionary

The management of bidirectional mappings is a reoccuring topic. I took the time to write an (hopefully) efficient implementation. ...
6
votes
0answers
107 views

Single-threaded fully asynchronous server, with a SocketSelector that dispatches events

I need a fully asynchronous single-threaded server written using .Net Core. Searched for options and, surprisingly, did't find any. So I decided to write a simple prototype. Borrowed idea from python'...
2
votes
0answers
43 views

F# XML Generation in .NET Core: XmlSerializer or XmlProvider

I am working on SEPA XML generator in F#. I developed two solutions that are roughly equivalent, one relies on the XmlSerializer while the other relies on ...
12
votes
5answers
751 views

Reducing contention in thread-safe LruCache

I was looking for a in-memory cache class, but couldn't find any in the .Net Core framework; luckily I found one already implemented here. I made some minor modifications to it and tried to make it ...
1
vote
1answer
67 views

Idiomatic way to write proper F# (x)unit + fsunit tests?

I am writing some unit tests using XUnit in F# and I am wondering what is the most idiomatic way in the F# sense to write them. Let's start a simple case: ...
2
votes
0answers
61 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 ...
2
votes
2answers
410 views

Geektrust: Modelling Family Relationships in a OO way

I'm trying to model family relationships in a OO way, i.e. As we update the relationships between two individuals our model must be able to find the people given a person and the type of relationship ...
2
votes
1answer
83 views

Periodically sending data from database to an API

I'm trying to make a timed background service in .NET Core (I found this approach in Microsoft Docs), that every 15 seconds it gets data from the database (1000 rows max, if something exists) then ...
3
votes
1answer
3k views

Get all children recursively in Entity Framework Core

In Entity Framework Core we can have recursive entities. But we cannot do an "Include" for these recursives (can we?). So I wrote a Get-method that does it for me: ...
-1
votes
1answer
82 views

Huge performance difference: PowerShell Core vs. 5.1 [closed]

Recently I have answered another question about performance. A solution found using PowerShell-ISE successfully, and good speed testified using PowerShell Core. However, running the same script(s) in ...
1
vote
1answer
151 views

Memory policy with ArrayPool<T>.Shared

i've recently released a from scratch set of library Astron, and I wanted to get my memory policy logic reviewed.(you can find a little doc about it here). My first goal was to provide an extandable ...
7
votes
1answer
389 views

Usage of TPL vs Parallel.ForEach() on file processing

i've been working on an implementation of a my own from scratch set of library Astron and I wanted to get my TPL usage reviewed because i'm not confident with this technology :/ My app is currently ...
3
votes
1answer
130 views

Building QueryString from custom object

I have a custom object that is based in the following models: ...
3
votes
1answer
2k 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: ...
1
vote
0answers
77 views

Persist payload containing multiple items using EF Core Performance Improvements

I have an .NET Core EF application, setup as Database first, that is supposed to take in a payload containing items to be persisted to my database. They payloads can be huge containing multiple "...
1
vote
1answer
199 views

IEnumerable<T> async serialization

I am building some classes to serialize (in an async / await way) potentially pretty long ...
-2
votes
1answer
71 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: ...
2
votes
1answer
701 views

Include Serilog sink requiring dependency before dependency injection in .NET Core

Here is a rundown of the situation This is a .Net Core (2.1) application with a console and web front ends. For simplicity this question focuses only on the console end although the web end has the ...
0
votes
0answers
268 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 ...
3
votes
0answers
49 views

Generic library for querying various kinds of databases

Since C# 8 and .Net Core 3 are going to be released sometime this year, I wanted to try and convert the library I made to make querying databases easier, implementing the already accepted features (...
2
votes
1answer
59 views

Revision: BinaryTree<T> written in C#

Since my last question (BinaryTree<T> written in C#), I have rewritten my code based on the responses. My project can be found on my GitHub repo here; ...
11
votes
2answers
2k views

BinaryTree<T> written in C#

I've written a binary-tree using .NET Core 3.0. What can I do to improve my coding style? ...
0
votes
0answers
486 views

Upsert with .Net Core Web API

I am using .NET Core 2.2, EF Core and C#. I have created a web API project. I was requested to do an Upsert (insert or update). The entities structure is: Movie User Rating: this is used to give a ...
-2
votes
1answer
190 views

Repository Pattern and SOLID principles [closed]

I have written the following Repository in C#, using NetCore 2.2 and EF Core. I was thinking how to write properly the Search method according to the SOLID principles. This code gives a null ...
4
votes
2answers
316 views

Reading SQL query from a resource, with error logging

I've created a utility class that expects a logger to be passed at a method level, since I prefer legitimate errors to be written out for troubleshooting later on. Another developer hates passing the ...
5
votes
1answer
2k views

Using Span<> and Memory<> to read UTF8 from a socket

I am experimenting with Span<> and Memory<> and checking how to use it for example for reading UTF8 text from a <...
-1
votes
1answer
264 views

Creating a Compatibility Shim for ExampleClass to be targeted both to .net framework and .net core 2.0

Intro: Before showing the actual code for review, let me show you an ExampleClass to create a shim for. ...
2
votes
1answer
173 views

Retrieving OS Platform .NET Core

I'm retrieving the operating system platform with .NET Core with system.runtime.interopservicesI have created the code below and was wondering if there was any other way that I could improve it since ...
0
votes
1answer
764 views

Mocking objects using abstract factory

For some time I am trying to make a mocking library for C# that mocks objects with just 1 line of code. I am using abstract factory pattern to know what is the object's type so that I can work with ...
4
votes
3answers
185 views

Web-app for tracking containers

Nowadays I am learning Domain Driven Design intensively. I am reading the book called Domain Driven Design by Eric Evans, and at the same time I try to apply the knowledge on a real life project I ...
5
votes
1answer
4k views

File path unified in Windows/MacOS/Linux

We are all tremendously happy about back slashes in Windows file systems and do not think that their sole purpose is to make life complicated for smart people who are capable of using different OS. ...
4
votes
0answers
950 views

CSV Data Table Extension

This is my library I wrote from scratch for the .net core that imports and exports CSVs from DataTable objects. I've seen a lot of huge complicated libraries that handle this and a million other ...