M
Martin Oddman
Hi,
I have a compiling problem. Please take a look at the code below.
I have an application that is built upon three tiers: one data tier
(Foo.DataManager), one business tier (Foo.Kernel) and one web
presentation tier (Foo.WebFiles). The data tier shall only be
accessible thru the business tier so I do NOT want a reference to
the data tier in the presentation tier.
In the business tier I have a class with the name CategoryItem that
have one public constructor, that shall be able to instantiate from
the presentation tier, and one internal constructor that shall only
be instantiated from within the same assembly. The internal
constructor have an argument with a reference to a class,
TransactionHandler, located in the data tier. And here is where the
problems begin. When I add a constructor like this in the
CategoryItem class and then try to compile the ActionMenu class I get
the following compiling error:
error CS0012: The type 'Foo.DataManager.TransactionHandler' is
defined in an assembly that is not referenced. You must add a
reference to assembly 'Foo.WMS.DataManager'.
I really do not understand why I get this error, cause as I see it,
this shall not be any problem at all because the constructor with a
reference to the Foo.DataManager is INTERNAL and shall not even be
visible for the presentation tier. Is this a bug in the compiler or
have I missed something here? And, how do I come around this problem?
As I said before I realy do NOT want a reference from the
presentation tier to the data tier.
By the way, it doesn't matter if I set this constructor to be
PROTECTED or PRIVATE, I still get the same compiling error.
I appreciate any help. Thank you in advance.
Best regards
Martin
/*** First class located in Foo.Datamanager.dll ********************/
namespace Foo.DataManager {
public class TransactionHandler {
public TransactionHandler(){
}
}
}
/*** Second class located in Foo.Kernel.dll that has ***************/
/*** a reference to the Foo.Datamanager.dll above. ***************/
using Foo.DataManager;
namespace Foo.Kernel {
public class CategoryItem {
public CategoryItem(){
}
internal CategoryItem(TransactionHandler transaction) {
}
}
}
/*** Another class with NO reference to Foo.Datamanager.dll *******/
/*** but that wants to instantiate Foo.Kernel.CategoryItem *******/
using Foo.Kernel;
namespace Foo.WebFiles {
public class ActionMenu : System.Web.UI.Page {
private void AddItem(){
CategoryItem category = new CategoryItem();
}
}
}
/*******************************************************************/
I have a compiling problem. Please take a look at the code below.
I have an application that is built upon three tiers: one data tier
(Foo.DataManager), one business tier (Foo.Kernel) and one web
presentation tier (Foo.WebFiles). The data tier shall only be
accessible thru the business tier so I do NOT want a reference to
the data tier in the presentation tier.
In the business tier I have a class with the name CategoryItem that
have one public constructor, that shall be able to instantiate from
the presentation tier, and one internal constructor that shall only
be instantiated from within the same assembly. The internal
constructor have an argument with a reference to a class,
TransactionHandler, located in the data tier. And here is where the
problems begin. When I add a constructor like this in the
CategoryItem class and then try to compile the ActionMenu class I get
the following compiling error:
error CS0012: The type 'Foo.DataManager.TransactionHandler' is
defined in an assembly that is not referenced. You must add a
reference to assembly 'Foo.WMS.DataManager'.
I really do not understand why I get this error, cause as I see it,
this shall not be any problem at all because the constructor with a
reference to the Foo.DataManager is INTERNAL and shall not even be
visible for the presentation tier. Is this a bug in the compiler or
have I missed something here? And, how do I come around this problem?
As I said before I realy do NOT want a reference from the
presentation tier to the data tier.
By the way, it doesn't matter if I set this constructor to be
PROTECTED or PRIVATE, I still get the same compiling error.
I appreciate any help. Thank you in advance.
Best regards
Martin
/*** First class located in Foo.Datamanager.dll ********************/
namespace Foo.DataManager {
public class TransactionHandler {
public TransactionHandler(){
}
}
}
/*** Second class located in Foo.Kernel.dll that has ***************/
/*** a reference to the Foo.Datamanager.dll above. ***************/
using Foo.DataManager;
namespace Foo.Kernel {
public class CategoryItem {
public CategoryItem(){
}
internal CategoryItem(TransactionHandler transaction) {
}
}
}
/*** Another class with NO reference to Foo.Datamanager.dll *******/
/*** but that wants to instantiate Foo.Kernel.CategoryItem *******/
using Foo.Kernel;
namespace Foo.WebFiles {
public class ActionMenu : System.Web.UI.Page {
private void AddItem(){
CategoryItem category = new CategoryItem();
}
}
}
/*******************************************************************/