1
Vote

Pipeline Builder: incorrect generated code using collections of IContract

description

It seems that the issue is related to the fact that Pipeline Builder is not able to properly re-map generic collections of IContract elements (i.e. IEnumerable<T> : where T is IContract) or contract collections (i.e. IEnumerableContract<T> : where T is IContract) when creating the host-view and addin-view. Moreover there are even problems when dealing with the adapters generation, since the tool does not create the adapter code properly (it fails to translate the IEnumerableContract/IListContract to the proper IEnumerable/IList view).
 

Creating a contract library like the folowing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.AddIn.Contract;
using System.AddIn.Pipeline;
using PipelineHints;
 
namespace Contracts
{
[AddInBase]
public interface IMyAddin1Contract : IContract
{
System.AddIn.Contract.Collections.IListContract<IMyElementContract> Contracts { get; }
}
 
[AddInBase]
public interface IMyAddin2Contract : IContract
{
System.AddIn.Contract.Collections.IEnumerableContract<IMyElementContract> Contracts { get; }
}
 
[AddInBase]
public interface IMyAddin4Contract : IContract
{
IList<IMyElementContract> Contracts { get; }
}
 
[AddInBase]
public interface IMyAddin5Contract : IContract
{
IEnumerable<IMyElementContract> Contracts { get; }
}
 
public interface IMyElementContract : IContract
{
string Name { get; }
}

}

and running the Pipeline Builder tool, will expose such problems (trying to build the solution will result in compiling errors, related to the incorrect translation of the collection elements).

file attachments

comments

BladeWise wrote Dec 12, 2008 at 3:42 PM

I found that using System.AddIn.Contract.ListContract instead of System.AddIn.Contract.Collections.ListContract solves the problem with collection contracts...

Just to be more precise (if someone is as dumb as me --'), the following code

[AddInBase]
public interface IMyAddin1Contract : IContract
{
System.AddIn.Contract.Collections.IListContract<IMyElementContract> Contracts { get; }

}

should be

[AddInBase]
public interface IMyAddin1Contract : IContract
{
System.AddIn.Contract.IListContract<IMyElementContract> Contracts { get; }

}

I still don't get why 2 different classes have the same name at just one namespace step... In any case, using generic collections with IContract elements (like IEnumerable<MyElementContract>) doesn't work as reported.

wrote Feb 14, 2013 at 8:01 PM