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
1 answer
2k views

Domain Driven Design: Is OrderLine Detail a Nested Class of Order Header?

I had asked a question here, and someone had recommended that OrderLine be a Nested class within Order Header. Is that a standard practice in Domain Driven Design, or more one of many debated methods ...
1 vote
2 answers
284 views

Downloading and appending data from AWS S3 whilst avoiding clashes

I have to upload a TSV file to an S3 bucket, the content is form submission data. Another service will consume and do things with this data as soon as possible. The service would like one large file ...
0 votes
0 answers
135 views

Need some design advice on my ORM for Immutable objects & ref passing

I'm adding Immutable objects support to my Micro ORM called "Symbiotic" In the case of a create, I need to pass back a newly created version of the value passed in because the object is immutable and ...
2 votes
2 answers
899 views

Micro-services architecture for Data Ingestion/Transformation pipeline project

I am working on designing a brand new Data Ingestion Pipeline with the Key highlights of the new project are as follows: Download and Update data to/from SharePoint using SharePoint APIs Download and ...
  • 121
0 votes
1 answer
55 views

When to use type contraints for sortable collections

I am implementing a Binary Search Tree and cannot decide if it would be good practice to constrain the generic type of the tree to a comparable item, i.e. IComparable<T>. Or, to just use the ...
0 votes
2 answers
983 views

How to initialize base class property once instead of passing it from all derived classes?

I have a small library where I am performing 1 long running operation and based on that operation,I am saving some data inside database tables.Now this is small library which does not include alot of ...
0 votes
2 answers
182 views

SRP violation confusion based on examples

I am trying to gain better understanding on SRP and when I was checking out a Pluralsight video by Scott Allen, I saw code like this: https://github.com/OdeToCode/cs-fundamentals/blob/master/src/...
0 votes
1 answer
79 views

Should we still create separate custom ApplicationExceptions?

Given that when is supported in try...catch blocks, does it make sense to create a single CustomApplicationException class, say, with an enum ApplicationExceptionReason Reason property to ...
2 votes
4 answers
1k views

Why does C# not have automatic dispatchers

Why does C# make you put in a dispatcher for a different thread to update the UI? Example: Dispatcher.Invoke(() = { lblerrorName.Content = ""; }); It always gives the 'running on different ...
  • 81
0 votes
2 answers
1k views

Passing runtime-read configuration when working with an IoC container

I've recently "discovered" the IoC realm, and decided to refactor a project I'm working on to use such a container. To be specific - I'm using autofac in C#, in a .NET Core console application. The ...
0 votes
0 answers
178 views

Tradeoffs between Testability and Performance when filtering using SQL vs LINQ

My team has recently decided to adopt the CQRS pattern similar to the one used in the famous Microsoft EShopsOnContainers repository. In this solution, the queries are made in Query classes using ...
  • 103
3 votes
1 answer
167 views

Way to hide logic behind class for better readability of method and refactor class to follow SRP

I have an algorithm to create a version for an entity and then I save that version against below 2 entity: 1) Variant 2) Category interface IEntityVersion { string GetVersion(); } public class ...
2 votes
1 answer
759 views

NuGet versioning with gitflow

Some background information to our actual situation. We are migrating from TFS VC to git. We've a ASP .NET Web API with many different Controller Libraries (>30 assemblies). Many of them are ...
2 votes
1 answer
284 views

Must we define methods and async when we don't know whether the implementation is synchronous or asynchronous?

I think I know the answer to this, but it's particular enough that I don't want to go telling other people stuff until I'm 100% certain. Suppose I have a class with some dependency: public interface ...
0 votes
2 answers
112 views

Appropriate pattern for injector that sets a property and client that ONLY gets a property

