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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:52:41+00:00 2026-05-14T16:52:41+00:00

I have a repository class and it has this, using System; using System.Collections.Generic; using

  • 0

I have a repository class and it has this,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CrMVC.BusinessObjects;

namespace CrMVC.Models
{
    public class ConstructionRepository
    {
        private CRDataContext db = new CRDataContext();

        public IQueryable<MaterialsObj> FindAllMaterials()
        {
           var materials =  from m in db.Materials
             join Mt in db.MeasurementTypes on m.MeasurementTypeId equals Mt.Id
                select new MaterialsObj()
                   {
                       Id = Convert.ToInt64(m.Mat_id),
                       Mat_Name = m.Mat_Name,
                       Mes_Name = Mt.Name,
                   };
            return materials;

        }
    }
 }

And My MaterialsObj class is under CrMVC.BusinessObjects namespace and i using it in my repository class….

namespace CrMVC.BusinessObjects
{
    public class MaterialsObj
    {
         //My logic here
    }
}

But when i compile this i get this error

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\root\19360d4c\3d21e226\App_Web_materials.aspx.7d2669f4.a8f-zsw5.0.cs(148):
error CS0426: The type name 'Materials' does not exist 
 in the type 'CrMVC.Models.ConstructionRepository'

Am i missing something any suggestion….

Edit:

There is no class named Materials in my repository class then why i get this error..

My view page has this,

    <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
 Inherits="System.Web.Mvc.ViewPage<IEnumerable<CrMVC.Models.ConstructionRepository+Materials>>" %>
  • 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-14T16:52:42+00:00Added an answer on May 14, 2026 at 4:52 pm

    You are referencing the type CrMVC.Models.ConstructionRepository.Materials in your ASPX when you probably want to reference CrMVC.BusinessObjects.MaterialsObj instead.

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

Sidebar

Related Questions

I have a repository class that inherits from a generic implementation: public namespace RepositoryImplementation
I have a Linq-To-Sql based repository class which I have been successfully using. I
I am using a repository class with linq-to-sql as the objectdatasource for a (web)
I have implemented a sort of Repository class and it has has GetByID ,
I have the following generic repository: public class GenericRepository<TEntity> where TEntity : class {
I am using spring 3 mvc/security frameworks. I have created a Controller class that
I have a custom IAuthorizationPolicy which has a dependency on a repository internal class
I have a controller in C# using the ASP.Net MVC framework public class HomeController:Controller{
Let's say I have a Generic Repository class along the lines of the following:
I have a MVC app using the UnitOfWork, Service Layer, Repository Pattern and EF4

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.