Plugin features

An Embedded plugins is basically an assembly that encapsulates all views, controllers and static resources. It has to define the following:

  1. Embedded File systems containing the static resources
  2. Assembly that contains webparts such as views and controllers
  3. Specifying is a separate Embedded View engine is needed to be used by the views of this plugin.
For the EmbeddedViewEngine, there is a possibility to register multipe of them, and give them a diffrentiating prefix. Then the viewengines will only process the view's with a viewname starting with the specified prefix. This serves as an additional layer of sepration of processing that can be used as necessary.
The following is the Interface definition:
public interface IEmbeddedPlugin
   {
       Assembly WebPartsAssembly { get; }
       IFileProvider FileProvider {get;}
 
       bool InsertOwnEmbeddedViewEngine { get; }
       string OwnEmbeddedViewEnginePrefix { get; }
   }

Plugin implementation

Implementation of the interface can follow a quite easy pattern, defining file provider and assembly based on the current one:

public class SamplesViewEnginePlugin : IEmbeddedPlugin
    {
        public IFileProvider FileProvider => new EV5EmbeddedFileProvider(typeof(SamplesViewEnginePlugin).Assembly, "EV5.VE-");
 
        public bool InsertOwnEmbeddedViewEngine => true;
 
        public string OwnEmbeddedViewEnginePrefix => "EV5";
 
        public Assembly WebPartsAssembly => this.GetType().Assembly;
 
    }