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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:33:29+00:00 2026-06-14T00:33:29+00:00

I have this class that is linked to a View in the SQL Server:

  • 0

I have this class that is linked to a View in the SQL Server:

[Table("V_Clients")]
public class Client
{
    [Key]
    public int ClientId { get; set; }
    public short BranchId { get; set; }
    public string CorporateName { get; set; }
    public string TIN { get; set; }
    public string Address { get; set; }
    public string Phone { get; set; }
    public string Id { get; set; }//NroCi
    public short CityId { get; set; }
    public short ZoneId { get; set; }
    public short SubZoneId { get; set; }
    public short VendorId { get; set; }
    public short PriceListId { get; set; }
    public short CollectorId { get; set; }

    [ForeignKey("BranchId")]
    public virtual Branch Branch { get; set; }

    [ForeignKey("CityId")]
    public virtual City City { get; set; }

    [ForeignKey("ZoneId")]
    public virtual Zone Zone { get; set; }

    [ForeignKey("SubZoneId")]
    public virtual SubZone SubZone { get; set; }

    [ForeignKey("VendorId")]
    public virtual Vendor Vendor { get; set; }

    [ForeignKey("PriceListId")]
    public virtual PriceList PriceLists {get;set;}

    [ForeignKey("CollectorId")]
    public virtual Collector Collector { get; set; }
}

but when I try to make a list of it like this:

public ActionResult Index()
    {
        var clients = db.Clients.Include(c => c.Branch).Include(c => c.City).Include(c => c.Zone).Include(c => c.SubZone).Include(c => c.Vendor).Include(c => c.PriceLists).Include(c => c.Collector);
        return View(clients.ToList());
    }

nothing happens. Could it be because of the relationships?

Note: All classes are linked to views and work fine with the others except my Client class.

  • 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-14T00:33:31+00:00Added an answer on June 14, 2026 at 12:33 am

    Try passing a string to Include(). Ex:

    var clients = db.Clients.Include("Branch").Include("City");

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

Sidebar

Related Questions

I have class that looks like this: class A { public: class variables_map vm
I have a Handler class that looks like this: class Handler{ public $group; public
Assume I have a class that looks like this: class Sample { public string
I have this class that have a function to load other classes and create
I have this class that contains vars for db connection; Imports Microsoft.VisualBasic Imports System.Data.SqlClient
I have this class that has many class members, and a lot of different
I have this c# class that calculates n choose k and then generates all
I have this class called PollFrame that extends JFrame in a file called PollFrame.java
I have a class that contains this class method: def self.get_event_record(row, participant) event =
I have this small class called City that simply holds some information about a

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.