2
votes
1answer
753 views

Abstract repository implementation

I have a repository abstract class that encapsulates pretty much all of the CRUD functionality: ...
1
vote
1answer
35 views

Unity DI Composition Root vs XML [on hold]

I'm having trouble figuring out the best approach with DI. After doing more research, Mark Seeman recommends using the Composition Root approach. In my example, I am using XML configuration to design ...
4
votes
1answer
71 views

Unit of Work / Repository nHibernate

I have a Unit of Work / Repository pattern in place to abstract away some nHibernate. Most examples I've seen though use the pattern a little differently. In ...
3
votes
3answers
106 views
7
votes
2answers
1k views

Dispose pattern - DisposableObject

I am trying to make an universal implementation of IDisposable (as a base class): ...
5
votes
1answer
61 views

Message Based Communication Design

I'm trying to design an API.NET for some communication purposes with Testing Equipment and I cannot figure out a proper way for designing the architecture. Basically, we have different (physical) ...
3
votes
1answer
62 views

Should I null coalesce EventArgs?

When I implement events, it usually looks something like this: ...
6
votes
1answer
101 views

Abstract Factory Pattern C# Example

I am working through more tutorials on Design Patterns and came across the Abstract Factory Pattern. I extended it out a bit (the example that is) and want your opinion: ...
5
votes
1answer
78 views

Generic Converter framework

I find myself frequently converting between formats so I have come up with the following conversion framework: The converter interface surfaces a method to convert from a source type to a target ...
9
votes
2answers
191 views

Decoration Freak, or OCP in action?

I'm writing C# code to read and eventually parse VB6/VBA code modules. I have an interface like this: ...
3
votes
1answer
3k views

Following Repository Pattern properly

I am new to learning Repository Pattern. I am developing a site in MVC 4 (I'm new to it as well). The way I am using Repository pattern as follows: I created ...
1
vote
0answers
38 views

Is this model a good management for the pattern UOW / Repository with NHibernate?

Searching on Stack Overflow and Google, I find many and many different implementation but none of that really convinced me, each had some small defect that prevented me from using it. So I tried to ...
0
votes
1answer
41 views

Factory Pattern to Abstract Factory Pattern [closed]

My Product Factory public interface IProdctFactory { void Drive(int miles); } My Vehicle Factory ...
2
votes
1answer
86 views

Should my service access layer communicate with my data layer?

I have separated my application into two pieces. The first piece is my core functionality project. The other piece is the UI of the application. The core functionality should communicate with web ...
7
votes
3answers
758 views

Usage of Decorator pattern in baking program

Is this a good usage of Decorator pattern? I'm trying to use Interfaces instead of Abstract classes. (Component) Interface ...
1
vote
0answers
39 views

Feedback for a mostly auto-generated generic data layer

I'm trying to make a reusable data layer that is mostly generated from a database via T4 templates. On top of this data layer, I'd like to have WebAPI endpoints for each repository, with most of the ...
5
votes
3answers
138 views

Abstract factory design for different cars

Is there anything wrong with this? ...
3
votes
2answers
86 views

Is my code overdesigned? Does it rely too heavily on interfaces?

Context: I am using XNA to create a simple game / learning project. Problem: I have three interfaces, each with a different purpose in mind. However, the way I use them, as well as their ...
5
votes
2answers
101 views

UnitOfWork, removing abstraction of abstraction (Repository)

I'm creating a small project, but in the past I've used a Repository pattern for it, and it just seemed too bloated. I ended up having repo classes with huge amounts of queries. I'm trying to move ...
8
votes
2answers
369 views

3 tier architecture ado.net application

I would like to develop a student management system with repository pattern using ado.net (no EF or MVC). I decided to create the model (business objects) and interfaces as one project ...
6
votes
2answers
219 views

Sprite animation for a game

I'm just getting started with XNA and game development in general. I followed these instructions to create a basic game, then this article to get sprite animations working. Now, I'm trying to ...
11
votes
1answer
530 views

Problem: Traffic Flow

I have the following task: The Shallow Alto city council has organized a special committee to review the traffic situation in the city. Despite the fact that there is nothing whatsoever to do ...
1
vote
0answers
51 views

Problem in designing a MVP win forms application

In a module of a win forms application I have a hierarchy of classes like BaseRecovery, LoanRecovery and ...
3
votes
1answer
129 views

Is the following service layer correctly implemented with multiple repositories?

I'm new to design patterns and specifically the Service Layer implementation. I need some clarification on where to use Service Layer calls. Below is an example of what I'm dealing with. I have ...
5
votes
2answers
158 views

Advice on my code for TDD and SOLID principles

I have recently taken a small technical test in C# and the following were expected: All stories to be completed with an appropriate level of testing. No actual database implementation is required, ...
3
votes
3answers
113 views

Using Poor Man's DI to inject helper class dependencies

I had a rather large method in one public class that I refactored into 2 helper classes. The thing is though, that those 2 helper classes have dependencies. I refactored them into helper classes so I ...
-1
votes
1answer
110 views

Should I use inheritance in my case? [closed]

I have 2 classes that should run a service when calling their Start method, but before it they should: Copy items to F folder Open S service in remote server if ...
2
votes
2answers
144 views

Is this method a good candidate for a service layer?

Should the following GetPhysicalFileLocation() method in the Car class have its own Service Layer? ...
3
votes
1answer
129 views

Implementing the Repository Pattern

I'm new to this pattern and I see arguments online about different implementations. I have the following code and it seems fine to me, but I'm wondering if having to pass the DBContext into the ...
4
votes
1answer
90 views

Am I even using the Entity Frameowrk and/or LINQ the way it is supposed to be used?

I feel like just because the below works doesn't mean it is correct, I want to improve it but I can't really figure out how. Besides the fact it is down right ugly I feel the performance could be ...
4
votes
1answer
292 views

Database first entity framework, repository, service, UnitOfWork pattern

I have seperated my project into two projects. One is the web forms project and the other is the Model project with contains a generic repository implementation, a service class for each of my ...
2
votes
1answer
86 views

Is the following repository pattern properly applied?

Is this repository code written according to best practices? The Last Section I included it in the repository as well. ...
8
votes
5answers
371 views

Abstract Pet class

As a student of C# right now, I am trying my best to get a grasp on many of the systems being taught. I just completed Week 1 of a C# 102 class and the class was assigned a bit of homework. I am ...
3
votes
1answer
212 views

Searching text files for string patterns that are each defined in their own classes

I'm trying to implement interfaces in my design but not sure if this is correct or if there is a better way to do it. What I need to do is open a text file keep searching blocks of text until I ...
8
votes
3answers
518 views

Are these endless if statements a bad pattern?

I'm only asking because almost the entire code base I've inherited here, in C# and PHP, looks like this: ...
5
votes
2answers
69 views

Simple factory of a complex object [closed]

I've got few doubts about factory pattern, so I'm looking forward for your review of the following two factories. I've heard that factories should have no state. But what about factories inside ...
2
votes
1answer
92 views

UnitOfWork as Repository object factory

I have done some research about intentions of UnitOfWork pattern. In short, what I understood is that UoW is needed for transactions. But I saw some code examples where people use UoW as factory for ...
6
votes
3answers
130 views

Advice on “Factory” Pattern Implementation

I'm refactoring some code around a couple of ASP.NET Web Forms pages and decided to try out a variation of the Abstract Factory pattern of my own design. I need to create an implementer of an abstract ...
4
votes
1answer
64 views

Should I create two seperate Services and then combine them or have one large?

Basically, I have two separate tables, Campaign and CampaignDetails. They relate via CampaignID. I want a service that can handle both at the same time, as they're closely related and when one gets ...
7
votes
1answer
2k views

Simple example of N-Tier, entity framework, unit of work, repository, business logic layer

I've been studying C# for about 6 months and am trying to make a simple example for an n-tier application. I want to learn to do things in the most proper and professional way. This example uses a ...
7
votes
3answers
519 views

Lots of repeating code, trouble refactoring

I'm looking for a design pattern or suggestions that can help refactor my code into something a bit less repetitive. I have a method that has several sequential steps (10-15) that if any of them fail ...
2
votes
2answers
79 views

How to declutter dependencies?

I'm running into a problem with my code in a ASP.NET MVC application. Maybe it's not a problem and I'm just being paranoid, but it seems like a problem to me (might be because I've just read the book ...
6
votes
1answer
1k views

How to improve my factory design?

I'm creating a factory design for math problems. The idea which I have is: When the factory initializes, creates in a list some problems (20 initially) If the program wants more than 20, the list ...
2
votes
1answer
82 views

Are there any improvements I can make to my implementation of the strategy pattern?

I'm not sure about that if else statement in function Change(). I'm guessing there is a way to eliminate this and make better use of OOP principles. Does anyone have any suggestions? PS This code ...
13
votes
3answers
649 views

Is decoupling necessary for very small applications?

I threw together a small solution for my organization today for some basic data review and approval procedures. This particular application will likely not change or add functionality at any time. ...
10
votes
3answers
388 views

Design pattern for implementing multiple data sources

I've written a program to populate a particular object from multiple data sources, however I'm not convinced I'm going about this in the right way: I have no idea which (if any) design pattern I ...
8
votes
1answer
469 views

DTO pattern: what is the right way to tell client that there is no result?

This is how I handle this situation right now: For example, I have service that returns UserDto by user ID: GetUserById. Service never returns null or throws exceptions. Service always returns DTO ...
1
vote
0answers
1k views

Code First/Database First Entity Framework MVC [closed]

The following example is taken from the book Pro ASP.NET MVC 4 - Adam Freeman. This book does a good job going over the basics of the MVC framework. In it a ...
11
votes
2answers
134 views

Simple specific classes design

I am new to c#, and rather new to design-patterns. I want to create a simple and a most elegant solution for loading and validating a xml file and later on extracting its fields. I've started with a ...
9
votes
2answers
365 views

Implementation of the Strategy Pattern using an interface, abstract class and delegate

The following class was designed to help create a more detailed error message than what's provided by the repository when a user tries to insert text into a column that is > the column max length. The ...