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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:14:38+00:00 2026-05-20T00:14:38+00:00

Even many Q/A on the subject, I didn’t find a clear answer for this

  • 0

Even many Q/A on the subject, I didn’t find a clear answer for this question:

What’s the best design practice for adding business rules (i.e, validations) to entity classes.

I simply want to check some validations before setting the underlying entity value:

public Property
{
    get { return base.Property; }
    set
    {
       // Do some validations or other business logic
       base.Property = value;
    }
}

It doesn’t make sense to create a new class from scratch in BLL when all properties are already there in entity class. On the other hand, entity classes need to be extended with business logic rules.

Using interface need extra work, because a change in DAL (entity) would be reflected in both interface and BLL class.

I’m not sure if inheriting from entity class and overriding it’s properties and adding extra properties and methods is a good idea or not.

A sample pseudo code in more helpful to me.

Thanks

  • 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-20T00:14:38+00:00Added an answer on May 20, 2026 at 12:14 am

    Check out your EF designer-generated code.

    Each property Property is actually implemented like this:

        public global::System.String Property
        {
            get
            {
                return _Property;
            }
            set
            {
                OnPropertyChanging(value);
                ReportPropertyChanging("Property");
                _Property = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Property");
                OnPropertyChanged();
            }
        }
        private global::System.String _Property;
        partial void OnPropertyChanging(global::System.String value);
        partial void OnPropertyChanged();
    

    The partial method On-Property-Changing is where you can do single-property validation or business logic.

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

Sidebar

Related Questions

I need to find out how many even values are contained in a binary
I have found many similar posts and even tried to find out how to
I am a Java programmer. I find that many times even if my algorithm
Many even simple editors (e.g. Notepad++ or RubyMine) have this: pressing Ctrl+D duplicates the
Even I used break() and exit() statements many times, I am bit confused between
Many programming languages share generic and even fairly universal features. For example, if you
In how many languages is Null not equal to anything not even Null?
Many times I work with optimized code (sometimes even involving vectorized loops), which contain
There's many examples of testing RoR model validations. Even keeping the test being DRY
There are so many template engines for node.js and express and there is even

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.