Skip to main content

Questions tagged [.net]

The .NET Framework is a software framework for Microsoft Windows operating systems. It includes an implementation of the Base Class Library, Common Language Runtime, and Dynamic Language Runtime. It supports many programming languages, including C#, VB.NET, F# and C++.

Filter by
Sorted by
Tagged with
0 votes
3 answers
128 views

.Net 8 XUnit: How to mock MySql in a CQRS API using integration tests?

This is a rewrite of my own .Net 8 XUnit: Should my tests use real data or how to mock MySql with CQRS? in a much more clear way: The reason for rewriting my previous question is because in the ...
Diego Perez's user avatar
3 votes
2 answers
350 views

.Net 8 XUnit: Should my tests use real data or how to mock MySql with CQRS?

I'm creating tests for our .Net 8 API. We use MySql for data storage and CQRS pattern for queries. In my personal opinion, I shouldn't use the real database for testing, because you will use an ...
Diego Perez's user avatar
0 votes
0 answers
39 views

Split actor model logic into modules

I'm starting a project using .NET and Microsoft Orleans, running on Kubernetes. The main reason I chose Orleans is that I have a system that deals with accounts. There can be millions of accounts, but ...
Kilian's user avatar
  • 1
0 votes
1 answer
73 views

.NET - Communication between services and Power BI

I have the following problem which I don't know much about. I have a ServiceA that returns customer data on transactions and a ServiceB that has reports, also my environment uses Power BI from ...
Katarina's user avatar
9 votes
5 answers
4k views

Writing public libraries: Should I let the consumer of the library enforce thread safety?

I'm writing a .NET library which exposes certain public APIs. Currently, I have not enforced thread safety in my library for following reasons apparent to me: locks (Monitor.Enter and Monitor.Exit) ...
Critical Failure- Core Dumped's user avatar
0 votes
1 answer
126 views

Using a thread-locking service as a singleton dependency in .NET

So I'm working on the Web API for my website and certain API calls need to be performed with thread safety in the application's runtime. I have created a locking service which uses a semaphore for ...
Xyds's user avatar
  • 11
4 votes
1 answer
405 views

Does C# 8 reference type nullability make Option/Result monad obsolete?

As the most common exceptions in my project are NullReferenceExceptions I'm trying to find a way to limit the occurrence of problems with unexpected or unhandled nulls to the minimum. One of the ...
Piotrek's user avatar
  • 151
1 vote
1 answer
99 views

Benefits of resolving dependencies with IServiceCollection and IServiceProvider for Unit Tests instead of inheriting mocks from a base test class

Articles such as this point out some of the pitfalls of manually instantiating dependencies in UTs, while showing some of the benefits of doing it, instead, with the .NET's dependency container by use ...
Veverke's user avatar
  • 461
1 vote
2 answers
180 views

Does my business case need TPL dataflow?

We are trying to rewrite a session management system as our legacy system can't scale up anymore and is quite buggy. I'll briefly explain our system, we have huge number of machines on which end users ...
user1890098's user avatar
0 votes
2 answers
84 views

EFCore In Memory repository Unit Test of Encrypted data

