<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Csla.Properties;

namespace Csla.Rules
{
  /// <summary>
  /// Base class used to create business and validation
  /// rules.
  /// </summary>
  public abstract class BusinessRule : IBusinessRule
  {
    /// <summary>
    /// Gets the default description used by this rule.
    /// </summary>
    public string DefaultDescription { get; protected set; }
    /// <summary>
    /// Gets the default severity for this rule.
    /// </summary>
    public RuleSeverity DefaultSeverity { get; protected set; }
    /// <summary>
    /// Gets the default StopProcessing value for this rule.
    /// </summary>
    public bool DefaultStopProcessing { get; protected set; }
    /// <summary>
    /// Gets the userstate object provided when this rule was
    /// associated with the business object property.
    /// </summary>
    public object UserState { get; protected set; }
    private Csla.Core.IPropertyInfo _primaryProperty;
    /// <summary>
    /// Gets or sets the primary property affected by this rule.
    /// </summary>
    public Csla.Core.IPropertyInfo PrimaryProperty 
    {
      get { return _primaryProperty; }
      set
      {
        _primaryProperty = value;
        this.RuleUri = new RuleUri(this, value);
        if (_primaryProperty != null)
          AffectedProperties.Add(_primaryProperty);
      }
    }
    /// <summary>
    /// Gets a list of secondary property values to be supplied to the
    /// rule when it is executed.
    /// </summary>
    public List<Csla.Core.IPropertyInfo> AffectedProperties { get; private set; }
    /// <summary>
    /// Gets a list of secondary property values to be supplied to the
    /// rule when it is executed.
    /// </summary>
    public List<Csla.Core.IPropertyInfo> InputProperties { get; protected set; }
    /// <summary>
    /// Gets a value indicating whether the rule will run
    /// on a background thread.
    /// </summary>
    public bool IsAsync { get; protected set; }
    /// <summary>
    /// Gets a unique rule:// URI for the specific instance
    /// of the rule within the context of the business object
    /// where the rule is used.
    /// </summary>
    public string RuleName { get { return this.RuleUri.ToString(); } }
    /// <summary>
    /// Sets or gets the rule:// URI object for this rule.
    /// </summary>
    protected RuleUri RuleUri { get; set; }
    /// <summary>
    /// Gets the rule priority.
    /// </summary>
    public int Priority { get; set; }

    /// <summary>
    /// Creates an instance of the rule that applies
    /// to a business object as a whole.
    /// </summary>
    protected BusinessRule()<commit_msg>Make IsAsync virtual. bugid: 759<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Csla.Properties;

namespace Csla.Rules
{
  /// <summary>
  /// Base class used to create business and validation
  /// rules.
  /// </summary>
  public abstract class BusinessRule : IBusinessRule
  {
    /// <summary>
    /// Gets the default description used by this rule.
    /// </summary>
    public string DefaultDescription { get; protected set; }
    /// <summary>
    /// Gets the default severity for this rule.
    /// </summary>
    public RuleSeverity DefaultSeverity { get; protected set; }
    /// <summary>
    /// Gets the default StopProcessing value for this rule.
    /// </summary>
    public bool DefaultStopProcessing { get; protected set; }
    /// <summary>
    /// Gets the userstate object provided when this rule was
    /// associated with the business object property.
    /// </summary>
    public object UserState { get; protected set; }
    private Csla.Core.IPropertyInfo _primaryProperty;
    /// <summary>
    /// Gets or sets the primary property affected by this rule.
    /// </summary>
    public Csla.Core.IPropertyInfo PrimaryProperty 
    {
      get { return _primaryProperty; }
      set
      {
        _primaryProperty = value;
        this.RuleUri = new RuleUri(this, value);
        if (_primaryProperty != null)
          AffectedProperties.Add(_primaryProperty);
      }
    }
    /// <summary>
    /// Gets a list of secondary property values to be supplied to the
    /// rule when it is executed.
    /// </summary>
    public List<Csla.Core.IPropertyInfo> AffectedProperties { get; private set; }
    /// <summary>
    /// Gets a list of secondary property values to be supplied to the
    /// rule when it is executed.
    /// </summary>
    public List<Csla.Core.IPropertyInfo> InputProperties { get; protected set; }
    /// <summary>
    /// Gets a value indicating whether the rule will run
    /// on a background thread.
    /// </summary>
    public virtual bool IsAsync { get; protected set; }
    /// <summary>
    /// Gets a unique rule:// URI for the specific instance
    /// of the rule within the context of the business object
    /// where the rule is used.
    /// </summary>
    public string RuleName { get { return this.RuleUri.ToString(); } }
    /// <summary>
    /// Sets or gets the rule:// URI object for this rule.
    /// </summary>
    protected RuleUri RuleUri { get; set; }
    /// <summary>
    /// Gets the rule priority.
    /// </summary>
    public int Priority { get; set; }

    /// <summary>
    /// Creates an instance of the rule that applies
    /// to a business object as a whole.
    /// </summary>
    protected BusinessRule()
{'fraction_non_alphanumeric': 0.1188442667635835, 'fraction_numerical': 0.0005451571869889151, 'mean_word_length': 2.2093294460641397, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1535535', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1460, 'n_words': 564}