ssteenkiste / nettiers

Automatically exported from code.google.com/p/nettiers
1 stars 0 forks source link

Two-way binding with Entities not working #362

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
 1. Databind a property of an entity to a control.
  i.e.  textBox1.DataBindings.Add("Text", contact, "FirstName");

 2. Change the value of the entity's (Firstname) property.

What is the expected output? What do you see instead?
 The bound control should update, but does not. (The text in the textBox1 does not update)

What version of .netTiers and CodeSmith are you using?
Nettiers v2.3.1.870 (release)
CodeSmith Generator Studio v5.3.1

Please provide any additional information below.
 Two-way binding stopped working in r514, when the GetHashCode() method in EntityInstanceBase.generated.cs was added to allow the object's uniqueness to be defined by its value, not it's object reference.

Temporary work arounds:
Option 1
 Comment out the GetHashCode() method in EntityInstanceBase.generated.cst to define the object's uniqueness by it's object reference
Option 2
 Change the GetHashCode method in EntityInstanceBase.generated.cst to the following, to define the object's uniqueness by it's primary key:

public override int GetHashCode()
{           
   return <%
      for (int i=0; i < cols.Count; i++) 
      {
         if (cols[i].IsPrimaryKeyMember)
         {
            Response.Write("this."+ GetPropertyName(cols[i]) + ".GetHashCode()");
         }
      } 
   %>;
} 

Original issue reported on code.google.com by stephen....@gmail.com on 11 Jan 2011 at 4:11

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 11 Jan 2011 at 10:20

GoogleCodeExporter commented 9 years ago
Refers to the following post: 
http://community.codesmithtools.com/nettiers/f/16/p/11650/44781.aspx#44781

Original comment by bniemyjski on 11 Jul 2011 at 12:31