i writing document editor of sorts. application written in wpf , needs able handle multiple documents within same process. each document has own editor window own ribbon (kinda way word it).
i use di patterns in application, f.ex. "savemanager" class injected document supposed save. container can't create whole object graph @ application start up, because user may choose open or create new document @ later time. "normal" way handle this, use abstract factory, means need factory every class operates on document. i'm expecting lot of classes need reference document , don't want jump through hoops sake of di. there way let container manage documents life-time, handing out right document instance @ right time.
best regards,
terje
i suggest go this:
- make base class somesort of bootstrap , builder environment
- put same on documents except specifics
- create concrete classes implement specifics of particular documents
- use di on base class common references injected on build
use interfaces specific references on specific classes like:
void myclass(iresource resource);
inherit resource on other classes , resolve using generics or typecasting on concrete classes
Comments
Post a Comment