Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

MEF and Workflow Services Integration

, 1 Jan 2011
Building up activities using the Managed Extensibility Framework for workflow services hosted in IIS.
MEF-WF-Extensibility.zip
MEF-WF-Extensibility
BaseLibrary
bin
Debug
BaseLibrary.dll
Release
obj
Debug
TempPE
Properties
ContractsLibrary
bin
Debug
ContractsLibrary.dll
Release
obj
Debug
TempPE
Properties
ImplementationLibrary
bin
Debug
ContractsLibrary.dll
ImplementationLibrary.dll
ModelLibrary.dll
Release
obj
Debug
TempPE
Properties
ModelLibrary
bin
Debug
ModelLibrary.dll
Release
obj
Debug
TempPE
Properties
TestLibrary
bin
Debug
ContractsLibrary.dll
ModelLibrary.dll
TestLibrary.dll
Release
obj
Debug
TempPE
Properties
WorkflowServiceLibrary
Activities
App_Data
bin
BaseLibrary.dll
ContractsLibrary.dll
ModelLibrary.dll
WorkflowServiceLibrary.dll
Mef
obj
Debug
TempPE
Properties
Services
SendOrders.xamlx
WorkflowServiceLibrary.csproj.user
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BaseLibrary;
using System.ComponentModel.Composition.Primitives;
using System.ComponentModel.Composition.Hosting;
using System.IO;

namespace WorkflowServiceLibrary.Mef
{
    public class WorkflowServiceMefProvider : MefWorkflowProvider
    {
        public WorkflowServiceMefProvider(bool useTestServices) : base(useTestServices) { }
        /// <summary>
        /// Register parts to be used when useTestServices is enable in configuration
        /// </summary>
        /// <returns>catalog to be added to MEF</returns>
        protected override ComposablePartCatalog RegisterTestCatalogs()
        {
            // return the catalog, you can use AggregateCatalog, DirectoryCatalog ect here
            return new AssemblyCatalog(string.Concat(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.FullName, "\\TestLibrary\\bin\\debug\\TestLibrary.dll"));
        }
        /// <summary>
        /// Register parts that should always be available to MEF
        /// </summary>
        /// <returns>catalog to be added to MEF</returns>
        protected override ComposablePartCatalog RegisterCoreCatalogs()
        {
            // not used: catalogs registered here will be available regardless of useTestServices
            return null;
        }
        /// <summary>
        /// Register parts to be used when useTestServices is disabled in configuration
        /// </summary>
        /// <returns>catalog to add to MEF</returns>
        protected override ComposablePartCatalog RegisterNormalCatalogs()
        {
            // return the catalog, you can use AggregateCatalog, DirectoryCatalog ect here
            return new AssemblyCatalog(string.Concat(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.FullName, "\\ImplementationLibrary\\bin\\debug\\ImplementationLibrary.dll"));
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Gareth Barlow (NBNi)
Software Developer NBN International
United Kingdom United Kingdom
I am Gareth, working in the book industry specializing in EDI and B2B integration. Starting out as a child bashing out programs on the old commodore 64, I have since progressed from VB6 through the .net framework and loving c#, wf, wpf and where these are heading... hoping one day to have the excuse to play with silverlight.

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 1 Jan 2011
Article Copyright 2011 by Gareth Barlow (NBNi)
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid