المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How i implement Strategy Design pattern in following case



C# Programming
02-05-2010, 11:23 PM
Hi everyone

My class implementation like

base class : DatabaseWrapper
1) It is abstract one
2) Contains method common to derived class (e.g. select,insert,update,delete)

Derived class :
1) ExcelWrapper
override the common method which are in base class.
2) SqlDatabaseWrapper
- override the common method which are in base class.
- Also has StartTrancation,Rollback and commit method
- also has executestoreprocedure

Now my implementation work fine when
i create object like

SqlDatabaseWrapper sql = new SqlDatabaseWrapper();
sql.StartTranction();
.
...
...
sql.Commit();

but now i have implement like

DatabaseWrapper sql = new SqlDatabaseWrapper();
sql.StartTranction();
.
...
...
sql.Commit();


but i am not able to get the methods.

How we can solved this using Strategy design pattern.

Yogesh Pekhale
pekhaleyogesh@gmail.com