WCF RIA Services Custom Type with Collection of Custom Types
Posted
by Blakewell
on Stack Overflow
See other posts from Stack Overflow
or by Blakewell
Published on 2010-04-05T16:36:13Z
Indexed on
2010/04/05
16:43 UTC
Read the original article
Hit count: 299
.net-4.0
|wcf-ria-services
Is it possible to have a custom type within a custom type and have the result returned via WCF RIA services? I have the following two classes below, but I can't gain access to the Verticies property within the Polygon class. I assume it is because it is a custom class, or something to do with it being a List collection.
Polygon Class
public class Polygon
{
public Polygon()
{
_vertices = new List<Location>();
}
private int _id;
[Key]
public int Id
{
get;
set;
}
private List<Location> _vertices;
public List<Location> Vertices
{
get
{
return _vertices;
}
set
{
_vertices = value;
}
}
}
Location Class
public class Location
{
public Location()
{
}
/// <summary>
/// Default constructor for creating a Location object
/// </summary>
/// <param name="latitude"></param>
/// <param name="longitude"></param>
public Location( double latitude, double longitude )
{
_latitude = latitude;
_longitude = longitude;
}
private int _id;
[Key]
public int Id
{
get
{
return _id;
}
set
{
_id = value;
}
}
private double _latitude;
/// <summary>
/// Latitude coordinate of the location
/// </summary>
public double Latitude
{
get
{
return _latitude;
}
set
{
_latitude = value;
}
}
private double _longitude;
/// <summary>
/// Longitude coordiante of the location
/// </summary>
public double Longitude
{
get
{
return _longitude;
}
set
{
_longitude = value;
}
}
}
© Stack Overflow or respective owner