PC Review


Reply
Thread Tools Rate Thread

Remapping properties

 
 
Michael Groeger
Guest
Posts: n/a
 
      23rd Feb 2005
Hi,

we have a problem when exporting data to excel or viewing data in grids.

For example, imagine a order with a CustomerId and order details. The
CustomerId maps to a concrete customer in Customers (with customer details,
such as name, etc.). The data object for this is implemented like the
following:

public class Order
{
public int CustomerId {get; set; }

// [...]
}

Now, I want to be able to wrap the data object Order when the order gets
exported like the following:

public class OrderView
{
public string Customer
{
get { // do some logic to get the requested value}
set { // do some logic to set the requested value }
}
}

whereas Customer returns the name of the customer. Of course it would be
easily to wrap the complete data object in such a manner that whenever an id
must be mapped to a name or else, we implement the requested logic, but when
it is not required we simply call the appropriate property in our data
object:

public class OrderView
{
private Order _Order;

public string Customer
{
get { // do some logic to get the requested value}
set { // do some logic to set the requested value }
}

public int Amount
{
get { return _Order.Amount; }
set { _Order.Amount = value; }
}
}

I heard of some methods using reflection (I think) where it is possible to
redefine properties. So what I am thinking of is to use this method to
overwrite properties whenever needed but to let through all other properties
with only little afford in coding whenever a property must not be
overwritten.

What is a good point to start here?

Regards,
Michael


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
app.config remapping Harry Simpson Microsoft Dot NET Compact Framework 0 12th Jan 2007 06:39 PM
Key remapping =?Utf-8?B?SmltNzg5?= Windows XP General 3 2nd Nov 2005 03:38 AM
Keyboard remapping? Sara Windows XP Hardware 1 30th Aug 2004 11:28 AM
Keyboard remapping kamil Windows XP Setup 0 19th Nov 2003 01:04 PM
Keyboard remapping Hannah Windows XP Customization 2 20th Oct 2003 03:51 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:23 AM.