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 8352135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:52:51+00:00 2026-06-09T08:52:51+00:00

I using Entity Framework DbContext at the moment I have got exception towars.dbo was

  • 0

I using “Entity Framework DbContext” at the moment I have got exception towars.dbo was not found. This is very strange because in my website I all the time ask about towar.dbo but no towars.dbo Do you know where is a problem?

- InnerException    {"Invalid object name 'dbo.Towars'."}   System.Exception {System.Data.SqlClient.SqlException}

My all things about Towar (of course different place in my program):

public class ProductController : Controller
{
    //
    // GET: /Product/
        public ITowarRepository repository;

        public ProductController(ITowarRepository productRepository) 
        {
        repository = productRepository;
        }

        public ViewResult List()
        {
            return View(repository.Towar);
        }

}


public interface ITowarRepository
    {
        IQueryable<Towar> Towar { get; }
    }

public DbSet<Towar> Towar { get; set; }

public class EFTowarRepository : ITowarRepository
    {
        public EFDbContext context = new EFDbContext();
        public IQueryable<Towar> Towar
        {
            get { return context.Towar; }
        }
    }
public class Towar
    {
        [Key]
        public int Id_tow { get; set; }
        public string Nazwa { get; set; }
        public string Opis { get; set; }
        public decimal Cena { get; set; }
        public int Id_kat { get; set; }
    }
  • 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-06-09T08:52:52+00:00Added an answer on June 9, 2026 at 8:52 am

    You can tell EF to map to the table Towar by overriding the OnModelCreating method in your DBContext class with fluent API like this:

    public class EFDbContext : DbContext
    {
       protected override void OnModelCreating(DbModelBuilder modelBuilder)
       {
          modelBuilder.Entity<Towar>().ToTable("Towar");
       }
    }
    

    Now EF will look for Towar table instead of Towars. If you do not have these tables created, there is some other problem you are having.

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

Sidebar

Related Questions

Using Entity Framework, I suddenly get this strange error after publishing my asp.net mvc
I have a strange problem when using Entity Framework code first. When I return
I have a generic repository that is using Entity Framework 4 with the DbContext
Using Entity Framework 4 CTP5 I have a basic model and a basic DbContext
I am using Entity Framework and I have two tables, a contact relationship table
I am building an ASP.NET MVC web application using entity framework DbContext using the
I am using Entity Framework 4.1 with POCOs and DbContext, no proxies no lazy
I am using Entity Framework and when a DbUpdateException is thrown from dbContext.SaveChanges() how
My scenario I'm using Visual Studio 2010 with Entity Framework 4.1 I have a
I have an application that contains methods that work with data using Entity Framework

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.