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
Riddhi Valecha
443
3.3k
411k
EntityFramework- Error in converting to to 'System.Collections.Generic
Dec 10 2020 9:20 AM
Hello Team,
My Code is -
namespace Models
{
public class getChildQuestions
{
public int qid { get; set; }
public string qname { get; set; }
}
public class GetCPQuestionMasterModel
{
public Int32 QID_Get { get; set; }
public List<getChildQuestions> Child_Question_Get { get; set; }
public Int32 Active_Get { get; set; }
}
}
-----------------------------
namespace DAL
{
public static List<getChildQuestions> SubQuestions(Int32 QuestionID)
{
CPContext Context = new CPContext();
var SubQuestions = (from CB in Context .Question_Master
where CB.FKQID == QuestionID
select new getChildQuestions
{
qid = CB.QID,
qname = CB.Question
});
return SubQuestions.ToList();
}
---------
public List<GetCPModel> GetQuestionMaster(GetCPModel _Req)
{
CPContext Context = new CPContext ();
List<GetCPModel> _resReponseModel = null;
Int32 QuestionMasterCount = Context.Question_Master.Count();
if (QuestionMasterCount > 0)
{
_resReponseModel = (from p in Context.Question_Master
select new GetCPModel
{
QID_Get = p.QID,
Child_Question_Get = SubQuestions(p.FKQID),
Active_Get = p.Active,
}).ToList();
}
return _resReponseModel ;
}
}
-------------
On Line "Child_Question_Get = SubQuestions(p.FKQID), ", I am
I am getting an error -"Error in converting "how are you" to 'System.Collections.Generic.List`.
Please guide .. ITs really urgent.
Reply
Answers (
12
)
Please recommend me the best database for desktop level software
Cassandra sink connector : how to add whole topic JSON in one col.