[Mono-list] Does Mono Support the development of plugin based programs?

Luke Pulverenti luke.pulverenti at gmail.com
Fri Sep 12 06:33:14 UTC 2014


I would not suggest MEF even if it works with mono because it will force
your plugin developers to have a hard reference to MEF itself, which might
not be optimal if you'd like to have the ability to have plugins as PCL's
(portable class libraries).

Take a look at what we're doing with Media Browser:

https://github.com/MediaBrowser/MediaBrowser

We have a plugins directory where we find and load assemblies. Then we have
a library of interfaces that plugins can implement. For example, here's the
interface for a video channel, called IChannel:

https://github.com/MediaBrowser/MediaBrowser/blob/master/MediaBrowser.Controller/Channels/IChannel.cs

And here is an implementation from the Vimeo plugin, contained in another
repository:

https://github.com/MediaBrowser/MediaBrowser.Channels/blob/master/MediaBrowser.Plugins.Vimeo/VimeoChannel.cs

The only thing a plugin has to do is implement the interfaces it intends to
support. No manual wireup. No dependencies on MEF or any other similar
third party library. No custom attributes required. Then once we have the
assemblies loaded into memory, we use SimpleInjector to find and
instantiate the instances:

https://github.com/MediaBrowser/MediaBrowser/blob/master/MediaBrowser.ServerApplication/ApplicationHost.cs#L737

This also gives us dependency injection via constructor parameters. For
example, our core library has an ILogger interface which the Vimeo channel
can utilize just by adding it to it's constructor. The core interfaces are
then distributed via nuget packages that contain only the interfaces and
don't expose implementations or core dependencies.

I'm pretty happy with what we've done but if anyone would like to comment
with possible improvements I'd love to hear them.


On Fri, Sep 12, 2014 at 1:46 AM, Wayne Douglas <wayne at prjatk.com> wrote:

> Does MEF run on mono?
>> Sent from Mailbox <https://www.dropbox.com/mailbox>
>
>
> On Fri, Sep 12, 2014 at 6:15 AM, Miljenko Cvjetko <
> mcvjetko at holisticware.net> wrote:
>
>> Hi
>>
>> On 20140912 05:25 , Josiah wrote:
>>
>> Hi all,
>>
>> I'm looking at options for cross-platform development and I was wondering if
>> Mono supports the ability to create a program that can load plugins.
>>
>>  Mono supports MEF since version 2.8, besides it has Mono.Addin
>> implemetation equivalent to MAF.
>> For MEF I think you need to apply a few patches in  order to get it to
>> work on case sensitive filesystems, but it works.
>>
>>
>> http://stackoverflow.com/questions/3909383/mono-and-mef-are-they-compatible
>>
>>
>> http://stackoverflow.com/questions/3685659/programming-with-maf-and-mef-on-mono
>>
>> http://stackoverflow.com/questions/1592779/mef-vs-mono-addin
>>
>> http://tirania.org/blog/archive/2008/Sep-07.html
>>
>> HTH
>>
>> mel
>>
>>
>> Any help would be appreciated.
>>
>>
>>
>> --
>> View this message in context: http://mono.1490590.n4.nabble.com/Does-Mono-Support-the-development-of-plugin-based-programs-tp4663822.html
>> Sent from the Mono - General mailing list archive at Nabble.com.
>> _______________________________________________
>> Mono-list maillist  -  Mono-list at lists.ximian.comhttp://lists.ximian.com/mailman/listinfo/mono-list
>>
>>
>>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>


-- 
Luke Pulverenti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20140912/71009b93/attachment-0001.html>


More information about the Mono-list mailing list