Here is my builder interface:
public interface IContainerBuilder {
void SetSections();
void SetSides();
void SetArea();
WebControl GetContainer();
}
And this is my ConcreteBuilder:
public class SingleContainerBuilder:BaseProperties, IContainerBuilder {
Panel panel = new Panel();
public void SetSections() {
//panel.Height = value coming from model
//panel.Width = value coming from model
}
public void SetSides() {
//panel.someproperty = //value coming from model,
//panel.someotherproperty = //value coming from model,
}
public void SetArea() {
throw new NotImplementedException();
}
public System.Web.UI.WebControls.WebControl GetContainer() {
return panel;
}
}
And the Director is here:
public class ContainerBuilder {
private readonly IContainerBuilder objBuilder;
public Builder(IContainerBuilder conBuilder) {
objBuilder = conBuilder;
}
public void BuildContainer() {
objBuilder.SetArea();
objBuilder.SetSections();
objBuilder.SetSides();
}
public WebControl GetContainer() {
return this.objBuilder.GetContainer();
}
}
And that's how I am calling it from default page:
var conBuilder = new ContainerBuilder(new SingleContainerBuilder());
conBuilder.BuildContainer();
var container = conBuilder.GetContainer();
Now the problem / confusion I am having is how do I pass the Model Data to the concrete classes? The reason I am confused/stuck is there could be number of different containers (could be more than 20-30). Does each different type of container has to go and grab data from the model or is there a better approach for it?
The second thing I am confused with is, my Model is in a different Library. Do I need to create a copy of the model in my web project and populate my local model from that master model, or should I directly query the Master Model for Concrete Class Properties? As you can see, my SingleContainer contains BaseProperties, which are local declaration of the properties that are already in the Master Model. I don't see or understand the point of local Model and I am not sure I am right here or not.
Sorry I am new to Design Patterns.
Any help will be really appreciated,
Thanks