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
-1 votes
1 answer
93 views

How to implement automatic SemVer from code changes [closed]

Goal I'm working on libraries published as nuget packages and I would like the version of those packages to update automatically based on the changes I make. In other words, I would like something ...
user avatar
  • 194
0 votes
1 answer
83 views

Alternatives to DDD - Complicated and cumbersome business logic/process

We have inherited a legacy MS CRM 4.0 application and the business wants it re-written to an as vanilla as possible .NET web application. The business wants to go down this route vs another off-the-...
user avatar
  • 115
3 votes
4 answers
191 views

How to get an ILogger instance from extension methods?

Let's say I have this service abstraction exposed from a library. public interface INavigator { ImmutableList<IPageViewModel> Entries { get; } void NavigateForward(IPageViewModel page); ...
user avatar
  • 194
0 votes
1 answer
50 views

Trying to implement a "password vault"-like solution for connection strings

I started to work on a 16 years old .net framework app that didnt receive any love for a decade and I have some time to "put it up to standards". One of the things that ruffle my feathers is ...
user avatar
-1 votes
1 answer
101 views

Writing a API for a hardware device for mutliple platforms

We want to create an API to communicate witha device we currently sell. The API should be available for several platforms like C / C++ / .NET / Python and available for Windows and Linux. The idea is ...
user avatar
  • 99
0 votes
1 answer
54 views

Mapping destination object from multiple source objects vs constructing using multiple source objects (as in constructor)

Lets say we have DTO class with 15 properties. Usually DTOs like these are mapped from other objects. But sometimes some DTOs may use values from multiple objects. In these cases, should we “Map” or “...
user avatar
-3 votes
2 answers
91 views

Case Statements for string to string mapping [duplicate]

