DCSIMG
System.AddIn.Pipeline.LifetimeTokenHandle renamed to ContractHandle - Guy Burstein's Blog

Guy Burstein's Blog

Developer Evangelist @ Microsoft

News

Guy Burstein The Bu

Disclaimer
Postings are provided 'As Is' with no warranties and confer no rights.

Guy Burstein LinkedIn Profile

TwitterCounter for @bursteg

System.AddIn.Pipeline.LifetimeTokenHandle renamed to ContractHandle

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!

Comments

Steven Nagy said:

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?

# August 31, 2007 3:35 AM

Tini said:

Thanks! saved my life trying to compile the sample hehe :)

# July 9, 2008 12:30 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: