ssteenkiste / nettiers

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

EntityState is always "Unchanged" on service side when calling Save method via WCF service #232

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. Create new Entity: 

  Order newOrder = new Order();

EntityState property equals "Added"

2. Save via WCF service:
serviceClient.Save(newOrder);

3. On service side EntityState property equals "Unchanged"

.netTiers v2.3.0.RTM
CodeSmith 5.1.1 Release 8242

I suppose it's because there is no [DataMember] attribute on EntityState 
property in the files:
  EntityBaseCore.generated.cs, EntityInstanceBase.generated.cs

Putting this attribute, as in the code below, fixed this bug:

  [BrowsableAttribute(false)<%= (!SerializeEntityState ? ", 
XmlIgnoreAttribute()" : "") %>]
  <% if (IncludeWCFDataAttributes && SerializeEntityState ) { %>
  [DataMember]
  <% } %>
  public abstract EntityState EntityState { get; set; }

P.S. And some strange code I've found in the EntityBaseCore.generated.cs:

public virtual bool IsNew
{
get { return this.EntityState == EntityState.Added; }
set { this.EntityState = EntityState.Added; }
}
I don't know if this bug or not.

Original issue reported on code.google.com by ElS...@gmail.com on 17 Jun 2009 at 4:03

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 25 Jun 2009 at 1:53