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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:46:27+00:00 2026-06-12T11:46:27+00:00

I’m working in a content development scenario where entities are likely to be created

  • 0

I’m working in a content development scenario where entities are likely to be created in an incomplete state and remain incomplete for some time. The workflow involved is extremely ad-hoc, preventing me from using a more structured DDD approach.

I have a set of validation rules which must be satisfied at all times, and a further set of validation rules which must be satisfied before an entity is “complete”.

I’m already using the built-in ASP.NET MVC validation to validate the former. What approaches could I use to capture the latter?

For example:-

public class Foo
{
  public int Id { get; set; }

  public virtual ICollection<Bar> Bars { get; set; }
}

public class Bar
{
  public int Id { get; set; }

  [Required] // A Bar must be owned by a Foo at all times
  public int FooId { get; set; }
  public virtual Foo Foo { get; set; }

  [Required] // A Bar must have a working title at all times
  public string WorkingTitle { get; set; }

  public bool IsComplete { get; set; }

  // Cannot use RequiredAttribute on Description as the
  // entity is very likely to be created without one,
  // however a Description is required before the entity
  // can be marked as "IsComplete"
  public string Description { get; set; }
}
  • 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-12T11:46:29+00:00Added an answer on June 12, 2026 at 11:46 am

    There are different approaches you could use:

    • Have your model implement the IValidatableObject interface and perform conditional validation without using data annotations.
    • Write a custom validation attribute that will perform the conditional validation logic of the Description property based on the value of the IsComplete property.
    • Use Mvc Foolproof which already has the RequiredIf validation attribute defined for you so that you don’t need to write it yourself.
    • Use FluentValidation.NET which allows you to express your validation rules in a fluent manner. Writing conditional validation rules using this library is not only elegant but very easy. It integrates nicely with ASP.NET MVC and also allows you to easily unit test your validation logic in isolation.

    Personally I would go with the FV.NET but you could use any of the other approaches if it better suits your needs.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.