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

  • Home
  • SEARCH
  • 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 6786379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:14:17+00:00 2026-05-26T17:14:17+00:00

I have the following (greatly simplified) classes: public class Customer { [Required(ErrorMessageResourceName=Required, ErrorMessageResourceType=typeof(ResourcesCommon.ValidationStrings))] public

  • 0

I have the following (greatly simplified) classes:

public class Customer {
    [Required(ErrorMessageResourceName="Required", ErrorMessageResourceType=typeof(ResourcesCommon.ValidationStrings))]
    public string LastName { get; set; }
}

public class SalesCustomer : Customer {
    ...
}

I have some validation code that loops through SalesCustomer properties. Each property is evaluated with this:

 var validators = property.GetCustomAttributes(typeof(ValidationAttribute), true);

The problem is that the Required attribute is not getting returned when I look at the LastName property on the SalesCustomer type but it does work fine when I look at the Customer type. This is confusing since the GetCustomerAttribute() method explicitly wants a boolean indicating that the inherited attributes will be returned.

  • 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-26T17:14:18+00:00Added an answer on May 26, 2026 at 5:14 pm

    I believe that it will only return attributes from overridden parent members, not shadowed parent members.

    Make the base property virtual and the child property overrrides.

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

Sidebar

Related Questions

I have the following model (greatly simplified for the purposes of this question): class
I have a problem in a VB.Net class library which I have simplified greatly
I have a package with the following structure (okay, this is greatly simplified, but...)
I am new to XStream I have following DTO @XStreamAlias(outline) public class OutlineItem implements
I have following DTO @XStreamAlias(outline) public class OutlineItem implements java.io.Serializable { private static final
I have following plist: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
A have the following input string: string input = Ta005000000000000000000Tb001700000000000000000Sa005000000000000000000 + Sb002500000000000000000F 00000000000000000I 00000000000000000N
I have a Hibernate class called Expression (simplified here for your viewing pleasure): @Entity
I have the following string: (1, 2, 3, 4) I want to convert it
I have the following string. Andrew - BOB - Jay vs John Now all

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.