title: Is this Domain-Driven Design?
body: <p>To Domain-Driven development experts out there...</p>
  
  <p>I am trying to really grasp the concept of DDD. So far I have been designing my models to be data driven rather than domain driven. I have read a couple of articles about DDD and seemed really interesting, especially for large-scale applications. So I am trying to tailor my models to do exactly that.</p>
  
  <p>I have say a customer entity that exposes a method FreezeAccounts which would disable all customer accounts. This method is not concerned with data access (based on the Persistence Ignorance rule). It updates a flag on each customer account (which is loaded on demand) and saves changes to a database. Is that correct based on this model? I have read that in DDD there is not necessarily just one class per table entity. Should this functionality be in a separate class? Here is some sample code:</p>
  
  <pre><code>public class Customer : ICustomer, ICustomerAction
  {
      #region Initialization
      public Customer()
      {
      }
  
      internal Customer(ICustomer view)
      {
          this.CustomerId = view.CustomerId;
          this.Name = view.Name;
          this.Email = view.Email;
          this.IsActive = view.IsActive;
      }
      #endregion
  
      #region Instances
  
      private AccountCollection _accounts;
  
      #endregion
  
      #region Properties
  
      #region ICustomer
  
      public int CustomerId { get; private set; }
      public string Name { get; set; }
      public string Email { get; set; }
  
      #endregion
  
      #region Derived
  
      public AccountCollection Accounts
      {
          get
          {
              if (_accounts == null)
                  _accounts = Account.GetListByCustomerId(CustomerId);
              return _accounts;
          }
      }
  
      #endregion
  
      #endregion
  
      #region Methods
  
      #region CRUD
  
      // Data Access Object accepts interface ICustomer
      internal void Update()
      {
          CustomerDb.Update(this); 
      }
  
      #endregion
  
      #region ICustomerAction
  
      // Exposed business Persistence Ignorance action
      internal void FreezeAccounts()
      {
          foreach (Account account in this.Accounts)
          {
              account.IsEnabled = false;
              account.Update();
          }
      }
  
      #endregion
  
      #endregion
  }
  </code></pre>