470,815 Members | 3,163 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

VB .Net circular dependency error

djm
I have a method in a "Business" Class that needs to call a method in a "UI"
Class
Currently, the "UI" Class calls methods in the "Business" Class...this I
can't change.

When I tried to add a reference to the "UI" in the "Business" project, I got
an error saying I couldn't because of circular dependency...which I get.

I believe creating a public interface is probably my only option, but I'm
not exactly sure how to go about doing it. Any help or suggestions would be
greatly appreciated.

Thx,
-- djm
Apr 7 '06 #1
7 3260
A business class should never call any method in a UI class, first of all.
The purpose of separating the layers is to enable other UIs to use the
Business class(es). The Business class(es) should know nothing about the UI,
but only provide business functionality with regards to the data being
manipulated. The UI class may know anything about the publicly-exposed
members of the Business class(es).

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"djm" <dj*@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
I have a method in a "Business" Class that needs to call a method in a "UI"
Class
Currently, the "UI" Class calls methods in the "Business" Class...this I
can't change.

When I tried to add a reference to the "UI" in the "Business" project, I
got
an error saying I couldn't because of circular dependency...which I get.

I believe creating a public interface is probably my only option, but I'm
not exactly sure how to go about doing it. Any help or suggestions would
be
greatly appreciated.

Thx,
-- djm

Apr 7 '06 #2
djm
Hi Kevin and Thx for the quick response.

I agree, but I'm involved in a project to convert a very big vb6 application
into .Net and the first phrase is to just convert and integrate the new code
in to the application.

Here's the problem.
I have methods in many different business layers that need security
clearance and I need the user to supplier their password.

How can I accomplish this in n-tier architecture?

Thx,
-- djm
"Kevin Spencer" wrote:
A business class should never call any method in a UI class, first of all.
The purpose of separating the layers is to enable other UIs to use the
Business class(es). The Business class(es) should know nothing about the UI,
but only provide business functionality with regards to the data being
manipulated. The UI class may know anything about the publicly-exposed
members of the Business class(es).

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"djm" <dj*@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
I have a method in a "Business" Class that needs to call a method in a "UI"
Class
Currently, the "UI" Class calls methods in the "Business" Class...this I
can't change.

When I tried to add a reference to the "UI" in the "Business" project, I
got
an error saying I couldn't because of circular dependency...which I get.

I believe creating a public interface is probably my only option, but I'm
not exactly sure how to go about doing it. Any help or suggestions would
be
greatly appreciated.

Thx,
-- djm


Apr 7 '06 #3
You could also just create a new class that references both your UI and
Business class. But if you already have methods in the Business class
calling methods in the UI class, then your sorta screwed. You really should
considered the benefits or migration to a more structured .NET version.
..NET does not lend itself to poor OOP implementations of VB6.

"djm" <dj*@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
I have a method in a "Business" Class that needs to call a method in a "UI"
Class
Currently, the "UI" Class calls methods in the "Business" Class...this I
can't change.

When I tried to add a reference to the "UI" in the "Business" project, I
got
an error saying I couldn't because of circular dependency...which I get.

I believe creating a public interface is probably my only option, but I'm
not exactly sure how to go about doing it. Any help or suggestions would
be
greatly appreciated.

Thx,
-- djm

Apr 7 '06 #4
> Here's the problem.
I have methods in many different business layers that need security
clearance and I need the user to supplier their password.
How you handle this depends upon the type of security you're implementing.
Is it role-based, for example? In any case, the UI layer should be agnostic
of the user. All it should provide is the interface for the user to log in.
The business layer should handle the actual security. Remember, all the UI
layer is, is an interface for the user to interact with the business layer.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"djm" <dj*@discussions.microsoft.com> wrote in message
news:C1**********************************@microsof t.com... Hi Kevin and Thx for the quick response.

I agree, but I'm involved in a project to convert a very big vb6
application
into .Net and the first phrase is to just convert and integrate the new
code
in to the application.

Here's the problem.
I have methods in many different business layers that need security
clearance and I need the user to supplier their password.

How can I accomplish this in n-tier architecture?

