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
Saurabh
NA
42
5.7k
LINQ - No output
Apr 23 2019 7:58 AM
I am unble to find records for Employees table in the following code. I have used Entity data model.
Here for Console.WriteLine("Department Name = " + dept.Name ); output is coming but for dept.Employees.Count() is 0.
using (EmpDBContext dbcontext = new EmpDBContext())
{
var departments = from dept in dbcontext.Departments
where dept.Name == "IT"
select dept;
foreach (var dept in departments)
{
Console.WriteLine("Department Name = " + dept.Name );
Console.WriteLine("count is " + dept.Employees.Count());
//var employees = from e in dept.Employees
// where e.ID == dept.ID && e.Gender == "Male"
// select e;
}
Console.ReadKey();
}
Reply
Answers (
6
)
Delegates And Events
BLL file to manage Lookup tables in one or more BLL files