Linq, mvc and partial class

I have dbml with one table by users

I want to add a partial class for the user and add another property:

    public partial class User
    {
        public string FullName
        {
            get
            {
                return FirstName + " " + LastName;
            }
        }
    }

      

and then use in my view something like:

<%=ViewData.Model.FullName %>

      

this is what i get:

CS1061: 'PR.Web.Models.User' does not contain a definition for 'FullName' and no extension method 'FullName' accepting a first argument of type 'PR.Web.Models.User' could be found (are you missing a using directive or an assembly reference?)

      

what am I doing wrong???

0


source to share


1 answer


Double check the namespace of the generated LINQ to SQL ( User

) class and the partial class.



You can be sure that it is "everything is definitely correct", but the compiler tells you otherwise. Please post the relevant sections of the .designer.cs file attached to your .dbml file if needed, as well as the complete file source that contains the class User

you listed above.

0


source







All Articles