I have in project linq repository unit tests. [Fact] public async Task Get_FromTreeEntitiesUnsorted_RetunsOrderByDescending() { //Arrange _contextReadonly.Entity.Add(new ...
cargt4's user avatar
  • 19
-2 votes
1 answer
265 views

How to go about version numbers in a C# solution

My current situation: I would like to apply this to a solution containing multiple projects (one executable and different libraries) in C#. Additionally, I have a project that packs the executable, ...
jav's user avatar
  • 113
-4 votes
1 answer
187 views

How can I manage user data without the login feature? [closed]

I am making a .net Maui QR code business card application and the application will not have authorization features such as member login and registration. And my app needs to be able to create business ...
Tugba Dokumaci's user avatar
0 votes
0 answers
45 views

Automated API Versioning

I did research about this and I'm facing with two challenges: how to handle version deprecation in my CI/CD pipeline, when we have more than one major versions officially functional and others ...
Hirbod's user avatar
  • 1
0 votes
1 answer
33 views

Is using an Azure Function to forward a message to my App Service the best idea for handling a Twilio Web Hook?

I have an Azure App Service running a .NET (Core) API for an inhouse application, which I'm integrating with Twilio to handle Whatsapp communication. To handle the web hook responsible for receiving a ...
jarodsmk's user avatar
  • 141
0 votes
0 answers
75 views

Replacement for WCF ServiceBus Relay in .Net 7

We've leveraged WCF Azure Service Bus Relay fairly heavily in the past and have a number of C# services that rely on it. All of these services relay REST requests to small on-site servers that sit ...
Molloch's user avatar
  • 101
2 votes
1 answer
194 views

Why are most of the .NET code analysis rules disabled?

I've began studying how the .NET Code Analysis works. It seems that it can be either enabled via a NuGet package or a property in the SDK-style *.csproj files. Also, starting in .NET 5, it is enabled ...
Gua-naiko-che's user avatar
1 vote
1 answer
164 views

Which is technology is preferably for uploading desktop application usage statistics, SFTP, or HTTPS?

I would like to add functionality to an existing .NET 6, WinForms app (currently migrating to .NET 8 if that is of any relevance), to periodically upload user usage metrics, in addition to providing ...
mountainred's user avatar
0 votes
2 answers
584 views

What is considered best practice for managing dependency injection for multiple libraries with ASP.NET Core Web API?

Suppose we are building a REST API with ASP.NET Core. Suppose there are 3 projects in our solution: The ASP.NET Core Web API project. A class library project for the businnes layer. A class library ...
user1969903's user avatar
1 vote
2 answers
234 views

DDD Logic implementation

Ive been tossing this around in my head for awhile. But I'm working on a project that consists of an Order, that has a OrderStatus. There is quite a bit of logic that revolves around the status and ...
KryptoBeard's user avatar
-2 votes
1 answer
325 views

Decoupling thirty dependencies for projects that reference each other in a sequence

I am working on a simple interface to SharePoint via Graph API. I have created a project that references Azure.Core, Azure.Identity, Microsoft.Graph, and other dependencies required to make calls via ...
Sigmundur's user avatar
  • 105
0 votes
1 answer
71 views

Best practices for storing logs from worker processes in Azure?

We have a .NET 6 application that consists of a REST API running in Azure App Service, and long-running background jobs hosted in Docker containers. These jobs are triggered by messages in a message ...
hingst's user avatar
  • 29
0 votes
0 answers
64 views

Decide pattern(s) for Background service which has dependency on services and service-provider and ServiceBus in .net

I'm designing class library with background service which has public static class ServiceCollectionExtensions Which have few methods which will be call outside. Now above mentioned extension will ...
C M's user avatar
  • 1
2 votes
2 answers
203 views

Where to put interface files for mocking aka what are best practices for organizing interfaces in a C#/.NET Core project with NSubstitute, Moq etc.?

Question I'm working on a C#/.NET Core project, and I'm looking for guidance on organizing interfaces, especially when it comes to using NSubstitute, Moq or other libraries for mocking, because there ...
rklec's user avatar
  • 31
1 vote
2 answers
312 views

Where to put DLL specific settings?

I'm not sure how to manage configuration settings in a C#/.NET environment. For simplicity lets say I have 3 assemblies: My MainApplication is the project being started and containing the business ...
NoConnection's user avatar
0 votes
1 answer
223 views

What is the responsibility of a typed HttpClient in .NET?

Say I have a simple layered .NET application, with three layers: API Adapters Application The application layer needs to use some typed http clients to communicate with external APIs. This means ...
Jakob Busk Sørensen's user avatar
0 votes
2 answers
1k views

Deserializing/Serializing a cached domain object breaks DDD principles

My application has to maintain a stateful object and update it periodically based on events received. I get an initial HTTP request to create this stateful object. After that the object has to be ...
user1890098's user avatar
0 votes
2 answers
218 views

Domain Project and Identity Project circular dependency

I am currently working on implementing the Clean Architecture pattern using Entity Framework. However, I've encountered an issue related to the design of my Domain project. In this project, I need to ...
pakerinjo's user avatar
0 votes
0 answers
103 views

How to use an external event queue with inversion of control (IoC)

I'm working on an AspNetCore application, with a requirement to raise and handle certain events asynchronously using an external event queue. I'll use AWS services as examples here because that's what ...
brads3290's user avatar
  • 135
0 votes
1 answer
302 views

Is a message queue the right pattern to use for intra-module communication in a .net core application

Background Information We have a .Net core application that uses Hangfire (pretty version of cron) jobs to batch process different types of data. As a bogus example, we have one job that will run ...
dot's user avatar
  • 571
0 votes
0 answers
2k views

app.config vs. appsettings.json in WPF .NET Framework app

I am building a .NET Framework WPF application, however, I want to use IConfigurationBuilder, which is a part of the newer (.NET Core and up) Microsoft.Extensions.Configuration namespace. My ...
JD136's user avatar
  • 1
1 vote
1 answer
376 views

Reduce Code Repetition for a Simple CQRS

We're currently exploring CQRS in our future applications. To give a bit of a background, we use a simple CRUD-style service before something like this. Old Pattern: Controller Command/Service Model ...
Lawrence's user avatar
  • 123
-2 votes
2 answers
2k 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 ...
microsoftdeveloperdesigner's user avatar
-1 votes
1 answer
306 views

PowerApps with SharePoint Versus ASP.NET core with SQL Server

I have around 6 years of experience in SharePoint, ASP.NET MVC, ASP.NET Core MVC & SQL Server. Now when I want to take a decision, if the project should be implemented using SharePoint/PowerApps ...
microsoftdeveloperdesigner's user avatar
0 votes
2 answers
116 views

Designing inter class tasking in C#

I'm looking for some advice/recomendations on structuring an application which involved multiple classes that need access to each other for the sole purpose of tasking (i.e. class A needs to pass ...
Darc's user avatar
  • 101
0 votes
0 answers
251 views

C# Azure Function Durable Function Vs Batch Timer Trigger Function

I have a question related to the best approach when resources are limited, such as on the Azure Function consumption plan. I have an IoT device, and the number of IoT devices is likely to increase to ...
user8400863's user avatar
1 vote
3 answers
273 views

Improving performance of C# Azure function

I am currently working on a C# Azure Function that is triggered by an HTTP request. The function's purpose is to extract raw data from Azure Table Storage and output it to the user in the form of a ...
user8400863's user avatar
5 votes
5 answers
5k views

How can I protect an SQL connection string in a client-side application?

I am developing a .NET Windows application and I need to make requests to a SQL Server instance. How do I secure the authentication data in my code in case someone decompiles my application? I know ...
Motti's user avatar
  • 85
0 votes
1 answer
416 views

Separating Application (Business Logic) Layer to Multiple Module Layers in Clean Architecture

Currently, I'm designing the Project based on Clean Architecture composing with 4 layers: Domain Application Infrastructure Presentation Since the project is pretty huge, I'm now considering to ...
Steve.NayLinAung's user avatar
0 votes
1 answer
65 views

Including currect user/roles data within object state in .Net applications to control object behavior

I am building a .Net Core Blazor Server application. The application creates records of a Project class which move through a workflow with various phases of review and acceptance/rejection before ...
aterbo's user avatar
  • 111
1 vote
2 answers
896 views

DDD - How to handle one transaction across multiple bounded contexts when doing Save on multi-purpose UI page

I'm working on a HR application that has employee management and access control. We decided to go with these bounded contexts: Employee management: manage employees information, like name, contract, ...
Ramzi Hammouda's user avatar
-1 votes
1 answer
332 views

Domain Modeling / Architecture

I'm experimenting with some projects at the moment and I am stuck trying to decide on the correct approach to this question. Given a simple architecture like this consisting of Domain - (Person and ...
Justim Odendaal's user avatar
0 votes
1 answer
802 views

Azure Function App and multiple Functions within it, performance

I am new to Azure Function App. I am using a consumption plan. Does it make a difference how many functions are in a Function App? What about if there are functions, such as the service bus triggered ...
user8400863's user avatar
2 votes
3 answers
395 views

C# Duplicated usage of an if/else condition and a ternary operator. A good practice?

I had a debate with a work mate regarding the following code as to which one of it would be the better practice: My code (in pseudo): var A = <precondition either TRUE or FALSE>; var B; if(A) { ...
Chams's user avatar
  • 29
-1 votes
1 answer
2k 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 ...
Jeb50's user avatar
  • 101
4 votes
1 answer
1k views

Should I favor default interface methods over extension methods?

Default interface methods of C# 8 and extension methods have in common that you can "add" a method with implementation to an interface. "Add" being in quotes here because for ...
bitbonk's user avatar
  • 211
0 votes
1 answer
195 views

How handle many files effectively?

I'm looking for a way to work with a huge amount (~10^9) of files (all sizes) in .NET using unspecified file system (NTFS, BTRFS...). What I have done up to now is to store them in evenly in a folder-...
Andreas Zita's user avatar
0 votes
0 answers
1k views

How inter-process communication is handled on .NET Core?

I have to implement a bi-directional communication between two local process with support to backward compatibility .NET Core/NET Framework and platform architecture x86/x64. The options that i have ...
youssef jirari's user avatar
0 votes
0 answers
127 views

How to avoid duplicate code when working with SOAP proxy classes in different environments?

It's been a long time since I worked with SOAP so my question might be trivial but I just wasn't able to find a satisfying answer so far! Anyways here's what's going on: I got access to a system via ...
LazarQt's user avatar
1 vote
3 answers
4k views

When Should I Use a Static Class and When Should I Just Use Functions?

I am currently building a C# application that gets JSON data then it calculates something then stores the results in a database, what is the proper way to design the application. This is how it's now ...
BeeFriedman's user avatar
-1 votes
3 answers
903 views

Refactoring multiple non-nested if statements [C#]

I have a number of non-nested if statements that look like this: if (!bytes[nameof(PropertyVersion.Price)].SequenceEqual(dbBytes[nameof(PropertyVersion.Price)])) changes += $"Price {TextHelper....
Azhari's user avatar
  • 115

1
2 3 4 5
30