G
Giulio Petrucci
Hello there,
I need to have a Foo class which has a behaviour we can assume made of
two methods: X() and Y().
A client assembly A must "see" only X, while another client assembly B
must see only Y (maybe it's a typical ISP case). I thought to define
the two methods as separate behaviours using partial interfaces. So I
think I can write:
(Assembly MyProject.A)
namespace MyProject {
public partial interface IFoo {
void X();
}
}
(Assembly MyProject.B)
namespace MyProject {
public partial interface IFoo {
void B();
}
}
(Assembly MyProject)
namespace MyProject {
public class Foo : IFoo {
public void X();
public void Y();
}
}
(Assembly Client.A --> reference solo a MyProject.A)
....
IFoo f = FooFactory.CreateFoo();
f.X();
(Assembly Client.B --> reference solo a MyProject.B)
....
IFoo f = FooFactory.CreateFoo();
f.Y();
I got this from the compiler:
Error 1 The type 'MyProject.IFoo' exists in both 'c:\Documents and
Settings\petrux\My Documents\Visual Studio
2008\Projects\PartialInterfaces\MyProject.A\bin\Debug\MyProject.A.dll'
and 'c:\Documents and Settings\petrux\My Documents\Visual Studio
2008\Projects\PartialInterfaces\MyProject.B\bin\Debug\MyProject.B.dll'
What I've made wrong?
Thanks in advance,
Giulio
--
I need to have a Foo class which has a behaviour we can assume made of
two methods: X() and Y().
A client assembly A must "see" only X, while another client assembly B
must see only Y (maybe it's a typical ISP case). I thought to define
the two methods as separate behaviours using partial interfaces. So I
think I can write:
(Assembly MyProject.A)
namespace MyProject {
public partial interface IFoo {
void X();
}
}
(Assembly MyProject.B)
namespace MyProject {
public partial interface IFoo {
void B();
}
}
(Assembly MyProject)
namespace MyProject {
public class Foo : IFoo {
public void X();
public void Y();
}
}
(Assembly Client.A --> reference solo a MyProject.A)
....
IFoo f = FooFactory.CreateFoo();
f.X();
(Assembly Client.B --> reference solo a MyProject.B)
....
IFoo f = FooFactory.CreateFoo();
f.Y();
I got this from the compiler:
Error 1 The type 'MyProject.IFoo' exists in both 'c:\Documents and
Settings\petrux\My Documents\Visual Studio
2008\Projects\PartialInterfaces\MyProject.A\bin\Debug\MyProject.A.dll'
and 'c:\Documents and Settings\petrux\My Documents\Visual Studio
2008\Projects\PartialInterfaces\MyProject.B\bin\Debug\MyProject.B.dll'
What I've made wrong?
Thanks in advance,
Giulio
--