TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jason Addique
NA
1
7.7k
WCF dataContracts and LINQ to SQL
Aug 16 2010 2:32 PM
Iam trying to create a basic WCF service library web service which connects to a database via LINQ to SQL and returns list of DataContract marked objects but I keep recieving this error:
Error 1 Cannot implicitly convert type 'System.Linq.IQueryable<CwkServer.getCarDetails>' to 'System.Collections.Generic.List<CwkServer.getCarDetails>'. An explicit conversion exists (are you missing a cast?) C:\Users\Cameron\Documents\Visual Studio 2008\Projects\CwkServer\CwkServer\CwkService.cs 34 22 CwkServer
I feel its just a basic error on my part but cant see it. Here is my code
cwkService
public List<getCarDetails> getDetails()
{
List<getCarDetails> details = from list in db.Listings
select new getCarDetails
{
CarName = list.CarType.CarTypeName,
NumDoors = list.CarType.NumberOfDoors,
};
return details;
}
ICwkService
[DataContract]
public class getCarDetails
{
string carName;
int numDoors;
[DataMember]
public string CarName
{
get { return carName; }
set { carName = value; }
}
[DataMember]
public int NumDoors
{
get { return numDoors; }
set { numDoors = value; }
}
}
Any advice would be greatly appreciated, kind of hit a brick wall with it now
Thanks
Jason
Reply
Answers (
1
)
How to call java service using WCF without app.config
WCF Typed DadaTable with additional columns