C
Codex Twin
Hi
I have a common model for a Data Access Layer scenario. I have an abstract
base class, called DalBase which contains a list of abstract methods. Lets
call them:
public abstract void Shine();
public abstract void Flow();
public abstract void Float();
I then have an inherited class, called DalMain which contains the concrete
implementations of these methods
DalMain : DalBase
{
public override void Shine()
{
...
}
public override void Flow()
{
...
}
public override void Float()
{
...
}
}
I have a third class, DataAccessBaseClass, which has a static method called
GetDalLayer() which checks that the type of DalMain is DalBase, and if it
is, returns the type of the DalMain class. The beauty of this is, if I need
to call Flow() in a business class, all I need to do is:
DalBase dal = DataAccessBaseClass.GetDalLayer();
//dal is now of type DalMain
dal.Flow();
and this will call the Flow() in the DalMain class. All nice and good!
However, I am in a team environment, and I have a 100+ abstract methods in
DalBase. Which means that DalMain is in constant demand and causing a
development bottleneck.
I want to split up DalMain into separate "responsible" classes, so as to
share out the functionality and place less of a burden on the editing of the
DalMain class by the entire team.
What do I need to do to retain the same mode of invoking the DalBase
methods, but from concrete implementations in these classes:
public class Moon
{
public override void Shine()
{
...
}
}
public class Liquid
{
public override void Flow()
{
...
}
}
public class Balloon
{
public override void Float()
{
...
}
}
I want to be able to call the Flow() method
DalBase dal = DataAccessBaseClass.GetDalLayer();
dal.Flow();
and this will call the Flow() in the Liquid class - which now has the
implentation for Flow(). And the same for the other methods in the Moon and
Balloon classes.
What should I do?
I have a common model for a Data Access Layer scenario. I have an abstract
base class, called DalBase which contains a list of abstract methods. Lets
call them:
public abstract void Shine();
public abstract void Flow();
public abstract void Float();
I then have an inherited class, called DalMain which contains the concrete
implementations of these methods
DalMain : DalBase
{
public override void Shine()
{
...
}
public override void Flow()
{
...
}
public override void Float()
{
...
}
}
I have a third class, DataAccessBaseClass, which has a static method called
GetDalLayer() which checks that the type of DalMain is DalBase, and if it
is, returns the type of the DalMain class. The beauty of this is, if I need
to call Flow() in a business class, all I need to do is:
DalBase dal = DataAccessBaseClass.GetDalLayer();
//dal is now of type DalMain
dal.Flow();
and this will call the Flow() in the DalMain class. All nice and good!
However, I am in a team environment, and I have a 100+ abstract methods in
DalBase. Which means that DalMain is in constant demand and causing a
development bottleneck.
I want to split up DalMain into separate "responsible" classes, so as to
share out the functionality and place less of a burden on the editing of the
DalMain class by the entire team.
What do I need to do to retain the same mode of invoking the DalBase
methods, but from concrete implementations in these classes:
public class Moon
{
public override void Shine()
{
...
}
}
public class Liquid
{
public override void Flow()
{
...
}
}
public class Balloon
{
public override void Float()
{
...
}
}
I want to be able to call the Flow() method
DalBase dal = DataAccessBaseClass.GetDalLayer();
dal.Flow();
and this will call the Flow() in the Liquid class - which now has the
implentation for Flow(). And the same for the other methods in the Moon and
Balloon classes.
What should I do?