Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

While transferring entity class object from presentation layer to service layer all the numeral values are reset to ZERO.
C#
//Entity Class Library
Class Entity
{
public int value{get; set;}
}

C#
// default.aspx.cs
using(service1.Execute exe = new service1.Execute())
{
service1.Entity ent = new service1.Entity();
ent.value = 10;
exe.Run(ent) ;
}

C#
//service layer - I use interface while defining contracts for easy understanding i used in a same class
[ServiceContract]
class Execute 
{
[OperationContract]
public void Run(Entity e)
{
int value = e.value; // i get zero but i set into 10
}
}

How can i fix it?

Thanks,
Regards,
--SJ
Posted
Updated 30-May-13 23:09pm
v4
Comments
Jameel VM 25-May-13 4:59am    
please post the code what you have tried
codeninja-C# 30-May-13 10:33am    
hi, i updated my question please respond to it - thanks

1 solution

You have to use DataContractAttribute and DataMemberAttribute like this[^]
 
Share this answer
 
Comments
codeninja-C# 31-May-13 3:31am    
Hi,
Even though i am using data contract all the numeral data types (int,long,bit) are reset to zero
--SJ

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900