Circular dependency error between projects

Hello, I=92m working on my first n-tier project.  I have a ui tier,
business layer tier and a data access tire.  I created a custom
exception class in my bl tier but I=92d like to use this class in my
other tiers.  However, you can=92t have cross-reference projects or you
get a circular reference error.  So,  in n-tier projects how do most
handle custom error classes.  Do you create a separate project (class
library) just for error handling?  And add reference to this project
from all the other projects?

Thanks.
MP
0
mickieparis
1/9/2010 9:54:20 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

3 Replies
2867 Views

Similar Articles

[PageSpeed] 7

mickieparis wrote:
> Hello, I�m working on my first n-tier project.  I have a ui tier,
> business layer tier and a data access tire.  I created a custom
> exception class in my bl tier but I�d like to use this class in my
> other tiers.  However, you can�t have cross-reference projects or you
> get a circular reference error.  So,  in n-tier projects how do most
> handle custom error classes.  Do you create a separate project (class
> library) just for error handling?  And add reference to this project
> from all the other projects?

That's one way I would do it, for exceptions that are broadly useful 
across all tiers.  These would be in the form of a utility assembly that 
has no specific tier it goes with.

An alternative would be to design the class relationships so that the 
exceptions are declared in the tier where they are created.  Different 
tiers may declare different exceptions.

Since a lower-level tier should not be special-casing exceptions from 
higher-level tiers anyway, doing it that way should be fine.  You won't 
need to refer to a type found in a higher-level tier from a lower-level 
one (which is true of types found in each tier, even regardless of this 
specific custom exception/error example).

Pete
0
Peter
1/9/2010 10:05:44 PM
On 2010-01-09, mickieparis <mickieparis@gmail.com> wrote:
> Hello, I?m working on my first n-tier project.  I have a ui tier,
> business layer tier and a data access tire.  I created a custom
> exception class in my bl tier but I?d like to use this class in my
> other tiers.  However, you can?t have cross-reference projects or you
> get a circular reference error.  So,  in n-tier projects how do most
> handle custom error classes.  Do you create a separate project (class
> library) just for error handling?  And add reference to this project
> from all the other projects?
>
> Thanks.
> MP

Generally, for things DTO's and globaly useful objects, I put them in another
project - essentially, I usually will create a Data Object layer that will be
referenced from all of the other layers.

-- 
Tom Shelton
0
Tom
1/9/2010 10:42:26 PM
On 09-01-2010 16:54, mickieparis wrote:
> Hello, I�m working on my first n-tier project.  I have a ui tier,
> business layer tier and a data access tire.  I created a custom
> exception class in my bl tier but I�d like to use this class in my
> other tiers.  However, you can�t have cross-reference projects or you
> get a circular reference error.  So,  in n-tier projects how do most
> handle custom error classes.  Do you create a separate project (class
> library) just for error handling?  And add reference to this project
> from all the other projects?

First terminology.

I consider it most logical to use tiers
for what can but not necessarily is separated on
different physical boxes and layers for what is just
a logical separation within a tier. So you have have
a 3 tier solution with web browser + your ASP.NET web app +
a SQLServer and have the ASP.NET web app divided in 3 layers:
PL, BLL and DAL.

Note that many including some MS docs uses tiers and layers
as synonyms.

Back to substance.

