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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:08:38+00:00 2026-06-05T04:08:38+00:00

I have 2 objects with attributes as the following: Object 1: Person Name Location

  • 0

I have 2 objects with attributes as the following:

Object 1:

Person

  • Name
  • Location
  • Age
  • Address

Object 2:

PersonRule

  • PersonName
  • PersonLocation
  • PersonAge

The PersonRule is driven by an UI, which sets a person rule(can set many as well), and the user says what name, location, age should be in a rule. This rule should be matched against a person if the person has the same value for the attributes.

I can do a simple equality check, however it’s also possible that in the future a new attribute is added to person rule, something like a personaddress. Then I need to do a check whether the rule matches person by taking person address also into consideration.

Is there a way I can build something like match all attributes of personrule to person attributes, so that I don’t need to make changes when a new attribute gets added to the rule? Of course this is assuming that the corresponding attribute is available in person object.

Thanks,
-Mike

  • 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-05T04:08:39+00:00Added an answer on June 5, 2026 at 4:08 am

    You can use one of the available object-to-object mappers library like AutoMapper or EmitMapper. They will take care of copying data from Person instance to PersonRule instance that can be compared against another PersonRule instance. For example with EmitMapper your code might look like this:

    var config = new DefaultMapConfig().MatchMembers((m1, m2) => "Person" + m1 == m2);
    ObjectMapperManager.DefaultInstance
                       .GetMapper<Person, PersonRule>(config)
                       .Map(person, personRule);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of objects in the following form Person object with attributes
I have an Object called Person which has the following attributes; id , name
I have an NSArray which contains Person objects. This person object contains the following;
I have an object with following attributes Books ---------- ID , Name Now, I
I have the following XML array: [link]=> array(2) { [0]=> object(SimpleXMLElement)#311 (1) { [@attributes]=>
I have a list of objects (Foo). A Foo object has several attributes. An
I have the following simple xml object file: [AuthorList] => SimpleXMLElement Object ( [@attributes]
I have an array of Race objects with the following attributes: way race_period_id track_id
ActiveRecord objects of the class 'Location' (representing the db-table Locations) have the attributes 'url',
I have an array of objects that have QTTime structs as attributes. The objects

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.