Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6912659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:07:11+00:00 2026-05-27T09:07:11+00:00

I am using ADO.NET Mocking Context Generator plugin for my Entity Framework model. I

  • 0

I am using ADO.NET Mocking Context Generator plugin for my Entity Framework model. I have not started on using mocks yet, just trying to fix generated entity and context classes to make application run as before without exceptions. I’ve already fixed T4 template to support SaveChanges method.

Now I’ve got another problem: when I try to access any navigation property it is set to null.
All the primitive fields inherited from DB table are set and correct.

So what I am doing is the following

using (var context = MyContext())
{
      var order = context.Orders.Where(p => p.Id == 7);
      var product = order.Products;
}

in this case product is set to null. But that was not a case while using default code generator, it used to return real product object.

Thanks ahead for any suggestions!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:07:12+00:00Added an answer on May 27, 2026 at 9:07 am

    I tried to fix t4 template and nothing helped. So I gave up on ADO.NET Mocking Context Generator template and switched to ADO.NET POCO Entity Generator template. I followed the steps mentioned here http://slappyza.wordpress.com/2010/08/08/getting-the-entity-framework-to-generate-an-interface-for-mocking/
    But instead of RhinoMock for testing I used Moq library.

    And it finally worked!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

General Info: ASP.NET MVC app using ADO.NET Entity Framework SQL Server 2005 I have
I have a asp.net application in that I am using ado.net entity framework in
I have Entity Data Model using ADO.NET Entity Data Model (using auto generate from
I'm using ado.net entity data model. I have 2 object User Organization My problem
I'm using ADO.Net Entity Framework and C# to retreive the languages of a destination
in our current project we are using ADO.NET Entity Framework as data layer for
Using Ado.Net Entity framework, I am trying to get the 'top 3' items in
I'm using ADO.NET entity framework, and am using an AdventureWorks database attached to my
We are using ado.net entity framework 4.0 for our database layer and I am
I write this piece of code with C# using ADO.NET Entity Framework. I found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.