IEntity.cs :  » Template-Engines » netTiers » PetShop » Business » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Template Engines » netTiers 
netTiers » PetShop » Business » IEntity.cs
using System;
using System.ComponentModel;
using System.Collections;

namespace PetShop.Business{
  /// <summary>
    /// List of possible state for an entity.
    /// </summary>
  public enum EntityState
    {
        /// <summary>
        /// Entity is unchanged
        /// </summary>
        Unchanged=0, 

        /// <summary>
        /// Entity is new
        /// </summary>
        Added=1, 

        /// <summary>
        /// Entity has been modified
        /// </summary>
        Changed=2, 

        /// <summary>
        /// Entity has been deleted
        /// </summary>
        Deleted=3
    }
  
  /// <summary>
  /// The interface that each business object of the model implements.
  /// </summary>
  public interface IEntity
  {
    /// <summary>
    ///  The name of the underlying database table.
    /// </summary>
    string TableName { get;}

    /// <summary>
    ///  Indicates if the object has been modified from its original state.
    /// </summary>
    ///<value>True if object has been modified from its original state; otherwise False;</value>
    bool IsDirty {get;}
    
    /// <summary>
    ///  Indicates if the object is new.
    /// </summary>
    ///<value>True if objectis new; otherwise False;</value>
    bool IsNew {get;}

    /// <summary>
    /// True if object has been marked as deleted. ReadOnly.
    /// </summary>
    bool IsDeleted {get;}

    /// <summary>
    /// Indicates if the object is in a valid state
    /// </summary>
    /// <value>True if object is valid; otherwise False.</value>
    bool IsValid { get;}
        
    /// <summary>
    /// Returns one of EntityState enum values - intended to replace IsNew, IsDirty, IsDeleted.
    /// </summary>
    EntityState EntityState {get;}
    
    /// <summary>
    /// Accepts the changes made to this object by setting each flags to false.
    /// </summary>
    void AcceptChanges();
    
    /// <summary>
    /// Marks entity to be deleted.
    /// </summary>
    void MarkToDelete();
         
    /// <summary>
        /// Gets or sets the parent collection.
        /// </summary>
        /// <value>The parent collection.</value>
    object ParentCollection{get;set;}
    
    /// <summary>
    ///    The name of the underlying database table's columns.
    /// </summary>
    /// <value>A string array that holds the columns names.</value>
    string[] TableColumns {get;}
    
    
    /// <summary>
    ///     Gets or sets the object that contains supplemental data about this object.
    /// </summary>
    /// <value>Object</value>
    object Tag { get;set;}
    
    /// <summary>
    /// Determines whether the property value has changed from the original data.
    /// </summary>
    /// <param name="columnName">The column name.</param>
    /// <returns>
    ///   <c>true</c> if the property value has changed; otherwise, <c>false</c>.
    /// </returns>
    bool IsPropertyChanged(string columnName);
    
    /// <summary>
        /// Event to indicate that a property has changed.
        /// </summary>
    event PropertyChangedEventHandler PropertyChanged;
    
    /// <summary>
    /// Determines whether this entity is being tracked.
    /// </summary>
    bool IsEntityTracked {  get;  set;  }
    
    ///<summary>
    /// The tracking key used to with the <see cref="EntityLocator" />
    ///</summary>
    string EntityTrackingKey {  get;  set;  }
  }
  
  /// <summary>
  ///     Interface that TList and every entity implements to support
  ///    cloning of an object tree.
  /// </summary>
  public interface ICloneableEx
  {
    ///<summary>
    /// The tracking key used to with the <see cref="EntityLocator" />
    ///</summary>
    ///<param name="existingCopies">A list containing references to all objects already copied.</param>
    object Clone(IDictionary existingCopies);
  }
}
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.