-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Best practice on Data binding objects
PostPosted: Fri Mar 27, 2009 11:03 am 
Regular
Regular

Joined: Wed Feb 11, 2009 10:58 am
Posts: 55
Hello,

I know this is not directly a NHibernate question, but I think there are a lot of people here which had the same problem and could point me in the right direction.

Imagine the following:

Code:
public class A
{
  public String FieldA;
}

public class B
{
  public A a;
  public String FieldB;
}

public class C
{
  public B b;
  public String FieldC;
}


This is a simple 1:n relationship. If I now want to bind Class C to any Control I can just access FieldC. b is an object and I can't bind that to control.
The only way I can imagine doing something like is extending class C:

Code:
puglic class C
{
  public B b;
  public String FieldC;

  public String bValue { get { return b.FieldB; } set { b.FieldB = value; } }
  public String aValue { get { return b.a.FieldA; } set { b.a.FieldA = value; } }
}


but this looks a bit clumsy in my eyes and also it isn't a very nice design.

Another way would be to transform class C into a class visualizerC, though doing this everytime I want to show it can also get a bit frustrating.

Anybody got a tip or a best practice how to solve this?

Thanks for you help!!!!

Greetings Reflection


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 30, 2009 3:21 pm 
Beginner
Beginner

Joined: Mon Mar 06, 2006 2:19 pm
Posts: 42
Location: Belo Horizonte, Brazil
The best thing to do is not use Windows Form Data Binding. It's terrible.

It makes debuging a screen a hell and has several problems.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 31, 2009 3:39 am 
Regular
Regular

Joined: Wed Feb 11, 2009 10:58 am
Posts: 55
well I need at least a Grid to show the DataGridView of the Objects above. So I have to "flatten" out this object anyway.

And I think you can always do it without Databinding as soon as you have a problem you can't solve with Databinding. I did sometimes in my program already.

In my case the software is just a small software project for which I'm the only Developer, so changes can be made easily.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.