All Questions
15 questions
-2
votes
1
answer
163
views
Best Practices for Managing Multiple Entity Types in ASP.NET Core
I'm working on an ASP.NET Core application that requires handling multiple types of a single entity. Each type has its own properties and validation rules, which has led to confusion and complexity in ...
0
votes
1
answer
370
views
How best to share common steps between services while allowing them to provide their own behaviour
I've started working on a C# codebase. There are three services which run the same set of steps of three kinds of objects, each returning IResult:
public IResult FooService(Foo foo) { ... }
public ...
1
vote
3
answers
222
views
When implementing new features that are similar to other features, do you make the older features more generic?
This may come off as a bit confusing, but it's a question that I keep finding myself asking as I pile on more and more responsibility to older systems and features that I designed previously. Trying ...
1
vote
1
answer
259
views
Is it good practice to use data API for access cross platform
All,
Question: Should I have a common data access API between various cross platform applications or keep the data access specific to the UI even though it would result in duplication?
Background: ...
-1
votes
1
answer
2k
views
Generic method with different arguments
In the following scenario:
A factory returns an object of a logic class:
ILogicClass object = factory.GetByRequirements(reqs);
I then want to invoke a method and get some results which are in the ...
12
votes
4
answers
3k
views
How do I wrap a service so it is simpler
We have a dependency to a third-party service which exposes a gigantic interface of which we only need like 3 methods. Additionally, the interface changes frequently...
I've decided to wrap the ...
1
vote
1
answer
64
views
Where does my GetOrderNumber logic sit in a layered approach?
In a good layered design of an application, where would logic that generates an order number for an order entity sit?
The logic will need to lookup and increment either a sequence or a table with ...
9
votes
3
answers
18k
views
Should I create .Clone() on a class or create a copy-constructor?
I'm quite unsure what I should use in C# - both should in theory do the same, but I think both are quite easely overseen. Or is there another possibility I have to take in consideration?
I know in C++...
1
vote
2
answers
696
views
Is it a good idea having default static variables for new instances?
OK let's say I have something like this:
public class MyObject {
public static int DefaultValue = 9
private int _value = DefaultValue;
public int Value { get { return _value; } set { ...
2
votes
2
answers
1k
views
WCF service with methods to fetch data
I'm planning on building a WCF service that will fetch data entities from a Sql Server database. And I'm currently struggling with best practices issues.
The thing is that there's a few different ...
2
votes
1
answer
654
views
How much trouble can the use of Singleton class as Model cause?
In my latest WPF applications I've been using a Singleton class, that I call Model, to contain all my application's logic, such as file reading, information handling, etc..
In the WPF Views or ...
1
vote
3
answers
782
views
C# Subject Observer Architecture question
I'm making a C# application using the Subject Observer design pattern in a slightly different way.
I am passing the Provider Class, implementing IObservable (this has the OnNext() method that ...
0
votes
1
answer
269
views
What is the correct way to bind few classes with similar functionality?
I want to do this in the right way to learn
I have a few classes which have only one method. For example:
public class RedColorText
{
public void AddRedColorText(string text)
{
//...
3
votes
1
answer
137
views
Development console commands registration
I have a DevelopmentConsole class. I am making functionality to register console commands for the subsystems. I don't want the console to know about them but also I don't want them to contain a debug ...
6
votes
5
answers
582
views
Why would a developer create a public class that has all static properties?
A previous developer has a couple public classes that do not inherit from any other classes but are filled with static properties. Is this another way of creating a struct or enum? Is this an older or ...