I have:
- Main Program Class - uses Library A
- Library A - has partial classes which mix in methods from Library B
- Library B - mix in methods & interfaces
So in Library B when I include a partial Node class which implements INode (defined in Library B) I suddenly get an error in my main class where it uses Node from Library A. The error tells me in the Main Class I have to have a using statement to Library B.
Any ideas?
EDIT - Except from code
// *** PROGRAM ***
class Program
{
static void Main(string[] args)
{
var context = new Model1Container();
Node myNode; // ** WITHOUT A using for Library B I have an error here ***
}
}
// ** LIBRARY A
namespace TopologyDAL
{
public partial class Node
{
// Auto generated from EF
}
public partial class Node : INode<int> // to add extension methods from Library B
{
public int Key
}
}
// ** LIBRARY B
namespace ToplogyLibrary
{
public static class NodeExtns
{
public static void FromNodeMixin<T>(this INode<T> node) {
// XXXX
}
}
public interface INode<T>
{
// Properties
T Key { get; }
// Methods
}
}
EDIT 2 - To clarify was it a reference or using error:
So the error that appears against the "Node myNode;" line is:
Error 1 The type
'Topology.INode`1' is defined in
an assembly that is not referenced.
You must add a reference to assembly
'Topology, Version=1.0.0.0,
Culture=neutral,
PublicKeyToken=null'. U:My
DropboxsourceToplogyLibraryTopologyDAL_ConsoleTestProgram.cs 11 13 TopologyDAL_ConsoleTest
When I let VS fix it for me it adds the Library2 as a reference. That is there is no "using " either before or after in the client code. So the issue is a Reference not Using issue.
EDIT 3 - Not specifically about the question, however I now notice that in the program project, I can't see the mixin methods (from Library B) unless I have a using statement to Library B? I might create a separate question re this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…