locked
Partial Classes in MVC RRS feed

  • Question

  • User-284642143 posted

    I'm new with MVC but when i use ASP .Net Forms, under my Data Access Layer project i have a folder which contains partial Classes for tables that i need to manipulate i.e.

    Customer table - FirstName LastName

    Public Partial Class Customer
    {
        public string GetName
        {
              return this.FirstName + " " + LastName;
        }
    }

    I added a partial class to my MVC project called Customer and it didnt bring back first and last name fields. Am i doing something wrong or is there another approach?

    Note: I also added Entity Framework 6.2 so not sure if this may have added some complications.

    Monday, April 30, 2018 2:00 PM

Answers

  • User-474980206 posted

    Partial classes are a C# feature, so a MVC project has no effect on them. Most likely, the namespace doesn’t match

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 30, 2018 2:07 PM