2011-05-27 87 views
0

我有插件,实现IPlugin(IMenuPlugin,IThemePlugin等)。我希望能够让每个插件为我的应用程序提供应用程序将使用的可配置属性并提供编辑/更新UI。asp.net MVC动态配置/用户界面

我的想法是让每个实现提供一个IEditable(由接口定义)列表。每个可编辑的都会提供模板的名称(EditorFor()等)。然后我想枚举所有这些,渲染模板,然后将值发回控制器以保存插件的值。

您的想法?现在有什么东西是类似的吗?

回答

0

我猜这是类似于你提出的东西,但我越来越困惑的措辞。

我想说,您应该简单地为IPluginProperty创建另一个接口,然后将IPluginProperty s的只读集合添加到IPlugin。然后IPluginProperty接口可能要为物业提供IPropertyEditor属性:

public interface IPluginEditor 
{ 
    // interface members 
} 

public interface IPluginProperty 
{ 
    IPluginEditor Editor { get; } 

    // Rest of interface members 
} 

public interface IPlugin 
{ 
    IEnumerable<IPluginProperty> Properties { get; } 

    // Rest of interface members 
} 
+0

我知道如何编写代码,我只是想知道是否有任何图书馆那里。 – 2011-05-27 18:56:48