aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/Console/IConsoleEngineService.cs
blob: 18edb3629d2971a9e70a45fa30aeb15b336c4e60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.PPC.Common.Console
{
    /// <summary>
    /// Represents a command prompt console service which listens for incoming console requests.
    /// </summary>
    public interface IConsoleEngineService : IPPCService
    {

    }
}
me.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL.Serialization;
using Tango.Core;
using Tango.Core.Json;

namespace Tango.BL
{
    /// <summary>
    /// Represents an observable database entity.
    /// </summary>
    public interface IObservableEntity : INotifyDataErrorInfo, IParameterized , ISerializableEntity
    {
        /// <summary>
        /// Occurs after this observable has been modified and saved by this entity context or another.
        /// </summary>
        event EventHandler<ObservableModifiedEventArgs> Modified;

        /// <summary>
        /// Gets or sets the entity identifier.
        /// </summary>
        [Column("ID")]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        [ParameterIgnore]
        Int32 ID { get; set; }

        /// <summary>
        /// Gets or sets the entity unique identifier.
        /// </summary>
        [Key]
        [Column("GUID")]
        [ParameterIgnore]
        String Guid { get; set; }

        /// <summary>
        /// Gets or sets the entity last updated data and time.
        /// </summary>
        [Column("LAST_UPDATED")]
        [ParameterIgnore]
        DateTime LastUpdated { get; set; }

        /// <summary>
        /// Saves the changes on this entity to database.
        /// </summary>
        void Save(ObservablesContext context);

        /// <summary>
        /// Attaches this observable to the proper DbSet.
        /// </summary>
        void Attach(ObservablesContext context);

        /// <summary>
        /// Detaches this observable from the proper DbSet.
        /// </summary>
        void Detach(ObservablesContext context);

        /// <summary>
        /// Saves the changes on this entity to database asynchronously.
        /// </summary>
        /// <returns></returns>
        Task SaveAsync(ObservablesContext context);

        /// <summary>
        /// Deletes this entity using an SQL statement which will cause the database delete  cascade effect.
        /// </summary>
        Task DeleteCascadeAsync(ObservablesContext context);

        /// <summary>
        /// Gets the database set containing this entity.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        DbSet<T> GetDbSet<T>(ObservablesContext context) where T : class, IObservableEntity;

        /// <summary>
        /// Raises the <see cref="Modified"/> event.
        /// </summary>
        void RaiseModified(ObservablesContext context, IObservableEntity source, IObservableEntity target);

        /// <summary>
        /// Removes this entity and all dependent entities from the specified db context.
        /// </summary>
        /// <param name="context">The context.</param>
        void Delete(ObservablesContext context);
    }
}