I have a class called SomethingProvider that contains: private static string convertMapA(string convertA) { switch (convertA?.ToUpper()) { case "NONE": ...
user avatar
  • 105
5 votes
2 answers
501 views

Should you write unit tests for templates and frameworks, such as in .NET?

How much (if any) unit tests should be written when you start a new templated project? In particular, let's take as an example a typical .net framework template for asp.net mvc or other similare ones ...
user avatar
  • 59
-3 votes
3 answers
309 views

Can be logic around `List<T>.Enumerator._version` considered control flow exploitation?

List<T>.Enumerator “snapshots” list version upon creation by _version = list._version;. This allows enumerator to halt enumeration when List<T> changed during it. This behavior likely ...
user avatar
  • 268
1 vote
1 answer
116 views

Builder design pattern when creating object between many layers

I stumbled on following problem, and I'm curious if it could be done better. A while ago I wrote a factory class that looked something like this: public class Foo { private IDbContext ...
user avatar
0 votes
2 answers
154 views

How to split logging into streams?

I am looking for an advice (or an example) on how to organize logging streams in my cloud app (C#). In my app there are logging events related to the application infrastructure level and I want to ...
user avatar
0 votes
0 answers
72 views

.Net Core Api - multiple Dto’s for single entity

I want to know the best Practice is about having multiple dto’s for different use cases. Let’s say we have an api with a set of controllers to handle requests coming from a administration backend and ...
user avatar
1 vote
1 answer
143 views

How to test around a giant static class?

I am dealing with an old .net code base which has a PrivilegeChecker static class with hundreds of static methods, each of which takes in some user id and some other params, and then fetches some info ...
user avatar
  • 196
0 votes
0 answers
31 views

Creating entity with external dependency inside the aggregateroot?

Okay, so, I'm working on an AuthService for my microservices system. I'm putting plenty of logic around single instance of User inside of it itself, just so I can avoid repeating code, breaking SRP or ...
user avatar
  • 221
1 vote
1 answer
84 views

How do I share translations between a .NET application and a react application?

I currently have two applications where one is a landing page (built in react) and another is a web page that lets users explore data (Written in ASP.NET 4.7). I'm currently using resx files to handle ...
user avatar
  • 121
0 votes
1 answer
99 views

.NET: Microservices, Hexagonal Architecture with lightweight DDD - how to avoid leaky abstraction without a major performance loss?

So, I have a whole system built as microservices.On a service level, I'm utilizing Hexagonal Architecture with lightweight DDD (no events, aggregators etc.) I have a service that fetches Users via ...
user avatar
  • 221
1 vote
0 answers
93 views

How to improve the coding quality in a problematic company [duplicate]

Due to circumstances I'm now working in a small software company. We make e-mail marketing management software and serve some big customers as our national railways and a big bank. The software has ...
user avatar
3 votes
4 answers
454 views

C# How to avoid memory leak in this case

I've got a Window, which gets a viewmodel instance injected into its constructor. The window sets its DataContext to that viewmodel. The viewmodel contains a command to "submit" the window ...
user avatar
26 votes
5 answers
5k views

Why use the discard variable in C#?

When coding resharper recommends that if you're to discard or ignore the return of a method, that you use this syntax: _ = TheMethodICouldCareLessAboutTheReturnValue(); I know you could just call it ...
user avatar
-1 votes
1 answer
49 views

How can I pass a large amount of data from a JavaScript client to the web server in bulk

I have a Vue/Quasar application that allows the end user to convert an Excel Spreadsheet into an Array and load it into a DataGrid. The Spreadsheet has a list of peoples names, email address, ...
user avatar
1 vote
1 answer
104 views

Prevent users with multiple sessions using a single use voucher

I'm working on a .Net eCommerce site that allows users to use vouchers to get free products, discounts etc. The problem I have is that there have been instances of users, who have been issued single ...
user avatar
1 vote
2 answers
146 views

CQRS MediatR Create many items commad - is it a good practise?

I am here to ask question about: is it good practice to insert many records using CQRS and MediatR? how to structure that in terms of names and folders? A have to insert into database over 500 ...
user avatar
-1 votes
3 answers
310 views

Is it a bad idea to save the database in middleware?

So I've implemented the repository pattern in a lot of projects, but there seems to be a bit of a discussion on what is right with this pattern. Previously, I've always added Update or Create methods ...
user avatar
0 votes
1 answer
59 views

Extending TypeScript while being futureproof [closed]

C#10 Has extended the property pattern ability, I think it began since #7 EG: { Car: { Interior: pattern } } Meaning you can do some nice pattern matching even in if statements if (car_var is ...
user avatar
  • 109
0 votes
0 answers
50 views

Scaling Docker Containers Question with .Net Core Worker Services

I have a fairly what I think is simple question but am completely unfamiliar with design considerations when using docker containers. So I have been trying to come up with a structure for an app that ...
user avatar
  • 101
-1 votes
1 answer
36 views

Looking for way to store, get, partially update few relatively small JSON documents which has different unique types

I have an app with many individualistic features which behavior is controlled by settings. Let's say these are a few utility services with the following settings that are historically stored in ...
user avatar
0 votes
1 answer
83 views

Creating a contract for a UDP connection

I'm developing a system in C# who consists in a desktop application running a UDP server and a android app and this app sends data (byte array) to be read by the desktop application with commands and ...
user avatar
-1 votes
1 answer
160 views

Hardware test GUI with multiple event sources (4 serial ports and user interaction) - best architecture?

I have the following requirements: Write a GUI app for automated testing of some custom PCB hardware. The system must be usable for a technician with little to no advanced PC skills. The test setup ...
user avatar
0 votes
1 answer
209 views

ASP.NET Core - Using Partial Views inside a Modal window for my Add/Edit/View Details screens?

I've been developing .NET projects for the past 3 years, and on my recent web .NET projects, I've been using Partial Views for all the screens that contain Forms for Add/Update/Delete or other ...
user avatar
  • 1
0 votes
0 answers
83 views

Multi-threading optimization in-depth

A time ago I participated in an interview process where I was tasked with a simple requirement. I created the best solution I could, using some lock-free implementation. I didn't pass the code ...
user avatar
0 votes
1 answer
193 views

Are Flate compression in PDF and Deflate different algorithms?

I'm trying to make a program that produces pdf files. I've been studying the pdf format specification and specific pdf files whose format I'm trying to mimic. I found the line /FlateDecode in these ...
user avatar
  • 489
2 votes
2 answers
460 views

Validations and throwing exceptions in DDD?

I have a question regarding validations and exceptions in DDD. I have a ValueObject say, PasswordText which takes a string argument in it's constructor. Checks if the string matches the password ...
user avatar
0 votes
1 answer
163 views

How do you identify unused parts of app and web .config files in .NET? [duplicate]

I am working on removing obsolete/unused pieces of configuration from a .NET product starting with appSettings. There are multiple solutions and I've noticed that appSettings can be in a .config file ...
user avatar
  • 113
0 votes
0 answers
115 views

Moving from IUnityContainer to IServiceCollection and injection based on name

There are many RegisterType overloads with string for the name in Microsoft.Practices.Unity. Now we are moving toward Microsoft.Extensions.DependencyInjection.IServiceCollection. And there are no ...
user avatar
  • 191
1 vote
2 answers
128 views

CQRS: Is it an antipattern if the Command invokes a database interface which contains business logic?

Martin Fowler states that, Command module executes validations and consequential logic which aligns with every CQRS demo app that I've studied. That is to say: validation -- does this Jedi exist? -- ...
user avatar
  • 1,339
0 votes
1 answer
905 views

why controller lifetime is transient by default in asp.net core? [closed]

I know the lifetime of the controller class is transient by default, but I think it's better to be singleton. should explain to me why creators choose transient instead of singleton or scope lifetime? ...
user avatar
  • 31
-2 votes
1 answer
102 views

Why running migration turns into timeout in a production environment?

I know this is a theorical question since i don't have code to or any logs to show, but i hope that someone can give me some idea on this question. The problem in question was the following: On my ...
user avatar
  • 105
2 votes
1 answer
279 views

Strategies to organize multiple projects which may reference each other and managed by different teams in Git?

First actually I don't think Git is a specific involved tool here, it can be any other Source/Version Control tool (TFS, SVN, ...). The point here is how to deal with the scenario in which I have ...
user avatar
  • 149
-3 votes
1 answer
75 views

Inter application communication .Net

I have multiple WPF applications running different programs some of them are interconnected so one might have to start another at some stage. I need a way to communicate and share large amounts of ...
user avatar
-1 votes
2 answers
164 views

How to avoid CRUD and layered architectures in REST backends?

I'm creating a .Net 5 API backend and use EF Core for the database part. The simple CRUD way I know: API layer calling a command or query from the application layer using MediatR Application layer ...
user avatar
-1 votes
1 answer
52 views

Implementation of concurrent purchase for unique items

I am building an API for webshop. I need to implement following scenario: There are x (let's say 500) digital items, which will have same price (let's say each item costs 10$), but unique serial ...
user avatar
1 vote
0 answers
55 views

VM-images: how protect time-license programs?

One big customer asked me to supply my program to run within a balanced VM-images structure; I mean, the program will be recorded into an image which will be launched in "instances" to ...
user avatar
  • 119
0 votes
1 answer
387 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 ...
user avatar
-1 votes
1 answer
113 views

Allowing end users to upload a large amount of data using Excel

I've read Allow users upload CSV files, and embed the data for a simple API , Importing large data sets into a database over the web the closest concept is Is there a way to efficiently allow a user ...
user avatar
-1 votes
1 answer
94 views

Version control organization for large .NET solutions

I'm trying to come up with a better way to organize my C# projects on SVN. The .NET solution for my main GUI has about 28 class library projects. These libraries fall into two categories. Some of them ...
user avatar
  • 107
-2 votes
2 answers
105 views

Ideas for implementing a hardware interface

I am looking for alternative ideas of how to implement the following situation (.NET Core, C#) Having multiple sensors that communicate over a RS485 interface with the host. Each sensor is implemented ...
user avatar
1 vote
0 answers
44 views

How to implement timing-mechanism for fantasy draft process utilizing ASP.NET Core 3.1 SignalR

I have developed a Fantasy Draft system utilizing ASP.NET Core SignalR, along with Azure's SignalR service (for backplane/scaling stuff). Last year I utilized a poor-mans' javascript version that just ...
user avatar
  • 401
1 vote
2 answers
345 views

Why it is possible to specify a value comparer for ImmutableDictionary<TKey, TValue>?

What is the intended usage of the ImmutableDictionary<TKey,TValue>.ValueComparer property? Why is it useful being able to compare dictionary values by using a specified equality semantic? I ...
user avatar
1 vote
1 answer
308 views

DbContext lifetime in desktop app with SQLite

I am creating a small data-driven desktop application using .NET 5 with WPF, ReactiveUI, Dynamic Data, and EF Core 5. The app uses a local SQLite database to store all persisted state, and relies ...
user avatar
  • 292
1 vote
1 answer
63 views

Custom File System Index/Cache - How to save index

I've got an extremely oniony(deep) folder structure which contains Appx 1,000,000 text-based files on a network share. Using windows search is extremely slow and unreliable. I've created some text ...
user avatar
  • 369

1
2 3 4 5
29