System.AddIn.Pipeline.LifetimeTokenHandle renamed to ContractHandle

11 באוגוסט 2007

System.AddIn.Pipeline.LifetimeTokenHandle renamed to ContractHandle


System.AddIn.Pipeline.LifetimeTokenHandle ContractHandle I am playing with the new System.AddIn capabilities that are part of the .Net Framework 3.5, and finding it great. I have developed a smart client application in the past that had to face the dynamic loading of modules and seeing the new API and the problems this technology solves – I am very happy to get started with it.


I started by reading the two introductory articles in MSDN Magazine: .NET Application Extensibility – Part 1 and .NET Application Extensibility – Part 2, by Jack Gudenkauf and Jesse Kaplan.


In those articles, the samples project is an extensible calculator that loads add-ins using the new API. When trying to play with this samples project in Visual Studio 2008 Beta 2, it won't compile, since the class System.AddIn.Pipeline.LifetimeTokenHandle renamed to ContractHandle.


Just replace the following code (in CalculatorContractToViewHostAdapter.cs):



[System.AddIn.Pipeline.HostAdapterAttribute()]


public class CalculatorContractToViewHostAdapter : CalculatorContractsHAV.Calculator {


 


    private CalculatorContracts.ICalculatorContract _contract;


 


    private System.AddIn.Pipeline.LifetimeTokenHandle _handle;


 


    public CalculatorContractToViewHostAdapter(CalculatorContracts.ICalculatorContract contract) {


        _contract = contract;


        _handle = new System.AddIn.Pipeline.LifetimeTokenHandle(contract);


    }


 


    …


}


To this code:



[System.AddIn.Pipeline.HostAdapterAttribute()]


public class CalculatorContractToViewHostAdapter : CalculatorContractsHAV.Calculator {


 


    private CalculatorContracts.ICalculatorContract _contract;


 


    private System.AddIn.Pipeline.ContractHandle _handle;


 


    public CalculatorContractToViewHostAdapter(CalculatorContracts.ICalculatorContract contract) {


        _contract = contract;


        _handle = new System.AddIn.Pipeline.ContractHandle(contract);


    }


 


   


}


Enjoy!

Add comment
facebook linkedin twitter email

2 comments

  1. Steven Nagy31 באוגוסט 2007 ב 3:35

    Hi, Thanks for this post. I was just reading those articles and was freakin out when the example wouldn't compile!

    Was this a difference between Beta 1 and 2?

  2. Tini9 ביולי 2008 ב 12:30

    Thanks! saved my life trying to compile the sample hehe 🙂

Comments are closed.