Format:
Recent snippets matching tags of mef
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; namespace StaticMEF { class Program
102 Views
no comments
// ----------------------------------------------------------------------- // <copyright file="MefBootstrapper.cs" company="CompDJ"> // Copyright (c) CompDJ. All rights reserved. // </copyright> // ----------------------------------------------------------------------- namespace ConsoleApplication2 { using System; using System.Collections.Generic;
132 Views
no comments
I have an issue with accessing certain public objects of my RESx files. I am working with a MEF solution around an MVC3 application. My RESx files are implemented as public so they are accessible across assemblies. However, this seems to be limited. The solution I have is just changing the Custom Tool to PublicResXFileCodeGenerator. This allows switching the accessor that is applied to the class from internal to public. However, there is a catch when we throw MEF into the mix. Because MEF works on the principle of importing assemblies into an AppDomain and managing the export and import connections that it contains, the soft referencing that is implied does not connect one RESx file to another. Project Brand
187 Views
no comments
<system.diagnostics>
<sources>
<source name="System.ComponentModel.Composition" switchValue="Error">
<listeners>
<add name="fileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="Mef Composition.log" />
</listeners>
</source>
</sources>
<trace autoflush="true" indentsize="4" />
</system.diagnostics>
279 Views
no comments
private IEnumerable<MemberInfo> GetImportMembers(Type type) { var local = new HashSet<string>(); if (type.IsAbstract) { yield break; } foreach (var member in GetDeclaredOnlyImportMembers(type)) {
309 Views
no comments
namespace Entity { public interface IBase { string Name { get; } } [Export("Base2", typeof(IBase))] [PartCreationPolicy(CreationPolicy.NonShared)] public class Base2 : IBase
368 Views
no comments
//this is the MEF Team Code namespace System.ComponentModel.Composition.AttributedModel { internal class AttributedPartCreationInfo : IReflectionPartCreationInfo { private IEnumerable<MemberInfo> GetImportMembers(Type type) { if (type.IsAbstract) { yield break;
314 Views
no comments
using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; using System.Reflection; namespace MEFFactory { public interface IMessage {
574 Views
no comments
using System; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; using System.Reflection; namespace HelloMEF { public interface IGreetings { void Hello();
233 Views
no comments
namespace Nowcom.Quicksilver { public interface IMessage { } } namespace Nowcom.Quicksilver { using System.ComponentModel.Composition;
595 Views
no comments
namespace Nowcom.Quicksilver { using System.ComponentModel.Composition.Primitives; using System.Linq; using System; using System.ComponentModel.Composition.ReflectionModel; using System.Collections.Generic; public class WrappedPartDefinition: ComposablePartDefinition {
288 Views
no comments
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; namespace DynamicObjectContracts { public class Program
531 Views
no comments
public interface IRuleMetadata { [DefaultValue(0)] int ExecutionOrder { get; } } [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public class RuleAttribute : ExportAttribute, IRuleMetadata { public RuleAttribute(int executionOrder)
749 Views
no comments
public class LoggerRegistry : PartRegistry { public LoggerRegistry() { Part<PartConvention>() .ForTypesMatching(x => x.GetInterfaces().Contains(typeof(ILogger))) .Exports(x => x.Export<ExportConvention>() .ContractType<ILogger>() .ContractName<ILogger>() .Members(m => new[] { m }))
249 Views
no comments
public class ConventionPart<T> : IPartImportsSatisfiedNotification { /// <summary> /// Initializes a new instance of the <see cref="ConventionPart{T}"/> class. /// </summary> public ConventionPart() { } [ImportMany]
341 Views
no comments
public class ViewModelInitializer<TViewModel,TModel> where TViewModel : IViewModel<TModel> { private Func<TViewModel> _viewModelFactory; public ViewModelInitializer(Func<TViewModel> viewModelFactory) { _viewModelFactory = viewModelFactory; } public void Initialize(FrameworkElement view, TModel model)
480 Views
no comments
class Program { static void Main(string[] args) { var instance = new Program(); var cat = new AssemblyCatalog(typeof(Program).Assembly); var container = new CompositionContainer(cat); container.ComposeParts(instance); foreach (var plug in instance.Plugins)
933 Views
no comments
// Below RecentlyUsedTrackerConfiguration provides configuration information through property exports. MEF pulls on the property getters and exports that info. // If the part needs to be data drvien, you can still access a service behind the scenes in the getter (or the constructor) to get the info. public class RecentlyUsedTrackerConfiguration { public RecentlyUsedTrackerConfiguration() { //set values here }
593 Views
no comments
class Program { private static ImpCls s_imp = new ImpCls(); private static string[] s_beforeState; static void Main(string[] args) { var c = new TypeCatalog(typeof(ExpMtd1)); var catalog = new AggregateCatalog(c); var container = new CompositionContainer(catalog);
685 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
