Hi,
I need to implement the classic Factory Method pattern in ASP.NET to create server controls dynamically.
The only way I've found to create .ascx controls is to use the LoadControl method of the Page/UserControl classes. I find it messy however to link my factory with a page or to pass a page parameter to the factory.
Does anybody ...
Ok so I've ordered Applying Domain-Driven Design and Patterns: Using .Net, but while I wait for it to arrive I'm looking at starting to apply the techniques in my current project. I really grasp the concepts quite well now, but when I try to apply them I get caught up with the execution and end up leaking my respsonsibilities across the ...
I am implementing long running processes that require to a process bar - or progress percentage - to be displayed. The overall logic of the long running process is complex (various paged data retrieval), and as a result, I end up hardcoding lots of percentages in various places within the code.
What are considered as the best design pat...
In C# I sometimes wish I could make special methods for certain "instantiations" of generic classes.
UPDATE: The following code is just a dumb example of a more abstract problem - don't focus too much on time series, just the principles of "adding extra methods" for certain T.
Example:
class Timeseries<T>
{
...
TimeSeries<T>...
I'm trying to use the Visitor Pattern and I have as follows:
public class EnumerableActions<T> : IEnumerableActions<T>
{
private IEnumerable<T> itemsToActOn;
public EnumerableActions ( IEnumerable<T> itemsToActOn )
{
this.itemsToActOn = itemsToActOn;
}
public void VisitAllItemsUsing ( IVisitor<T> visitor )
{
foreach (T t in items...
I've seen two different implementation of memento on .NET.
One is pretty straightforward - The object creates another instance of itself.
The other is serializing the object using BinaryFormatter and MemoryStream.
Which is the preferred method? Can anyone point out advantages/disadvantages of each approach?
...
I want to start using dependency injection in my WPF application, largely for better unit testability. My app is mostly constructed along the M-V-VM pattern.
I'm looking at autofac for my IoC container, but I don't think that matters too much for this disucssion.
Injecting a service into the start window seems straightforward, as I can...
I want to start building more testable web apps, unfortunately I am not able to go with Microsofts MVC framework just yet. So I am looking advice. What UI pattern do you guys use with asp.net apps, and how do you implement them?
I do understand patterns like MVP, MVC, etc., but I don't have any experience implementing them, so any input...
I am building an application that is very similar to a shopping cart. The user selects a product from a list, and then based on that product, a few properties need to be set and saved.
Example.
If the user selects a type of paint that allows custom color matches, then I must allow them to enter in a formula number that they received t...
Except perhaps at bigger (or better) shops, the development UI is done by the developers. In your experience, how much has this impacted the final product, and how much time should we spend getting the development UI right?
...
Method chaining is the only way i know to build fluent interfaces.
Here's an example in C#:
John = new JohnBuilder().AddSmartCode("c#").WithfluentInterface("Please").ButHow("Dunno");
Assert.IsNotNull(john);
[Test]
public void Should_Assign_Due_Date_With_7DayTermsVia_Invoice_Builder()
{
DateTime now = DateTime.Now;
...
How does one design loosely-coupled systems which may often require data from each-other but don't necessarily belong in the same category?
For instance, lets take the old Pet-shop example one-step further and create a pet-store franchise. Each pet-store has its own website listing their contact information, promotions, and current stoc...
This might be too opinionated a question, but looking for help!
I have been trying to refine my ASP.NET MVC program structure. I just started using it at preview 5 and it is my first foray into business application development -- so everyting is new!
At the controller level, I have a service object responsible for talking to the repos...
Hi, I have a producer-consumer pattern working for one product. What is the best implementation when the producer produce many products? For example a DataBaseEvent, GuiEvent and ControlEvent that the consumer shall consume. The code below shows the pattern for one product (a DataBaseEvent). Should each event type be enqueued on an own q...
I'm trying to move to a Model/ViewModel/View architecture and got stuck when trying to push selection dialogs to this pattern. I'd like to separate retrieving a list of choices (business/presentation logic) and the actual displaying/choosing mechanism (view) to re-use the former with different views (e.g. ComboBox vs. modal dialog).
How...
Suppose I want to create a set of observers based on type. That is to say, when they are notified of an event, they are told the type of one of the arguments and then decides whether or not to act based on if it can operate on that type.
Are there any simple ways to do this? I figured this would be fairly simple to do with generics, b...
I would like to add a method to a built-in type (say Double), so that I can use an infix operator. Is that possible?
...
My project invovles me to make a lot of changes on the production code. The requirement keeps coming up and I need to make changes and deploy it as soon as possible. I sometimes end up creating patch work sort of code because some of the requirement would not fit into the overall design of the software. How can this be handled effectivel...
Hi, can anyome help me find an elegant design for splitting, traversing and tracking objects.
The diagram below shows an object with an initial size of 100 which is spilt into two (50, 75) then one of the child objects (75) is subsequently split into three (25, 25 ,25).
My question is can anyone think of an elegant design that will all...
Here's a software design question I've encountered several times and have never found an ideal solution for (I'm also dealing with it now again.)
Many applications need some form of user/role management. You have base users, groups that these users can belong to (not limited to just one), roles and permissions they have, organizational...