Suppose I have a method in client code that expects an interface... void DoWork(IDataManager data) { //use IDataManager interface in the DoWork method } And the IDataManager interface looks like ...
4 votes
1 answer
824 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 ...
  • 2,080
1 vote
1 answer
768 views

Data entities in Onion Architecture

I'm trying to build a project using onion architecture (just a "Northwind"ish type app to get more up to speed with .NET Core). I also want to get a better grasp on Onion Architecture principals. I ...
54 votes
5 answers
13k views

How to deal with fear of taking dependencies

The team I'm in creates components that can be used by the company's partners to integrate with our platform. As such, I agree we should take extreme care when introducing (third-party) dependencies. ...
  • 650
1 vote
1 answer
184 views

How to work with multiple databases efficiently (Development, Testing & Production)

Brief background I'm currently designing a COM DLL in .NET for use in MS Access by a few other developers. The Access application is hooked up to a SQL-Server & is supposed to just act as a front-...
  • 113
5 votes
4 answers
14k 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
238 views

Does a 'leaky' repository implementation defeat the point of a repository?

I've seen some tutorials and examples of implementing a repository pattern, and I don't quite understand something. My impression was that the whole point of a repository pattern was to hide the ...
  • 1,278
4 votes
4 answers
830 views

Refactoring ASP.NET Web Forms App to use MVP vs incrementally rebuilding it using MVC?

My team has inherited a Web Forms application that was built over the past decade or so into a monolithic code base with massive dependencies. In order to maintain this system we are going to have to ...
user avatar
0 votes
1 answer
1k views

Is ASP.NET-Core Hosted-Services supposed to replace Windows Service?

Some time ago when there were no ASP.NET-Core hosted-services the choice for a service-type application was pretty clear, it was a Windows Service. However, recently I've noticed that at least some ...
  • 2,496
0 votes
1 answer
429 views

Factories to create same objects with different data sources

I have several handlers classes that implements same interface and factories to create handlers. Handlers: public class Handler1 : IHandler { private readonly IService1 _service1; private ...
1 vote
7 answers
487 views

Good object oriented practice to use an object to build itself?

Do you think its a good OO practice to use parts of an object to build itself? Here is an example. var car = new Car { Make = BuildMake(), Model = BuildModel(), Vin = ...
  • 27
1 vote
3 answers
2k views

What is difference between assigning to auto-Implemented properties VS their backing fields within the class

Before I started using auto-implemented properties, I was taught that when assigning properties in the constructor (because of the potential of making a property read only), I should assign directly ...
  • 147
26 votes
3 answers
4k views

C# 8 non-nullable references and the Try pattern

There is a pattern in C# classes exemplified by Dictionary.TryGetValue and int.TryParse: a method that returns a boolean indicating success of an operation and an out parameter containing the actual ...
3 votes
1 answer
468 views

Securing cross DLL references within an Application

I am developing a. NET application. One of my DLLs manages all the security (data encryption, license management, etc). I was wondering if someone could somehow substitute this DLL file with one of ...
  • 247
15 votes
5 answers
6k 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 ...
11 votes
1 answer
8k views

Clean Architecture and Microservices

Our team is in the planning stages of creating an enterprise solution for our back office. Our goal is to have one singular entry point for common tasks, such as changing an address or reprojecting a ...
0 votes
1 answer
2k views

Entity Framework and static entity instances

I'm always having the problem on how to properly design having static entity instances and it being attached to Entity Framework's Dbcontext. For example, we have the following: using Microsoft....
-2 votes
1 answer
18 views

Migration Of Demo Version Projects to Live Version in .Net MVC Applications

I have an application which is currently used by clients. So based on the feedback from the client, normally we are fixing bugs in a live application.Parallel I am adding new modules to demo projects....
-2 votes
1 answer
975 views

How to implement HTTP PUT correctly

I'm really looking for one good example how to PUT operations should be implemented correctly. What I understood until now: The operation must be idempotent When the resource doesn't exists it will ...
3 votes
1 answer
182 views

.NET shared libraries across team, using TFS and auto-NuGet publishing

My team and I had a discussion about our future architecture, since we've always just written the code that was needed in each separate project, which have now led to extremely redundant code across ...
  • 139
0 votes
1 answer
104 views

How would I use Azure Container Instances to parellelise a task?

I currently have a file processing task that runs on an on-prem VM, it's a .NET executable that also calls other services such as ffmpeg (for videos). As is, the task runs fine, but it's really only ...
1 vote
1 answer
1k views

.NET Core Microservice messaging with Amazon SNS and SQS

So I've done some searching but can't seem to find a whole lot of suggestions on this topic. My question is what are some opinions on the best way to receive messages from an Amazon SQS queue on a ....
  • 158
2 votes
1 answer
777 views

Strategies for managing a dynamically sized pool of worker processes?

I have a problem to solve that's very much like a thread pool, and I was hoping to hear some strategies or find some resources to information on managing the size of the pool. Let's say I have the ...
1 vote
2 answers
94 views

Encapsulating Permissions Logic, but looking to Avoid Circular Dependency

I'm trying to encapsulate permissions logic for a particular view model in a way that the permission logic has access to the view model object, but is also exposed inside of it Trivial Implementation:...
  • 113
3 votes
1 answer
358 views

Is my Architecture correct?

I have a question about architecture in .NET. My architecture is like this : Projet : - DAL (Data Acces Layer) - BLL (Business Logic Layer) - DTO (Data Transfer Object) - IHM (man/machine ...
0 votes
3 answers
900 views

How can I interpret a SQL Check Constraint inside my C# .NET class libary?

I was given a more or less complex task. The goal is to interpret a SQL Check Constraint inside my C# .NET libary. In our case we have a simple UI that displays what is inside the database. We do not ...
1 vote
1 answer
474 views

How can I get rid of this antipattern

I have a main window and I amgetting data from http client service while form load. public class MainWindow: Window { private IClientService service; public MainWindow(IClientService ...
  • 319
1 vote
1 answer
340 views

Problem with business and data access layer design

I am creating a library to interact with third party api.This library will be wrapper around that third party library and i want to expose my wrapper methods to client(webapi,winform,console,mvc etc..)...
0 votes
1 answer
828 views

Distributing C# Dlls to Customers on Application Install

I am currently working on a software library that will be used to develop Class Libraries. These class libraries can be run by our application running on the user's machine The application uses the ...
0 votes
1 answer
669 views

Am I breaking some Onion Architecture rule?

Based on the project structure below i will have some questions Domain Layer 1) MyApp.Domain.Entities (DLL) Product.cs PagedResult.cs Referentes No References 2) MyApp.Domain.Interfaces (DLL) ...
4 votes
2 answers
9k views

Naming conventions for .net C# Unit test projects for better sorting [closed]

I currently use the following naming scheme for my unit test projects.. if I have a project "MyApp", I will have.. -- MyApp -- MyApp.Tests I see this is quite a common practice. Now, the problem is,...
  • 215
3 votes
3 answers
346 views

what is the best way to write a recurring code with different enums

Basically what this code does is to determine whether the user is allowed access to the page or not from list of pages as enum, each one has the role name as its name and the page name inside it. The ...
  • 133
5 votes
1 answer
1k views

How can I resolve circular dependency within service layer in a n-tier architecture system?

I am currently starting a new project with a 4-tier architecture design. The layers is set as follow. +------------------+ +---------...
  • 179
1 vote
2 answers
1k views

Using "On" at the start of a method name

From what I've observed, methods that start with the word "On" fall into two categories: A base class that defines an event will expose a protected method whose name starts with "On" followed by the ...
  • 859
22 votes
3 answers
4k views

What is the purpose of this apparent self reference in C#?

I am evaluating an open source CMS called Piranha (http://piranhacms.org/) for use in one of my projects. I found the following code interesting and a bit confusing, at least to me. Can some help me ...
  • 369
3 votes
1 answer
122 views

Regulations about collecting data from software running at clients hardware (apps 'phoning home') [closed]

We develop an application which has now been installed on a few thousand customers sites. Unfortunately, we have no customer data collection built into the software. This is something we want to ...
  • 49

1 2 3
4
5
29