Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c#]

C# is a multiparadigm, managed, garbage-collected object-oriented programming language created by Microsoft in parallel with the .NET platform

0
votes
1answer
149 views

DDD - Factory or Service?

I'm new to DDD, and I'm confused at the very start of my DDD project. To setup a context, I'm building the user management part of my app, so I'm building my Account entity, which contains an Id, a ...
2
votes
1answer
63 views

Redesign Issue (Multiple Inheritance without Multiple Inheritance)

I am currently working on a game engine for work and have hit a wall on my idea. I have multiple objects (called prefabs) that have very common properties such as Position, Rotation, and Scale. There ...
-1
votes
1answer
90 views

Downcastings refactored using generics

I am willing to refactor some code that acts like a controller class executing work embedded in other classes. On one side it looks good as the controller is generic and what changes has been well ...
0
votes
1answer
121 views

Onion architecture applied to an .NET application

I am trying to figure out how to translate the onion architecture into an ASP.NET Core WebAPI solution, this is what I ended up with: Let's say I have an application that takes a file path / uri into ...
2
votes
2answers
96 views

Do “Unused” Variables In A View Model Get Passed To The Client In MVC?

Let's say i've got the following absurd viewmodel in a MVC application. public class Absurd { public string WelcomeMessage {get; set;} public string PlainTextAdminPassword {get; set;} } And this ...
3
votes
1answer
141 views

Application_Start() vs ApplicationStart()

Why is the method in Global.asax called Application_Start() and not ApplicationStart()? According to MSDN method names should be in Pascal case.
1
vote
3answers
220 views

What is the difference in these two code examples c#

