Windows Develop Bookmark and Share   
 index > Windows Forms General > class object type cast issue
 

class object type cast issue

Hello
In my application I have UI layer, Business layer , data layer.

At data layer I am listening socket to fill cutomer data. I have a

sortedDictionary<int, Customer> std = new SortedDictionary<int, Customer>;

(Customer is a class I have in my data layer which contain only properties on customer forexample)


class Customer

{


private string customerName;

public string CustomerName
{
get { return customerName; }
set { customerName = value; }
}

private int Age;

public int Age1
{
get { return Age; }
set { Age = value; }
}


etc.....

}


Now assume that I have filled customer dictionary with customer class object records Now I want to return to UI layer so that display in grid
BUT I CAN NOT TYPE CAST IT B/C I DON'T HAVE customer class at UI layer and my UI layer reference to business layer and business layer reference to
data layer

How can I solve this issue


Regards

It_s Meee  Tuesday, November 18, 2008 11:22 AM

I guess your problem is a circular reference loop. There's no work around for that.

Stop, step back and take a look at your code and be willing to change it. Look at all of you classes and figure out why that class is in a given assembly. For example, why is a class that describes a data object defined on the UI layer instead of the Data Layer?

Hope this helps.

Rudedog =|^D

Rudedog2  Tuesday, November 18, 2008 1:32 PM

We are changing the issue type to “Comment�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

Thank you!

Bruce.Zhou  Tuesday, November 25, 2008 3:34 AM
Hi


please follow the layers order like This


User Interface Layer


namespace Layers.UI
{
public class UICustomer
{

#region "Layer objects"
private Layers.BL.BLCustomer ObjBLCustomer;
#endregion

public UICustomer()
{
ObjBLCustomer = new BL.BLCustomer();
}
}
}




Business

namespace Layers.BL
{
public class BLCustomer : BusinessLayers
{
#region "Layer instances"
private Layers.DL.DLCustomer ObjDLCustomer;
#endregion

public BLCustomer()
{
ObjDLCustomer = new Layers.DL.DLCustomer();
}


#region "properties"
-----
#endregion

}

}



Datalayer


using Prodigy.ACSL.CMS.BL;

namesapce Layers.DL
{
public class DLCustomer : DataBaseObjects
{
#region "Layer instances"

#endregion


public DLCustomer()
{

}

public int Insert(BLCustomer ObjBLC)
{
//Aceess objBLC.<propertyname>
}
}
}


Hope this will help you
thanks & Regards
Dhinesh paramasivam
iyngarangce  Tuesday, November 25, 2008 7:11 AM
Bruce Zhou - MSFT wrote:

We are changing the issue type to “Comment�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

Thank you!

The OP

This question may have been answered in a duplicate thread. The OP has to reply to that one. But, I think the OP found a solution.

Rudedog2  Tuesday, November 25, 2008 2:13 PM

You can use google to search for other answers

Custom Search

More Threads

• Problem in Crystal Reports V9.0
• Is there any way can stop the datagridview auto scrolling
• Is it possible to enable 'click' on the combobox during design-time
• C# - Set Focus on TextBox - Which Event?
• How to show the Japanese Characters as well as English character in a DataGridView under a single column
• it is NOT possible to setup win app without .net Framework?!!!!!!
• Installation problems - icons in start menu, etc replaced by my app's icon
• Can I link List<T> to DataGridView?
• FileVersionInfo bug !?
• DataGridViewCheckBoxCell. programming events.