In general (there are always exceptions, no pun intended) you can't have
circular compile time references and that's a good thing. The direct way
to solve this is to merge the code that has dependences into a single assembly.
Personally, I'd think the Cache and Data should be together. If they throw
custom exceptions, then I'd also think that'd be in the same assembly. The
whole point of factoring types out into their own assembly is when you plan
to reuse those types elsewhere in other applications, typically.
-Brock
DevelopMentor
http://staff.develop.com/ballen Hello,
I have these entities in my ASP.NET application:
- data access layer (DATA)
- custom exception class (EXCEPTION)
- cache management class (CACHE)
They're all built into different DLL's.
The EXCEPTION class depends on the CACHE class to get the cached
application error messages. The CACHE class depends on the DATA class
to retrieve data (that is, the error messages) from the database.
EXCEPTION -> CACHE -> DATA
The problem is: I need to throw a custom exception in the DATA layer
(for concurrecy DB errors). To do this I would have to add a reference
in the DATA layer of the EXCEPTION project. But I can't do that,
because Visual Studio gives me an error of cyclic reference. I would
have:
DATA -> EXCEPTION -> CACHE -> DATA
So, what could I do?
I thought of storing the error messages in an XML file, instead of in
tables in the database. Then I could have:
DATA -> EXCEPTION -> CACHE -> XML
But the best would be to keep the messages in the database. Is there
any possibility of keeping the messages in the database and still
throw a custom EXCEPTION in the DATA layer?
Well, I appreciate any help on this issue.
Leonardo D'Ippolito