Reputation: 17581
I'm trying to build a simple web service which return a list of shows from a database. The web service has the following code to get its data:
private BLLoptredens BLLoptredens = new BLLoptredens();
[WebMethod]
public Array getVoorstellingenByArtiest(string p_artiest)
{
return BLLoptredens.selectByArtistName(p_artiest).ToArray() ;
}
The data comes from the BLL, which just passes data from the DAL like so:
public IList<Optreden> selectByArtistName(string p_artiest)
{
var query = (from o in dc.Optredens
where o.artiest.Contains(p_artiest)
select o);
return query.ToList();
}
This crashes with the following error:
You must implement a default accessor on System.Array because it inherits from ICollection
Can something help me on my way with this?
Upvotes: 1
Views: 2052
Reputation: 4655
public Optreden[] getVoorstellingenByArtiest(string p_artiest)
{
return BLLoptredens.selectByArtistName(p_artiest).ToArray() ;
}
Note the Optreden[]. And I hope the Optreden is a DataContract with serializable members decorated with DataMember attribute
Upvotes: 0
Reputation: 12534
Is there any particular need to give back an interface instead of a full-fledged generic class?
Try changingIList<Optreden>
to List<Optreden>
-- that should do it.
Upvotes: 1