Thx,
-- djm
"Kevin Spencer" wrote:
A business class should never call any method in a UI class, first of
all.
The purpose of separating the layers is to enable other UIs to use the
Business class(es). The Business class(es) should know nothing about the
UI,
but only provide business functionality with regards to the data being
manipulated. The UI class may know anything about the publicly-exposed
members of the Business class(es).

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"djm" <dj*@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
>I have a method in a "Business" Class that needs to call a method in a
>"UI"
> Class
> Currently, the "UI" Class calls methods in the "Business" Class...this
> I
> can't change.
>
> When I tried to add a reference to the "UI" in the "Business" project,
> I
> got
> an error saying I couldn't because of circular dependency...which I
> get.
>
> I believe creating a public interface is probably my only option, but
> I'm
> not exactly sure how to go about doing it. Any help or suggestions
> would
> be
> greatly appreciated.
>
> Thx,
> -- djm


Apr 7 '06 #5
SP

"djm" <dj*@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
I have a method in a "Business" Class that needs to call a method in a "UI"
Class
Currently, the "UI" Class calls methods in the "Business" Class...this I
can't change.

When I tried to add a reference to the "UI" in the "Business" project, I
got
an error saying I couldn't because of circular dependency...which I get.

I believe creating a public interface is probably my only option, but I'm
not exactly sure how to go about doing it. Any help or suggestions would
be
greatly appreciated.


Your UI should respond to events from your business layer.

SP
Apr 9 '06 #6
djm
Yep, I'm pretty much screwed, so I'm going to leave the main function that
is giving me so much grief in VB 6 for now and use xml to call the process
until we can re-architect our security model.
Thx for your input.
--
Thx,
-- djm
"Rob R. Ainscough" wrote:
You could also just create a new class that references both your UI and
Business class. But if you already have methods in the Business class
calling methods in the UI class, then your sorta screwed. You really should
considered the benefits or migration to a more structured .NET version.
..NET does not lend itself to poor OOP implementations of VB6.

"djm" <dj*@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
I have a method in a "Business" Class that needs to call a method in a "UI"
Class
Currently, the "UI" Class calls methods in the "Business" Class...this I
can't change.

When I tried to add a reference to the "UI" in the "Business" project, I
got
an error saying I couldn't because of circular dependency...which I get.

I believe creating a public interface is probably my only option, but I'm
not exactly sure how to go about doing it. Any help or suggestions would
be
greatly appreciated.

Thx,
-- djm


Apr 10 '06 #7
djm
Security is not role based. It is based on access levels within the
application.
Depending on your access level, you may only be able to view certain screens
or fields in the UI...or you may have to provide your (non-windows) password
to be able to view or edit screens or fields.

I need to move on, so I'm going to leave the function in vb6 and call it via
xml until we can refactor our security model.

Thx for your help.

--
Thx,
-- djm
"Kevin Spencer" wrote:
Here's the problem.
I have methods in many different business layers that need security
clearance and I need the user to supplier their password.


How you handle this depends upon the type of security you're implementing.
Is it role-based, for example? In any case, the UI layer should be agnostic
of the user. All it should provide is the interface for the user to log in.
The business layer should handle the actual security. Remember, all the UI
layer is, is an interface for the user to interact with the business layer.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"djm" <dj*@discussions.microsoft.com> wrote in message
news:C1**********************************@microsof t.com...
Hi Kevin and Thx for the quick response.

I agree, but I'm involved in a project to convert a very big vb6
application
into .Net and the first phrase is to just convert and integrate the new
code
in to the application.

Here's the problem.
I have methods in many different business layers that need security
clearance and I need the user to supplier their password.

How can I accomplish this in n-tier architecture?

Thx,
-- djm
"Kevin Spencer" wrote:
A business class should never call any method in a UI class, first of
all.
The purpose of separating the layers is to enable other UIs to use the
Business class(es). The Business class(es) should know nothing about the
UI,
but only provide business functionality with regards to the data being
manipulated. The UI class may know anything about the publicly-exposed
members of the Business class(es).

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"djm" <dj*@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
>I have a method in a "Business" Class that needs to call a method in a
>"UI"
> Class
> Currently, the "UI" Class calls methods in the "Business" Class...this
> I
> can't change.
>
> When I tried to add a reference to the "UI" in the "Business" project,
> I
> got
> an error saying I couldn't because of circular dependency...which I
> get.
>
> I believe creating a public interface is probably my only option, but
> I'm
> not exactly sure how to go about doing it. Any help or suggestions
> would
> be
> greatly appreciated.
>
> Thx,
> -- djm


Apr 10 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Evelyne | last post: by
1 post views Thread by Mohit Gupta | last post: by
2 posts views Thread by ernesto basc?n pantoja | last post: by
4 posts views Thread by Henke | last post: by
2 posts views Thread by Rimma Meital via .NET 247 | last post: by
8 posts views Thread by Jeff Connelly | last post: by
7 posts views Thread by barias | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.