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 ...
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 ...
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 ...
5 votes
1 answer
238 views

Peculiar architecture interfacing .NET to AutoCAD out-of-process

I have written a set of classes to interact with AutoCAD from an out-of-process .NET assembly, but it seems like my class architecture and interactions are unusual. I am struggling to find a better ...
-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 ...
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 ...
-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 ...
6 votes
1 answer
792 views

Cons of using unconstrained frameworks for unit testing

It's very easy to write unit tests for legacy code using unconstrained frameworks, such as TypeMock Isolator. But what about writing unit tests for newly written code? Is it a good practice to use an ...
20 votes
5 answers
23k views

Why isn't there a data type for just a date?

One of the first things I learned about dates and times in c# (and various other languages) is that a date is stored as a DateTime with the time component set to midnight. There is no difference ...
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) ...
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 ...
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 ...
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 ...
1 vote
1 answer
9k views

use of minOccurs="0" without nillable="true" in SOAP

I have received an XSD from a 3rd party supplier generated from a Java based system; which is to be used to create a SOAP endpoint for us to receive data transfers. Their XSD does not make any use of ...
10 votes
1 answer
517 views

Clarification about Event Producer in StreamInsight

I need a small clarification about StreamInsight, I know by doc's that StreamInsight can handle multiple concurrent Events. But will the event producer be a separate function, for ex: I need to watch ...
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 ...
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 ...
2 votes
1 answer
3k views

Use of FindWindow and window handles within a Windows service

I've got a third-party vendor who is installing a series of Windows services to a (Windows 2008 R2) server in my control. Whilst attempting to run each service under its own least-privilege account, ...
1 vote
2 answers
2k views

Repository Pattern: Doctrine2 vs Microsoft Entity Framework?

I have been using Symfony2 with Doctrine2 for some years. I have recently started using Microsoft's Entity Framework with MVC5. From my Symfony2 experience I understand that a repository's job is only ...
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 ...
-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, ...
-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 ...
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 ...
4 votes
1 answer
957 views

DDD / Onion architecture in JavaScript

One reason I like .NET is because the 'solutions' and 'projects' lends themselves to good architecture. Good architecture makes it easy to follow the happy path of Domain-Driven Design. I've fallen ...
5 votes
4 answers
17k views

Is it possible to infer the the generic type from a generic method?

I'm making an HTTP API client class. I want a Perform() method which takes a request object and returns an obejct that is expected from the API. So a PostRequest object will describe how to get a ...
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 ...
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 ...
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 ...
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 ...
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 ...
0 votes
1 answer
3k views

Where to put SaveChanges in unit of work?

For the sake of discussion, you can assume I'm using Entity Framework and a mediator pattern implementation in .NET. I'm going back and forth trying to decide how to structure some of my data access ...
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 ...
16 votes
6 answers
9k views

Should I Have One Interface Per Class For Unit Testing?

Should I define an interface for every public behavior class (excluding data classes)? I've spent many hours searching and reading to find a clear answer. If I search "Do you define an interface ...
29 votes
6 answers
9k views

Is it worth even checking to see if Guid.NewGuid() is Guid.Empty?

In one of the projects I'm working on the following pattern is seen on a fairly regular basis: var guid = Guid.NewGuid().ToString(); while (guid == Guid.Empty.ToString()) { guid = Guid.NewGuid()....
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 ...
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 ...
19 votes
3 answers
22k views

Is it ok for services to reference one another?

I have a service that needs information implemented by another service in the same layer. Is it good practice for one service to take a dependency on another service in the same layer?
4 votes
2 answers
2k views

What kind of version change is updating to a new .NET-version when using SemVer?

When updating to a new major version of .NET (in this case from .NET 5 to .NET 6) without needing to make any change other than selecting the new target framework in Visual Studio, does this warrant a ...
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 ...
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 ...
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 ...
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 ...
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 ...
0 votes
2 answers
2k views

Why does ObservableCollection require all changes to be made on the UI thread?

And is there any danger to making my own INotifyCollectionChanged implementation that doesn't? I'm trying to make a class library contains a Log class, which in turns contains some sort of observable ...
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 ...
15 votes
5 answers
11k views

Is there a proper way to create a file format?

I'm building a proprietary file format for an application I wrote in C# .NET to store save information and perhaps down the line project assets. Is there a standard on how to do this in any way? I was ...
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 ...
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 ...
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 ...
-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 ...

1
2 3 4 5
30