开发者

Extending modular approach of PRISM (CompositeWPF)

The native PRISM's modulariy mechanism support loading modules by path to assembly, 开发者_如何学JAVAcontainiтg this module. I want to have availability to store modules' views (XAML) in database in order end user could change and customize them. Database is chosen as it is simpler to store and retrieve information and requires no recompilation and making of binaries. The problem is that View consists of XAML and codebehind and we need to divide(?) them and store separately and when we need them we must clue them and load to module (with reflection or something else?) but I don't know how and if it is possible at all?


I see two options here. The easy way or the hard way.

The easy way is to have all the assemblies on the drive, and have a PRISM module catalog that loads them depending on settings from a database.

The hard way is to put the assemblies into the database, and have the module catalog load the assemblies from there. You'd have to encode the assembly, probably using Base64, put it into the database, and then reload the assembly from the database.

To reload an assembly from a database record, you can use the same mechanism as the DirectoryModuleCatalog. Copy that class and change it so it loads the assemblies from the stream coming from the DB instead of a file from a directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