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
8 views

Cloud to device messaging

In the past days I was focussing on the IoT environment and now I was moving into the practice. I found a lot of services that helps with the implementation of it like Azure IoT Hub. Now before ...
1
vote
2answers
43 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
30 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
14 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
125 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
214 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
3answers
272 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 ...
2
votes
1answer
31 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
146 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
28 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 ...
1
vote
0answers
22 views

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

Say that I have a repositories that are 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 ...
-1
votes
1answer
34 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
133 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
263 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
92 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
309 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
91 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: ...
0
votes
1answer
148 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
77 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
137 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
83 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
98 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
59 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
66 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
73 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
118 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 ...
0
votes
1answer
69 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
424 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
28 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
56 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
55 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 ...
0
votes
0answers
32 views

Storing self-expiring items in redis and getting all of them

I need to place some data into redis so that each element has a sliding expiration (say 60 seconds each). I also need to be able to get a list of all elements that are currently in Redis. Initially ...
0
votes
1answer
40 views

Wrapping WCF client with Stream for disposing

I need to consume data from a WCF service, which pipes it through a stream. The data itself is contents of an archive file, so it needs additional logic, which I am splitting off into a separate class....
-1
votes
3answers
164 views

What is a CRUD system?

I am learning Event Sourcing in my spare time. I see lots of references to 'CRUD type systems' online. I understand a CRUD type system to be: 1) A database driven system (website or application) i....
2
votes
3answers
283 views

What are the benefits of local instance variables?

I have a tendency to invoke methods directly on a new class instance like this: new Person().GetAge() when I don't need the instance of the class (here Person) after the invocation. However, I have ...
0
votes
0answers
30 views

Should I use the same class for the configuration and the runtime object representing the same entity?

I am building an reporting application. The database already exists, is populated by an other system, and contains an 'cuurent balance' table, with columns CustomerId and CurrentBalance In the ...
1
vote
2answers
88 views

Performing serial communication in constructor to initialize an object

I have a class UnitInfo which represents a collection of unit information with methods to get the unit information in a structured way, such as a specific encoding, etc. This unit info consists of ...
0
votes
1answer
118 views

Should I avoid nested generic collections?

I recently came across a dictionary with lists for values passed as an argument: Demo(Dictionary<string, List<string>> arg) It got me thinking---normally I would abstract any list or ...
0
votes
1answer
79 views

How to interpret Dependency Inversion Principle

I am working on trying to understand the SOLID object oriented design principles. I was able to get the "SOL" pretty easily, though "L" required some hand holding because I am bad at definitions. I ...
1
vote
1answer
90 views

Do we really need SerializableAttribute?

I understand we need it to mark a class whose objects can be serialized, but do we strictly need this for behind the hood logic to work? We could just serialize the object using necessary methods. On ...
0
votes
1answer
78 views

Time-based Task scheduler engine

I am working on an enterprise level application. I have an event table in the database. I need to update my events' states in the database on a precise date and time. There may be 200 milliseconds ...
1
vote
2answers
105 views

Should it be a claim, a role or a policy?

The distinction between roles and claims is that roles describe a set of users and claims describe a property of a user. So there can be a role "Administrator", but there can also be a claim "...
3
votes
2answers
85 views

Separating Domain Object and Data Models

I looked through a lot of articles, blogs, and SO topics about separating domain object and data models. Almost every answer said: You should have separate classes for the domain and data persistence, ...
0
votes
2answers
136 views

Unit Test a CRUD Controller MVC

I have looked through answers related to this but they don't seem to solve my problem. I am fairly new unit testing and testing as a whole. I just finished a small web application using ASP.NET Core ...
4
votes
1answer
186 views

How to have multiple source copies of a dependency in a C# git project?

In our company, we develop information system software in C#.NET, which has client-server-module architecture. Module project does not depend directly on server/client project, but only on shared ...
-1
votes
0answers
42 views

Xamarin.Forms: How to manage the images?

I want to use a lot of images in my Xamarin.forms App and I want to remain flexible to possible changes. The images could change, but not their names. I want to locate the images in a separate ...
1
vote
3answers
84 views

Catch statements with other Business Logic in Parsing Files

I am writing a simple program to parse a text file and place into Generic List. Sample Text: 1,Joe,CA,58,2 2,Matt,TX,63,5 Sometimes, there may be an error, with missing data in the file 1,Joe,CA,...
0
votes
1answer
46 views

How should I separate File Parse Classes?

I want to understand different ways to object design classes. I have three different classes. Generally I am creating a file parser. The classes: CustomerData - which shows text Data Model. A File ...
2
votes
1answer
73 views

What's the best way to design batch job type processing

I'm working on a portion of an ERP system where I need to process data in a way that's similar to a series of batch jobs, and I'm struggling with deciding the best program architecture to use. I'm ...
-2
votes
0answers
24 views

Trying to think through a helper (or middleware) application

All: Here's what I'd like to do. (using c# / Universal Windows) Our business has a number of devices (industrial manufacturing - meters, test equipment...) used by our staff. I've written a series ...