Can someone explain to me why one is necessarily better than the other? int M() { int y; LocalFunction(); return y; void LocalFunction() => y = 0; } Versus int M() { return ...
0
votes
0answers
43 views

Writing an effective communications handler

The application I'm writing is showing signs of stress when under heavy load from multiple serial communications interfaces. So I'm looking at ways to improve performance. I've made a simplified ...
14
votes
4answers
3k views

How do I efficiently search for all the landmarks within a range of a certain landmark?

I am trying to start with a geo search project that will find all landmarks in the 10 km/miles (not important for this story) of a particular landmark. So for example, lets say I have a database of a ...
1
vote
0answers
63 views

Name matching in SWIFT messages

Here i am basically looking for performance improvement. I need to match names in a SWIFT message (Let's say MT 103) against sanctions lists (sanctions lists by UN, by OFAC, some custom lists) and ...
18
votes
2answers
576 views

.NET Self Reference

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 ...
1
vote
1answer
32 views

NUnit specify TestCaseAttribute on implementation or create a test method

Based on this question about the correct usage of nUnit's TestCaseAttribute, I was wondering whether to specify the test case directly on the implementation or create test methods (as when using ...
-1
votes
1answer
164 views

Creating a CMD like program (Command Line Parser)

I am creating a CMD like program where the user manage his "drive" with commands. I would like to know if there is a way of doing this type of application in a easier/better way. Actually I'm doing ...
3
votes
1answer
110 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 ...
-1
votes
1answer
78 views

Mapping Data Transfer Objects to my Model Class

//This represents my rows in my database public class PersonModel { public int Id{get;set;} public string FirstName{get;set;} public string LastName{get;set;} public DateTime CreatedBy{...
0
votes
4answers
182 views

Preferred method of accessing an external class of methods through the original class

I want to move a bunch of similar methods to an external class. The class is initialized with the original class instance. From there I can access it either by property (persistent instance) or by ...
3
votes
0answers
49 views

Using Active Directory ObjectSid as Primary Key in SQL Server for Data Access via ASP.NET MVC

I am designing an Intranet employee reward web app using ASP.NET MVC C#/MS SQL Server. This will only be accessed from within the network. Employees and managers will be able to give a reward to ...
2
votes
1answer
132 views

How should I design a 3-tier-architecture application with Entity Framework?

This is almost getting me crazy. EF bring us a very convenience experience in development. However, if we need to use the Entity model in the upper layer, we always put a reference from the upper ...
2
votes
0answers
58 views

Propagating Data to multiple ViewModels - C#

I'm a bit new to MVVM, but here's my dilemma: I have a model (or models, but let's keep it simple) I want to show that model data on multiple different views. Ok, so ViewModel for each view gets ...
9
votes
3answers
491 views

Why usage of assignment operator or loops discouraged in functional programming?

If my function meets below two requirements, I believe function Sum to return the summation of items in a list where item evaluates to true for given condition qualifies to be referred as pure ...
1
vote
2answers
68 views

Is it okay for async function to update a common object

I have a couple of functions, each function verifies a set of rules and updates a common object. The common object is just a container that holds a list of rules that passed or failed. I would like to ...
0
votes
0answers
36 views

Choice between PUT and a separate request for each change for CRUD-based UI

I'm making an HTTP API for ASP.NET Core Identity. Basically what I want is a remote version of this: https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.usermanager-1?view=...
0
votes
0answers
25 views

Design for Handling Spatial Data using EF Core and MySql

So EF Core support for spatial data is practically nonexistent at the moment. The majority of work that has been done is about to drop in the 2.2 Preview 3 which is fantastic news. However, it's ...
0
votes
3answers
230 views

Calculating the total price of items in a shopping cart

I am making a shopping cart. A shopping cart will have a total amount of money you've got to pay for the products you've selected. I'd like to approach the problem using both OOP (encapsulating it) ...
4
votes
2answers
272 views

Function that returns non parameter functions

I found a function in c# like this: private Dictionary<string, Func<string>> ObtenerExtraCfgCampo(MsgDefCamp camp) { var extra = new Dictionary<string, Func<string>&...
2
votes
5answers
520 views

Is it safe to put SQL statements in my C# application?

I'm making a medium sized application to be distributed privately to several Churches. It connects to an Azure database but it does not have any server managing the information (apart from the SQL ...
3
votes
2answers
65 views

Custom messages to UI from DAL?

I have an Asp.net MVC application and sometimes I want to give a descriptive error message to the user, but the condition of it is discovered at the Data Access Layer (DAL). So for example, I have a ...
1
vote
2answers
153 views

How should I Implement a general method that could be used across several view models?

Currently I have implemented a method in to a model to take a screen shot like so E.G. Interface public interface ICapture { void CaptureMethod(); } This is the model that implements that ...
0
votes
1answer
33 views

Json Deserialization Override Property

Calling out the tech: C#, Newtonsoft.Json. We have a class which contains a property named SchemaVersion that we use to inform of the Json document version once that object is ultimately serialized ...
4
votes
1answer
136 views

What tactics to use to load the referenced data in repository implementation?

Say that I have a repository that is used as READ-ONLY data provides (never for the writes/updates) - the query part of the CQS, NO event sourcing, hitting relational DB. One of the essential rules - ...
-1
votes
1answer
40 views

Writing a blog post website with markdown

so I'm working on a website project with the goal of writing my own blog posts with markdown syntax. I made some thoughts regarding the handling of the markdown and the conversion to HTML, storage ...
4
votes
1answer
181 views

Where is it better to implement Copy/Cut/Paste in MVVM?

I am working on a project using C#/WPF and following MVVM pattern. This project is designed for touch screens. The major objects of the program are the following: We have Programs which contain ...
-1
votes
4answers
301 views

Alternatives to Long Loops [closed]

I am part of a software team that is writing a console application (no UI) in C#. My part in the team is to write code to call RESTful APIs from a third party site, process the returned data and save ...
1
vote
2answers
126 views

Single database call and iterate in memory vs multiple database calls and multiple smaller iterations

I'm designing a new application that is very basic however I expect it to grow and don't want to have to refactor down the line. My challenge is that in one method, I either need to retrieve thousands ...
1
vote
4answers
321 views

How to return fluently?

I'm becoming addicted to writing fluently (perhaps incorrectly originally said "declaratively") and I'm taking it to possibly unwise extremes, but the more I write this way the more one thing stands ...
0
votes
2answers
118 views

Using new [className] without a return

I have started using the following in my automation code in instances where I'm not interested in keeping the object 'alive'and just using it as a means as a type of precondition. For example: ...
-1
votes
1answer
180 views

Is there a design for C# that removes the need for dynamic?

I have a web service that implements Repository Pattern and I was wondering if there is a design in C# that can remove the need for 'dynamic' when injecting it in my method. public interface ...
1
vote
1answer
110 views

Handling application-wide notifications from various layers of the application?

I have recently started updating portions of our corporate platform, and I've been trying to find ways to make the entire platform more efficient, better structured, and just cleaner in general. With ...
3
votes
1answer
144 views

Single responsibility of Program class in C#

I do not follow SOLID strictly in general, but I do try making sure to separate responsibilities of my classes. I was developing a small app with a Windows service powered by Topshelf and realized ...
0
votes
1answer
161 views

How to design thread safe class when separating business logic from POCOs

I like to separate business logic out of POCOs into controllers. If an object must be thread safe, where do I put the lock code? In the POCO itself? Or in a controller? Might make sense because ...
2
votes
1answer
124 views

Is there a name for a server/client relationship where the client doesn't request, but will reply to the server's requests?

Disclaimer: I'm sure this has been asked here before, but I haven't been able to find it. I'm trying to create a system where one central computer (master) can initiate commands on other computers (...
0
votes
1answer
101 views

What HTTP action and return value should be used on resource's action

I have a question about how I should implement a new action for a resource on my API layer. I have a Timesheet which is used by people to let us know how many hours they worked on a job. This ...
1
vote
1answer
94 views

Making type conversions better readable

If you create a function, which should make the use of typeconversions more easy, but it maybe leads to more errors, would implement it globally, and what may speaks against it - when the readability ...
2
votes
0answers
108 views

Delta Updating, what it is, how to implement it, where is it found? [closed]

I am not sure where this is going to go, and I am not sure if this is even the right Stack group to be posting in for this matter. But simply I want to create from scratch using my knowledge of C# a ...
0
votes
2answers
158 views

How to create secure desktop installer that doesn't trigger a virus alert for unknown exe?

When I created a c# desktop application and move the exe file to another computer that has anti virus security, the security program shows an alert as unknown exe. I want to create a desktop ...
-1
votes
1answer
93 views

Giving Viewmodels access to application wide Model in MVVM

I am practicing building applications using MVVM and WPF+C# by making a "finance application". The application contains several views with their own ViewModels. The views are in a hierarchy and are ...
3
votes
3answers
452 views

Multithreading ( thread per area ) for an MMO server, good idea?

As a personal project, I'm setting up a MMO, and writing the server in C#/.NET Core. As of now my architecture is as follows: The world exists of different areas ( you can go from area to area trough ...
-1
votes
1answer
73 views

Creating a mobile app based on the ASP.NET Core website

Coming from Desktop development, I'm in the middle of my very first web project (as a small side/learning-project). I'm using ASP.NET Core 2. I'm already thinking about going mobile too. What are my ...
-1
votes
1answer
68 views

Where should domain events be added: in entities or aggregate roots?

I'm designing the base classes and I don't know if I should add the field 'domainEvents' to the Entity class or only to the AggregateRoot class. I must add the code for add and remove events in ...
0
votes
1answer
142 views

DDD - How to do informative validation (specifically on entity creation)?

For my domain entities currently, all validation errors cause exceptions to be thrown. I don't like this as it doesn't allow me to compile all validation errors before exiting a method. I'd like to ...