Stack Exchange Network

Stack Exchange network consists of 175 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

5
votes
0answers
3k views

Option<T> functional type implementation and scenarios

Have you ever being implementing Option<T> functional type? It is discussed here: https://app.pluralsight.com/library/courses/tactical-design-patterns-dot-net-control-flow/table-of-contents ...
3
votes
0answers
3k views

Unit Of Work with multiple database context

I have created an application (net core 2 & ef core) with Unit Of Work and Generic repository pattern. I used to have one database context but due to some business logic I had to create a second ...
3
votes
0answers
137 views

C#: simulate PostScript memory allocation

I'm working on a PostScript interpreter in C#. PostScript has memory management. It has virtual memory (VM). It also has objects. Two types of objects: simple and composite objects. Composite ...
3
votes
0answers
101 views

Dictionary-Sorting in bigger projects

My concern is how to handle ResourceDictionarys in a WPF (MVVM)-Project. I usually only create small Projects, so it doesn't matter that much, but since I created a Project-Template to handle some of ...
3
votes
0answers
437 views

Separate settings and implementation class hierarchies

We use XML serialization to store class settings. Each setting-class has (but doesn't reference) corresponding implementation-class. Therefore we can easily make a "settings dll" without any ...
3
votes
0answers
2k views

Any “Gotchas” to using Entity Framework for Identity & Dapper for all other DB access in a .NET MVC application?

I'm firing up an MVC project in which I'd really like to use Dapper as my ORM, as I like to be as close to the database as possible for performance and SQL tweaking reasons, yet still have the power ...
3
votes
0answers
4k views

Should UserControl's be Views in an XAML MVVM application (WPF or Store app)?

I am about to use Caliburn.Micro for a new XAML Store app (not sure what to call it nowadays - does not appear to be called a "Windows Store app" any longer). The documentation (see Simple Navigation ...
2
votes
0answers
62 views

How should domain model entities expose information about the current state of their properties?

I'm new to DDD, so please bear with me. I am trying to design a domain model around an extremely large and complex existing system, where most of the current "domain" logic is either in the UI or in ...
2
votes
0answers
31 views

Can the read api receive events that the write api does not receive or raise?

Say I have a read API and a write API: MyApp.Write.api MyApp.Read.api Both API's handle integration events from other apis/microservices. Say I had certain integration events that only need to be ...
2
votes
0answers
196 views

LSH for a wordlist

I am trying to write a spellchecker, I have a huge wordlist (at least 500K, because of the nature of the language). The performance would suffer a lot if I got the lavenshtein distance of all of the ...
2
votes
0answers
176 views

Displaying entity framework calls in Sequence Diagram

I have a controller action which gets all the Plants by location from the database puts it inside a view model and passes it to the view. public ActionResult index() { List<Plant> plants = ...
2
votes
0answers
1k views

Best practice for transaction handling using Entity Framework

I am developing an app which uses Entity Framework for data access. The architecture of the app somewhat like below: As depicted in the drawing, the business service can be consumed from either web ...
2
votes
0answers
75 views

Is there a name for this Registry-Slot-Updaters pattern?

I noticed a pattern in my code. It applies to situations where things can be selected. It revolves around classes which I call (and in code often suffix with) Registry, Slot and Updater. Registry ...
2
votes
0answers
248 views

Replication between SQL server and Couchbase Lite

We have a main MS Sql server. This is the main data source that delivers and receives data to and from backend administration and (in development) mobile software. We need to make a connection to ...
2
votes
0answers
125 views

A / B testing without seperate deployments

I am part of a development team producing a project which requires many rounds of iterative development, each of which must be user tested, frequently in an A/B kind of environment. In our deployment ...
2
votes
0answers
697 views

Reading and saving big data to db

I have a method for reading data from file. The problem is how to handle files that are too big for a simple read and save to database? I was thinking about reading a chunk of it and saving it to ...
2
votes
0answers
162 views

Proper pattern to use when sharing large amounts of code and a similar control flow?

So I'm currently building an application that allows a user to fill out paperwork digitally, and then that information is taken in by the server and a PDF is populated and returned to the user. The ...
2
votes
0answers
830 views

Traditional installer for a WinForms application

What is the preferred method of creating a "normal" traditional installer for a .NET WinForms application? I'm using VS 2015 which comes without a template for such a deployment project. I installed ...
2
votes
0answers
393 views

Multiple Entity Business Logic/Changes, C# MVC Repository Pattern

I have a standard C# MVC project which has a domain layer using EF and repository pattern. Say I have a model like: public class MainModel { public int MainModelID {get; set;} //Many other ...
2
votes
0answers
568 views

Creating a generic Cache solution for function calls using SOLID principles in C#

I would like to have a caching solution for a variety of function calls. All of the function calls fit the following signature public ResponseType ProcessRequest(RequestType request); About half ...
2
votes
0answers
190 views

Data pipeline with fallbacks and callbacks

I'm refactoring our current design for how we download static data. It's a mess of deep class hierarchy and callback hell and I want to convert it to a more elegant straightforward design. Here are ...
2
votes
0answers
2k views

Generic Type Parameters where one is itself Generic with a Type Parameter of the Other

I have a couple of classes with the following pattern that I am uncomfortable with. Is this the only way to do this, or are their other design patterns that would be more reliable. public class ...
2
votes
0answers
643 views

Correct Class Design for EAV Model

I need to design a class model to represent an EAV Model. I based my classes on this presentation http://www.slideshare.net/stepanyuk/implementation-of-eav-pattern-for-activerecord-models-13263311?...
2
votes
0answers
997 views

How to Use Python as a “Macro” runner for a C# Application

I am working on an application that the user may wish to automate some features of (but we don't know what at the moment) I would like to provide them some kind of scripting interface so they can play ...
2
votes
0answers
1k views

TryUpdateModel vs Parameter and ModelState.IsValid

As I was originally learning about MVC, the book I was using taught the following technique for Controller actions: public ActionResult MethodName(Model model) { if (ModelState.IsValid) { } ...
2
votes
0answers
306 views

Handling permissions in a MVP application

In a windows forms payroll application employing MVP pattern (for a small scale client) I'm planing user permission handling as follows (permission based) as basically its implementation should be ...
2
votes
0answers
2k views

Best Practice Method for Including Images in a DataGrid using MVVM

All, I have a WPF DataGrid. This DataGrid shows files ready for compilation and should also show the progress of my compiler as it compiles the files. The format of the DataGrid is Image|File Path |...
2
votes
0answers
796 views

An efficient way of starting an arbitrary number of consumer threads?

I have a Producer/Consumer implementation where the number of consumers is configurable (this is a form of configurable throttling). The producer and consumer are kicked off like this: var cts = new ...
2
votes
0answers
504 views

State Pattern Code for embedded device - Dependency Injection of Device Objects in Context and State Classes

I'm wrestling with some code and I think I've finally gotten some state pattern code working with my events. I've got a simplified system that will work like this: This is my first go with State ...
2
votes
0answers
148 views

Run a function when a function in a list is executed?

Goal: I'm currently doing an MVC project and I have this method to update the ViewBag (based on previous actions of the user). I would like to call this function whenever a certain list of MVC Actions ...
2
votes
0answers
344 views

Match buyers and sellers based on date ranges and quantity of shares

NOTE: This is in reference to the question I asked on Stack Overflow but was told to post this here I'm building a trading application that matches buyers/sellers that own subscription. Subscriptions ...
2
votes
0answers
677 views

SMTP traffic forward/relay?

We have three different networks. Regular, Trusted, Secure. Regular has access to the internet and trusted. Trusted has access to regular, internet and Secure. Secure has access to Trusted. We used ...
2
votes
0answers
761 views

ASP.NET Mvc3 - application/request lifetime and dependency injection

I thought of asking on SO, but it seems this is more of a "concept" type question than a "problem" type question. If it needs to be moved, please do so. Anyway, I'm having a tough time finding ...
1
vote
0answers
51 views

Should I use gRpc in my business layer?

I'm moving from REST APIs to gRpc but having a hard time figuring out how to structure my logic. The basic layout of my solution is having a business layer/API and a few different front-ends (Windows ...
1
vote
0answers
83 views

Hints about analyzing single (huge) C# class using SonarQube and related issues

I'm doing an internship into a small company which is working on part of a systems which runs on a base already written by another company (many company are working on the same project) which is ...
1
vote
0answers
29 views

What should be the code architecture to download and cache offline data (Images/Videos/3d Models)?

I'm developing an application which has a 3D room. Each room is a 3d model and can contain media boards. each media board contains image(s) as slides or video. I have created following Data Models : ...
1
vote
0answers
70 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 ...
1
vote
0answers
70 views

Hierarchy of models while designing a client for a RESTful service

I am trying to write a client for a restful service. I am confused in designing the models. Below are the details: I have a Model named UnicastMessageRequest, it's definition is like this: ...
1
vote
0answers
74 views

Is there a pattern/cleaner way of saving a large object with multiple nested classes?

I'm in the midst of a rather large project which involves decomposing a very old and large ColdFusion legacy application and creating some .NET services in it's place. Due to this, there are some ...
1
vote
0answers
75 views

How to design the Unity Container?

I have three projects: WebAPI, Services and Repository. WebAPI has a reference to Services and Services has reference to Repository. Now I need to add a Unity Container for Services and ...
1
vote
0answers
626 views

Where should I put my enums and interfaces?

I have an asp core MVC project for a college and I would like to implement a timetabling feature. To see if I could successfully even generate a dynamic HTML timetable, I started playing around in a ...
1
vote
0answers
64 views

Decoupling pdf rendering into a reusable assembly / using different rendering strategies

We have two apps: desktop client & mvc backend. Both apps have printing functionality. And it's quite obvious that we're repeating ourselves with that. Let me explain this. The routine looks as ...
1
vote
0answers
36 views

Capturing data based on index

I have developed a program to read through text in files and capture information, and write it into a CSV. Each "field" is identified by an index, a label, and a value, like so: .0 index .0....
1
vote
0answers
278 views

IoC - Should I use child containers to create scoped dependencies?

I have a number of command handlers defined for doing work against databases on various servers in our network. I am wondering if I should design each command to pass the following information in the ...
1
vote
0answers
69 views

Unit testing EventArgs - will there be timing issues?

I am writing a small game library. I capsule the logic in my model named Block. My model Block communicates only via events to it's clients (Is this a good thing to do!?). I wrote a simple unit test ...
1
vote
0answers
79 views

What is the best way to implement an HTTP endpoint with different return types?

I need to make an HTTP endpoint with different return types based on query params. There are several options to do that: Return an object with one property set and the rest equal to null: public ...
1
vote
0answers
46 views

Architecture for Product rate assigning to multiple store group. C#

I am writting a module where i am creating a rate for a list of product, and the rate for the product are assigned to different Store. The rate can be created in a group of Store, with Multiple Store,...
1
vote
0answers
390 views

Multi-Tenant & Multi-Object Permision Suggestions

I am looking for suggestions/examples on how to setup permissions for my project. I am using ASP.NET Core 2.0 with EF Identity 2 (on one server) and will be using IdentityServer4 (secondary server) as ...
1
vote
0answers
377 views

Moving Role CRUD operations from the Controller to the Application Service

I am creating an administration facility for an asp.net MVC application. I am currently trying to create a form that will allow admin users to create roles. I see plenty of code, which looks like ...
1
vote
0answers
197 views

inject repository into unit of work

Please see the code below: public IUnitOfWork<PersonEntities> Create(IRepository<PersonDTO> repository) { var context = new PersonEntities(); var ...