vs2008循环引用(C#) [英] vs2008 circular references (c#)

查看:75
本文介绍了vs2008循环引用(C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在vs2008解决方案中的设置:

Here's the setup I have in a vs2008 solution:

名为MyProject.Data的项目中的数据层

Data layer in a project named MyProject.Data

名为MyProject.Web的项目中的Web应用程序

Web application in a project named MyProject.Web

MyProject.Web引用了MyProject.Data

MyProject.Web has a reference to MyProject.Data

在MyProject.Web中,我有一个名为"MySite.Utils"的类

In MyProject.Web I have a class I use called "MySite.Utils"

我希望能够在MyProject.Data中使用MySite.Utils,但我不能,因为这会导致循环引用.

I want to be able to use MySite.Utils in MyProject.Data but I can't because it would cause a circular reference.

一个不可能的解决方案是创建第三个项目并在其中移动"MySite.Utils",因为MySite.Utils实际上使用了MyProject.Data(因此需要引用它,并且将创建另一个循环引用)

One solution which is NOT possible is creating a third project and moving "MySite.Utils" in there because MySite.Utils actually uses MyProject.Data (thus it needs to reference it and another circular reference would be created)

解决此问题的最佳/最简便方法是什么?

What's the best/easiest way to fix this?

推荐答案

您需要根据声音将MySite.Utils移至MyProject.Data

You need to move MySite.Utils to MyProject.Data by the sound of it

这篇关于vs2008循环引用(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