I have a hbm file like this:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false" namespace="Test.Domain.Seasons" assembly="Test.Domain">
<class name="SaleSeason" table="TSP.SALESEASONS">
<!-- Primary Key(s) -->
<id name="Id" column="ID" type="Int32" unsaved-value="0">
<generator class="assigned"/>
</id>
<!-- Properties -->
<property column="NAME" type="String" name="Name" length="50" />
</class>
</hibernate-mapping>
The model file is like this:
Code:
public class SaleSeason
{
#region Private Members
// Variabili di stato
private bool _isChanged;
private bool _isDeleted;
// Primary Key(s)
private int _id;
// Properties
private string _name;
#endregion
#region Default ( Empty ) Class Constructor
/// <summary>
/// default constructor
/// </summary>
public SaleSeason()
{
_id = 0;
_name = null;
}
#endregion // End of Default ( Empty ) Class Constructor
#region Full Constructor
/// <summary>
/// full constructor
/// </summary>
public SaleSeason(int id, string name)
{
_id = id;
_name = name;
}
/// <summary>
/// PK Unique ID, Entered Manually
/// </summary>
[DataMember]
public int Id
{
get { return _id; }
set { _isChanged |= (_id != value); _id = value; }
}
.............................
.............................
And I have writen a service to return a SaleSeason object,the service contract is :
[OperationContract]
SaleSeason UpdateSaleSeason(SaleSeason season);
I also have a silverlight client, but when I invoke the service on the silverlight client,even I have set a value to Id,but on the service client,the received object's id is always 0 . I don't know how to set the value of Id.
Does anybody know why? and how to solve this problem?