You can create a separate project with some global accessible
classes (DTO's, exceptions etc.). It may even be the fastest
solution, but I don't think it is optimal design. It tend
to couple the layers.

To really decouple the layers, then you should use
a model:
* a layers only public top level types is
     - a factory class
     - a bunch of interfaces
     - some DTO classes
     - some exception classes
     - some enums
* a layer is only dependent on the layer below it, not
   on layers above it and not on some global accessible
   code
* the implementation of a layer is selected by the layer
   above it via configuration (like Spring.NET)
* exceptions from the layer below is not passed on
   to the layer above

Arne

0
windows
1/10/2010 1:37:20 AM
Reply:

Similar Artilces:

VB Project
Hi, Does anyone know how to access the VBProject in publisher through vba? I've written an app in excel that accesses excel, access, word, powerpoint, project and visio through their VBProjects but the object model for publisher doesn't seem to show a way in, even though you can program and record macros in it. Anyone know why? Cheers Paul ...

Outlook Other Shortcuts Give Error
Error shuts down Outlook if the Other Shortcuts are used to find and work on files. Tried to unistall and reinstall and it still does it. Any ideas? ...

Import Customization error 04-19-04
After importing customizations, I received error message "Import Completed with errors. Please see event log for details" Event log has one and only one error: Event ID: 0 Decsription: PopulateStringMap Error : Object reference not set to an instance of an object. , StackTrace : at Microsoft.Crm.Tools.ImportExportXml.XmlCustomization.Popul ateStringMap(Object Progress) The problem manifests itself as follows: When in CRM web client, all seems OK - except when I go to customize any form - all form tabs are completely empty I have seen one or two previous posts with sim...

error 0x80070057
How do i fix this. I can't recieve or sent mail. ...

An Error has occurred. Please Contact Systems Adminsitrator
I type MSCRM and receive this message - I've been out of town for a week - what can i do to fix this? Some basic things to check 1 - is SQL server started 2 - are you CRM services running especially the CRM security service 3 - are you seeing any strange events on the application event log on the CRM web server? -- John O'Donnell Microsoft CRM MVP http://www.mscrmfaq.us "tony" <tony@discussions.microsoft.com> wrote in message news:FF93C813-ED8A-4240-AD6E-954189E7FB35@microsoft.com... > I type MSCRM and receive this message - I've been out of town for a wee...

LoadPicture() error XL2007
Hello, I have an ActiveX image control (=93stuGraphic=94) on a worksheet =93wsStudent=94. The following line of code is run from a macro: wsStudent.OLEObjects("stuGraphic").Object.Picture =3D LoadPicture() Running with XL2007, this runs without fail 95% of the time, but occasionally it generates an error message =91Runtime error-2147417848 (80010108) Method =93Picture=94 of object =93IImage=94 failed.=92 Once I = get the error, it fails continually - restarting the application, or closing & restarting Excel does not fix the problem. The only fix I=92ve fou...

Favorite Folder error?
When I first added all my email accounts to outlook the favorite folders populated with an inbox from each account. I did not want this so I removed all the inboxes keeping only unread email and for follow up. However, not very long after I set this up all my inboxes are back again. How can I prevent this or disable favorite folders. O and I like going to Personal Folder view when outlook opens which puts me in the folder Mail view so only running out of folder view does not solve this annoyance. Anyone who can help I would appreciate it ~addam you can't disable favorite fo...

Circular Logging #5
I have a Exchange 2000 server with circular logging turned ON. If I do a nightly FULL backup then circular logging being ON should not really matter, right? We do not do incremental or differentail backups. thanks Well, consider the following. You backup at midnight. Your server fails at 2pm and you lose your database drive. With circular logging on, you can only recover your system back to the state it was in at midnight, i.e. you lose emails from midnight to 2pm. Best practice is to ensure circular logging is off. -- Neil Hobson Exchange MVP For Exchange news, links, and tips...

OWA HTTP 440 Timeout error
I am running Exchg 2003 SP1, on Server 2003 in 2000 AD Domain. Single exchg svr, no front-end. Recently reinstall IIS to resolve an issue with 3rd party SPAM Filter Software. After removing the 3rd party app, removing IIS and then reinstalling IIS, reinstalling Exchg, reapplying Exch SP1 and hotfixes and finally the 3rd Party app, my users are encountering Timeout error when accessing OWA (SSL configured). This occurs once daily. OWA access is restored by issuing iisreset command. The process of removing and re-installing IIS was recommended by MS Support. When I advised the MS S...

CRM Install as non Domain Admin error
Hi - I have a user set up as a Local Admin on a Windows 2003 Server with SQL 2005 Sp2 installed and am trying to get CRM installed. I keep hitting this error, despite the user being a local admin on the box: "Action Microsoft.Crm.Setup.Server.AddServiceAccountsToSqlAccesGroupAction Failed. General access denied error." I've only installed as a Domain Admin in the past so I'm not positive what permissions I'm missing either on the user or in SQL. Anyone have any ideas? The permission you need is in Active Directory. When you install CRM 4 AD groups are created in t...

Circular text
How do I create circular text? ...

Urgent! "Query builder Error: No entity" message in the workflow s
Hello, I think I deleted an entity which was referenced by a workflow, and now whenever I go in the SETUP\Workflow screen I get a "Query Builder Error: No entity" message. I can't even access the workflow list. Do you guys have any solution to this problem? Thanks 1) Restore your database from a backup from before you deleted the entity 2) Import a customizations.xml file backed up from before you deleted the entity 3) Try re-creating the deleted entity, with the same name, and manually hack the database to set the entity type code (something like 10001) to the same a...

rounding error
My database in Access 2003 has a form which calculates Quantity by the Price in the footer which is then multiplied by a Tax rate of 12.5% and the two added to get a Total . I get the following figures in the form Subtotal: 96,738.67 Tax: 12,092.33 TOTAL: 108,831.01. The correct answer should be 108,831.00. I have tried various formats (currency, standard, fixed with rounding Auto & 2) but am not able to correct for that small difference. Any solutions "pkeegs" wrote: > My database in Access 2003 has a form which > calculates Quantity by the Price in the foo...

error (0x800CCCF6)
can u help me to configuration on error above please thnaks guys ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/office/community/en-us/default.mspx?mid=f2073175-a70e-4493-ab06-6a4879a8982a&dg=microsoft.public.outlook Marcio Lupusella <...

Outlook 2003 send/receive error message
Get This operation failed. Object can not be found! when attempting to send email or when I click on Send/Receive buttom. See if http://support.microsoft.com/default.aspx?scid=kb;en-us;312354 helps. -- Jeff Stephenson Outlook Development This posting is provided "AS IS" with no warranties, and confers no rights "Frustrated" <anonymous@discussions.microsoft.com> wrote in message news:00fa01c3dd29$cae21e40$a101280a@phx.gbl... > Get This operation failed. Object can not be found! when > attempting to send email or when I click on Send/Receive > buttom. &...

Who Can explan external error?
I have mentioned that many users faced the ( External-Error,No such object on server). But till now, seems nobody can explain this problem. Nobody can give details. 5555555 Actually, I dont think it's a complex problem. Microsoft may only need to tell us where to maintenance the Domain-User ID in CRM. explain this issue more -- John O'Donnell Microsoft CRM MVP http://www.mscrmfaq.us "goldenshine" <goldenshine@discussions.microsoft.com> wrote in message news:CCC3BD25-A209-47A8-8298-EE093D003496@microsoft.com... > I have mentioned that many users faced the ( ...

CRM upgrade (1.2->3.0) error message
sHi all, I am trying to upgrade my 1.2 install to 3. I run the compatibitly test which all went through fine. the error appears during the system requiements stage. The error is against the MS SQL Server REporting Services, and the error states that SRS cannot use the website (website name) because it has an identifier that the SRS setup cannot handle. Then tells me to change to 1. Now, I have checked and the website identifier is 691827, i can change this via metabse editor to 1, however other aspects of the install fail - so i am presuming that CRM attaches to the instance ID, ...

Cut or Copy Error
Hello and thanks ahead for looking at my problem. I am running MS Pub 2000 on XP Home edition with all updates for both installed. I'm trying to update some pages that I have updated before but not for 6 months or so but nevertheless I have done it many time for years. Whenever I try to copy or cut, with the menu or by Control C or x, I get a -->> Microsoft� Publisher 2000 Version 6.0 has encountered a problem and needs to close. We are sorry for the inconvenience.<<-- It doesn't matter where on the form I try to copy the results are the same. I have 17 forms that look ali...

Unexpected error has occured
Hello This has been happening to a user on every Excel worksheet she opens. This pops up "Unexpected error has occured - AutoRecover has been disabled for the session of excel" She has been recently upgraded to Office 2007 SP2 running on XP SP3. I checked online "google" and it says to change the place where the autorecovery is saved. I did that but it is still happening. Please let me know what I am doing wrong. Thanks This KB might help http://support.microsoft.com/kb/289273/en-us best wishes -- Bernard Liengme http://people.stfx.ca/bliengme...

division by zero error
I have data where there is a division by zero error because nothing is entered, but that will change when the data is entered. Is there a way I can suppress the chart from putting 0's in its place so that there is a gap in the chart when there is a division by zero error? Try replacing the division formula by something along these lines: =IF(A1="",NA(),B1/A1) The chart engine ignores N/A best wishes -- Bernard V Liengme Microsoft Excel MVP www.stfx.ca/people/bliengme remove caps from email "Tom" <Tom@discussions.microsoft.com> wrote in message news:570F8C5...

Error assign Account to user
Hi, I have a problem when I'm trying to assign a account to a new user. The system are just saying: unexpected Error Anyone there have same issue? -- Best regards, Anders Jeppesen MCP, MCTS, MPV CRM Gruppen ApS ...

COMPILE ERROR
When I open a Document in Either EXCEL or WORD I get a message, COMPILE ERROR IN HIDDEN MODULE AUTOEXEC, or AUTOEXEC NEW. I get a similar message when I close the document. File works OK but how can I get rid of this. MS say its something to do with the Norton Antivirus I have installed. Never had problems before just recently after I had to reinstall Win 2000, and Office 2000 Thanks PHIL ...

ESM error ID c1030af2 "Internal Server Error"
Hi all, We are in progress of upgrading from our 2000 domain and Exchange to 2003. So far we have deployed a w2003 server, upgraded to a DC and transfered the FSMO roles from the old W2K DC. The W2K DC has been demoted to a member server this server hosts Exchange 2000. Exchange 2003 has been installed on the new 2003 DC in the same site as the E2K. We now come to mgrate Exchange 2000 from the old DC to the new DC with Exchange 2003. As described in Q307917 Removing the first Excahnge 2000 Server from the site, we attempt to connect to the Public folders using ESM to replicate and g...

mailbox error
hi i have a problem with mailbox, i can't mount the mail box and public folder "noush" <anonymous@discussions.microsoft.com> wrote in news:4d3201c473d4 $22ce1a50$a601280a@phx.gbl: > hi > i have a problem with mailbox, i can't mount the mail box > and public folder > What's the specific error? Was there any kind of disaster recovery or Restore done to the server? Thanks Chasy -- This posting is provided "AS IS" with no warranties, and confers no rights. OR if you wish to include a script sample in your post please add "Use of ...

Error: Hay demasiados formatos de celda diferente.
This is a multi-part message in MIME format. ------=_NextPart_000_0006_01C5C431.45DFE5B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hola: Me aparece un mensaje de error diciendo " Hay demasiados formatos de = celda diferente." siempre que intento cambiar de formato las celdas. Alguien sabe el motivo Gracias ------=_NextPart_000_0006_01C5C431.45DFE5B0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//E...