All Questions
Tagged with factory-pattern c#
7 questions
1
vote
1
answer
446
views
C# how to implement a factory class which doesn't require an argument passed to indicate objects type?
I currently working on a parser project in C# and have run into problem.
I have an entity folder within my project and within it I have:
Entity
IEntity.cs (defines a contract for entity classes)
...
-2
votes
1
answer
657
views
How to implement factory pattern in following case?
I have a program which downloads web pages and then scrapes html to create domain specific collection objects e.g. ProductCollection, CatalogCollection, NewsCollection and more. The idea is to create ...
0
votes
2
answers
2k
views
Combining synchronous and asynchronous commands when using the command pattern
Let's say I'm building a simple console app which has three commands:
Create category.
Download recipe from API to category.
Display all recipes in a category.
Assuming the app will grow, I use the ...
0
votes
2
answers
136
views
Should I refactor this class to use a Factory?
Given the following class in a Legacy code base without any UT's.
So any refactoring done should be done on the smallest possible scale, just in order to be able to write UT's.
public class Person
{
...
16
votes
4
answers
25k
views
Should I use the Factory Pattern when instantiating objects with very different constructors?
Let's say (just for the sake of example) I have three classes that implement IShape. One is a Square with a constructor of Square(int length). Second is a Triangle with a constructor of Triangle(int ...
0
votes
3
answers
2k
views
Can Aggregate Root Factory create the root, and it's internal classes?
Currently, my aggregates and value objects have protected constructors and some of them are being created by static factory methods inside the aggregate with descriptive names. It creates a nice DSL ...
-1
votes
2
answers
164
views
How to Avoid Missed Behaviors when Separating Code from Data
I've come across something that I find decently frustrating while adding new functionality to our large existing code base.
Preface
We have a variety of classes (ItemA, ItemB, ItemC...) that ...