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.  [ 1 post ] 
Author Message
 Post subject: Problem Binding NHibernate linked collections to few DataGri
PostPosted: Tue Aug 15, 2006 4:22 am 
Newbie

Joined: Tue Aug 15, 2006 3:33 am
Posts: 1
Location: Russia
Hibernate version:
1.1


i can't bind three linked collections with TreeView and two DataGrid

I have 4 classes, Catalog, Categories, Products and ProductInstances:


I have instance of class atoi.BusinessFramework.Entities.Catalog cat;

First win control XtraTreeLiist.TreeList, i bind categories

Code:
treeCatalog.DataBindings.Add("DataSource", cat, "Categories");



second win control XtraGrid.GridControl, i bind product for selected category

Code:
gridProducts.DataBindings.Add("DataSource", cat.Categories, "Products");


all, fine


but!, i can't bind ProductInstances for selected product


How do it?

Code:
   public class Catalog
   {
      private IList categories;

      public IList Categories
      {
         get { return categories; }
         set { categories = value; }
      }
   }

public class Category
   {
      private int categoryId;

      public int CategoryId
      {
         get { return categoryId; }
         set { categoryId = value; }
      }
      private string name;

      public string Name
      {
         get { return name; }
         set { name = value; }
      }
      private Category parent;

      public Category Parent
      {
         get { return parent; }
         set { parent = value; }
      }
      private int parentId;

      public int ParentId
      {
         get { return parentId; }
         set { parentId = value; }
      }

      IList products = null;
      public virtual IList Products
      {
         get
         {
            if (products == null)
            {
               products = new ArrayList();
            }

            return products;
         }
         set
         {
            products = value;
         }
      }

   }

   public class Product
   {
      #region Сво.ствa сохран.ем.е в .а.е .анн.х
      private int productId;

      public int ProductId
      {
         get { return productId; }
         set { productId = value; }
      }
      private string name;

      public string Name
      {
         get { return name; }
         set { name = value; }
      }
      private string code;

      public string Code
      {
         get { return code; }
         set { code = value; }
      }
      private string codeStringFormat;

      public string CodeStringFormat
      {
         get { return codeStringFormat; }
         set { codeStringFormat = value; }
      }
      private string notes;

      public string Notes
      {
         get { return notes; }
         set { notes = value; }
      }
      private Image image;

      public Image Image
      {
         get { return image; }
         set { image = value; }
      }
      /*Кое.....ент на.енк. .ро.укта
       */
      private float extra;

      public float Extra
      {
         get { return extra; }
         set { extra = value; }
      }
      private Category category;

      public Category Category
      {
         get { return category; }
         set { category = value; }
      }
      IList instances = null;
      public virtual IList Instances
      {
         get
         {
            if (instances == null)
            {
               instances = new ArrayList();
            }

            return instances;
         }
         set
         {
            instances = value;
         }
      }
      #endregion //Сво.ствa сохран.ем.е в .а.е .анн.х
   }

class ProductInstance
   {
      private int instanceId;

      public int InstanceId
      {
         get { return instanceId; }
         set { instanceId = value; }
      }
      private Product product;

      public Product Product
      {
         get { return product; }
         set { product = value; }
      }
      private string code;

      public string Code
      {
         get { return code; }
         set { code = value; }
      }
      private float price;

      public float Price
      {
         get { return price; }
         set { price = value; }
      }
      private float extra;

      public float Extra
      {
         get { return extra; }
         set { extra = value; }
      }
   }

[/code]


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

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.