mef

VS2010 syntax coloring: how to obtain the previous classification type

I'm trying to play with the new syntax coloring capabilities of VS2010 based on Noah Richards' diff coloring sample. The goal is to create syntax coloring for SpecFlow (http://www.specflow.org). In my case, finding the syntax elements are fairly complex and not line-level. Therefore, when I implement the GetClassificationSpans I don't w...

Visual Studio 2010 extension get selected text

I'm writing my own extension. I've created a toolbar button. The template I used was "Visual Studio Package" and there was an option during the wizard to create a command button (or something like that) So the button shows up, but I can't work out how to get the current document or the selected text within the document. Any help would ...

Moq a MEF Import?

I have a class A which has the following: public class A { [Import(typeof(IMyService)] public IMyService MyService { get; set; } public A() { CompositionInitializer.SatisfyImports(this); } public void DoWork() { //Blah MyService.DoIt(); //Blah } } And a Test to test this (seper...

Using MEF to Instantiate Class at Runtime

I am sure this should be easy, perhaps I am missing something obvious. I have a bunch of classes that implement the IClass interface. At runtime I want to use the MEF DirectoryCatalog to retrieve references all those classes implementing that IClass interface. So, at this point I have some kind of pool of classes that can be instantiated...

ResourceManager not picking up correct resx file

I am having an issue getting the correct resource file entries and need some help ... here is my scenario I have a series of projects that are a part of a large reporting solution that follow this format Plugin.**Report Reference (folder) DataAccessLayer (folder) DataSets (folder) DataWrappers (folder) Localization (folder) ...

MEF Recomposition - Does it preserve existing instances?

Suppose I have a MEF composition like this: public class Composition { [ImportMany(AllowRecomposition = true)] IEnumerable<ILongRunningProcess> Processes { get; set; } public static void Main(string[] args) { var composition = new Composition(); using (var catalog = new DirectoryCatalog(".")) ...

Is MEF For Me? (one core application allowing client applications to plug into it)

I'm trying to determine if MEF is a the proper direction our application framework should be taking. From my reading of MEF, our framework doesn't seem to 'exactly' fit in, but I'll see if any experts can guide me. Our framework allows us to have one core website and dependent assemblies deployed to one place (and fixes or features are...

MEF Lazy ImportMany with Creationpolicy.NonShared

hi, i'm a beginner in mef and so i have a question :) i have the following: [PartCreationPolicy(CreationPolicy.Shared)] [Export(typeof(SharedExport))] public class SharedExport : INPCBase { [ImportMany(typeof(INonShared),RequiredCreationPolicy = CreationPolicy.NonShared)] private IEnumerable<Lazy<INonShared,Dictionary<string,obj...

MAF vs. MEF vs. Prism

I watching some tutorials for MEF or Prism with Silverlight but was also doing some MAF work (System.AddIn) on the side and thought that might work also. I see that Prism and MEF are pretty much the same thing but Prism having the event aggregator. Does anybody have thoughts on how well MAF works with Silverlight? ...

Customizing MEF

Hey fellow coders, I have this situation where I want to use MEF in a chess project I'm workin on. Let's say I have a class constructor as in: public class MoveManager { private Piece _piece; public MoveManager(Piece piece) { _piece = piece; } Mode code here... } In this context I would have several classes that wou...

An opinionated web framework on top of ASP .NET MVC

By opinionated I mean that the framework will lock you to follow certain conventions or technologies or architectures. Something similar to Rails or Django. This will make building deeply-integrated plugins possible. One of the major advantages of using Rails/Django is the gems/plugins. As you know, you'll find a gem for everything: adm...

questions about using MEF in a WCF service

I'm just starting to play with MEF and have a couple questions. 1) I wrote a WCF service that takes in some xml and passes the xml off to a parser. The parsers are composed using MEF. (metadata in the xml lets me determine which parser to use). I can add a new parser, and support new XML, by just dropping the dll in a directory. That pa...

ExportLifetimeContext<T>

Why does the ExportLifetimeContext<T> exist? What is it for? And why is it necessary to call Dispose on this objec at all? Do I really need to bother calling it? It doesn't feel very managed if I have to spend time thinking about resource managment, it doesn't feel very managed to me. Is this dispose in anyway tied to the Value property...

Thread safety and the MEF CompositionContainer

I'm planning on using MEF within ASP.NET looking for some insight into thread safety of the CompositionContainer. My first approach associated a distinct CompositionContainer to each request but I'm worried that's gonna be expensive and not scale very well, on the other hand the CompositionContainer support thread safe operations throug...

How do I: Visual Studio Syntax Highlighting Extension

I want to develop an extension for VS2010 that will allow me make some additional features to syntax-highlighting. I installed the SDK, how do I start from? Please give a little snippet (or a link to code) where I can see how to start. Note: do I have to check the whole block of code, or the SDK tells me on each word what it is, how i...

Cannot show up WPF application when setting MainWindow manually and composing application (MEF)

Hello, I got my hands om MEF for a week now and I am trying to build up a WPF application that loads imported controls from MEF. I created a WPF application project and removed the default window and application start up URI. Then I handled the application startup event to compose the application: public partial class App : Applicatio...

Compose part with specific instance

Is there any way I can compose (or get an exported value) with a specific instance as one of it's dependencies? I have something like this: public interface IEntityContext { IEntitySet<T> GetEntitySet<T>(); } [Export(typeof(IEntitySet<MyEntity>))] class MyEntitySet { public MyEntitySet(IEntityContext context) { } } // t...

System.Security.Permissions.FileIOPermission when using MEF to load dll's

I am trying to load some dll's into a MEF DirectoryCatalog within an ASP.NET MVC application: var catalog = new DirectoryCatalog(HttpRuntime.BinDirectory, "Toptable.Mobile.*.dll"); When I run the app through the Cassini web server (i.e. F5) everything runs fine however when hosted in IIS(7) I get the following exception: [SecurityExc...

MEF: ComposeParts missing

I am trying to follow some starter guides for using MEF in .Net 4, but I get stuck when I get to setting up the application. The instructions say to do this: var catalog = new DirectoryCatalog(@".\"); var container = new CompositionContainer(catalog); container.Composeparts(this); But the version of System.ComponentModel.Composition i...

What can I expect to gain as a developer and in my projects by learning a composition framework like MEF?

The title largely sums up my question but to expand, I'm a junior software engineer, but I'm also the primary developer for a fairly large department (mostly EE's) What would learning MEF do for me as a developer as far as professional growth, and what will it add to my projec that I can't manage manually? ...