How can I get my business objects layer to use the management layer in their methods?

Posted by Tom Pickles on Stack Overflow See other posts from Stack Overflow or by Tom Pickles
Published on 2012-04-03T11:25:00Z Indexed on 2012/04/03 11:30 UTC
Read the original article Hit count: 161

Filed under:
|
|
|
|

I have a solution in VS2010 with several projects, each making up a layer within my application. I have business entities which are currently objects with no methods, and I have a management layer which references the business entities layer in it's project. I now think I have designed my application poorly and would like to move methods from helper classes (which are in another layer) into methods I'll create within the business entities themselves.

For example I have a VirtualMachine object, which uses a helper class to call a Reboot() method on it which passes the request to the management layer. The static manager class talks to an API that reboots the VM. I want to move the Reboot() method into the VirtualMachine object, but I will need to reference the management layer:

public void Reboot()
{  
    VMManager.Reboot(this.Name);
}

So if I add a reference to my management project in my entities project, I get the circular dependency error, which is how it should be. How can I sort this situation out? Do I need to an yet another layer between the entity layer and the management layer? Or, should I just forget it and leave it as it is.

The application works ok now, but I am concerned my design isn't particularly OOP centric and I would like to correct this.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET