Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I use Code first EntityFramework 5 in my project. I came across a strange problem. My code is as follow:

 public IQueryable<Company> Companies
    {
        get
        {
            return context.Companies.Include("BankAccounts").Include("CompanyContacts").Include("MyClients").Include("MyCompanies");
        }
    }

and method for calling some Companies:

public IQueryable<Company> GetMyCompaniesByUserId(Guid userId)
    {
        var obj = context.Companies.Include("BankAccounts");
        //Thread.Sleep(1000);
        var companeies = from c in obj
                         from myc in context.MyCompanies
                         where c.IsDelete == false && myc.UserId == userId && c.CompanyId == myc.CompanyId
                         select c;
        return companeies;

    }

Problem is that When I call GetMyCompaniesByUserId() method the bankaccounts is null, but when I debug this code step by step it works. I don't have any idea about problem. Please, help me. Thank in advance.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.