Compile error with Nested Classes

Posted by ProfK on Stack Overflow See other posts from Stack Overflow or by ProfK
Published on 2010-04-15T06:19:12Z Indexed on 2010/04/15 6:23 UTC
Read the original article Hit count: 683

Filed under:
|

I have metadata classes nested within entity classes, as I have always done, but suddenly, when I deploy to my target web site, and try and view a page, I get e.g. the following compile error:

CS0102: The type 'PvmmsModel.ActivationResource' already contains a definition for 'ActivationResourceMetadata'

My code for this type looks like below. There is only one definition of ActivationResourceMetadata:

namespace PvmmsModel
{
    [DisplayName("Activation Resources")]
    [DisplayColumn("Name")]
    [MetadataType(typeof(ActivationResourceMetadata))]
    public partial class ActivationResource
    {
        public class ActivationResourceMetadata
        {
            [ScaffoldColumn(false)]
            public object ResourceId { get; set; }

            [DisplayName("Cell Phone")]
            public object CellPhone { get; set; }

            [DisplayName("Shifts Worked or Planned")]
            public object ActivationShifts { get; set; }
        }
    }
}

This is on an ASP.NET WebSite project.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about entity-framework