コード例 #1
0
        /// <summary>
        /// Save List
        /// </summary>
        /// <param name="helper">Sql Helper</param>
        virtual public void Save(SqlHelper helper)
        {
            try
            {
                bool isDeletedItem = false;

                foreach (T entity in Items)
                {
                    if (entity.IsDeleted)
                    {
                        isDeletedItem = true;
                    }

                    EntityBaseReadOnly currentEntity = entity as EntityBaseReadOnly;
                    currentEntity.Save(helper);
                }

                if (isDeletedItem)
                {
                    for (int i = Items.Count - 1; i >= 0; i--)
                    {
                        if (Items[i].IsDeleted)
                        {
                            Items.RemoveAt(i);
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }
コード例 #2
0
 /// <summary>
 /// Hydration method
 /// </summary>
 /// <param name="view">View</param>
 internal virtual void Initialize(System.Data.DataView view)
 {
     foreach (DataRowView rowView in view)
     {
         T entity = EntityBaseReadOnly.GetEntityInstance <T>();
         entity.Initialize(rowView);
         base.Add(entity);
     }
 }
コード例 #3
0
 /// <summary>
 /// Hydration method
 /// </summary>
 /// <param name="reader">Reader</param>
 internal virtual void Initialize(System.Data.IDataReader reader)
 {
     while (reader.Read())
     {
         T entity = EntityBaseReadOnly.GetEntityInstance <T>();
         entity.Initialize(reader);
         base.Add(entity);
     }
 }
コード例 #4
0
 /// <summary>
 /// Hydration method
 /// </summary>
 /// <param name="parent">Parent Entity</param>
 /// <param name="reader">Reader</param>
 internal virtual void Initialize(System.Collections.IList parent, System.Data.IDataReader reader)
 {
     while (reader.Read())
     {
         T entity = EntityBaseReadOnly.GetEntityInstance <T>();
         entity.Initialize(reader);
         entity.Parent = parent;
         base.Add(entity);
     }
 }
コード例 #5
0
 /// <summary>
 /// Hydration method
 /// </summary>
 /// <param name="parent">Parent Entity</param>
 /// <param name="view">View</param>
 internal virtual void Initialize(System.Collections.IList parent, System.Data.DataView view)
 {
     foreach (DataRowView rowView in view)
     {
         T entity = EntityBaseReadOnly.GetEntityInstance <T>();
         entity.Initialize(rowView);
         entity.Parent = parent;
         base.Add(entity);
     }
 }
コード例 #6
0
        /// <summary>
        /// Get Entity by Id
        /// </summary>
        /// <param name="id">Id</param>
        /// <returns>Entity</returns>
        public EntityBaseReadOnly GetEntityById(string uniqueIdentifer)
        {
            EntityBaseReadOnly returnValue = null;

            foreach (T tEntity in this)
            {
                if (tEntity is EntityBaseReadOnly)
                {
                    EntityBaseReadOnly entity = tEntity as EntityBaseReadOnly;

                    if (entity.UniqueIdentifier == uniqueIdentifer)
                    {
                        returnValue = entity;
                        break;
                    }
                }
            }

            return(returnValue);
        }
コード例 #7
0
        /// <summary>
        /// Initialize New
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        internal static T InitializeNew <T>() where T : EntityBase
        {
            T entity = EntityBaseReadOnly.GetEntityInstance <T>();

            System.Type entityType = entity.GetType();

            List <ColumnInfo> defaultValues = ColumnInfo.GetColumnInfoDefaultValues(entityType);

            foreach (ColumnInfo column in defaultValues)
            {
                PropertyInfo propertyInfo = GetDatabaseColumnPropertyInfo(entityType, column.ColumnName);

                if (propertyInfo != null)
                {
                    SetPropertyValueIfNotNull(entity, propertyInfo, column.Value);
                }
            }

            entity.IsNew   = true;
            entity.IsDirty = true;

            return(entity);
        }
コード例 #8
0
 /// <summary>
 /// Public constructor taking the entity and a helper
 /// </summary>
 public EntityCancelEventArgs(EntityBaseReadOnly entity, SqlHelper helper)
 {
     this._entity = entity;
     this._helper = helper;
 }
コード例 #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="parent">Parent Entity</param>
 /// <param name="reader">Reader</param>
 internal EntityList(EntityBaseReadOnly parent, System.Data.IDataReader reader) : base(parent, reader)
 {
 }
コード例 #10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="parent">Parent Entity</param>
 internal EntityList(EntityBaseReadOnly parent) : base(parent)
 {
 }
コード例 #11
0
 /// <summary>
 /// Public constructor taking the entity and a helper
 /// </summary>
 public EntityException(string message, Exception innerException, EntityBaseReadOnly entity, SqlHelper helper)
     : this(message, innerException)
 {
     this._entity = entity;
     this._helper = helper;
 }
コード例 #12
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="parent">Parent Entity</param>
 /// <param name="table">Data Table</param>
 internal EntityList(EntityBaseReadOnly parent, System.Data.DataTable table) : base(parent, table)
 {
 }
コード例 #13
0
 /// <summary>
 /// Public constructor taking the entity and a helper
 /// </summary>
 public EntityException(string message, Exception innerException, EntityBaseReadOnly entity, SqlHelper helper) : this(message, innerException)
 {
     this._entity = entity;
     this._helper = helper;
 }
コード例 #14
0
 /// <summary>
 /// Public constructor taking the entity
 /// </summary>
 public EntityCancelEventArgs(EntityBaseReadOnly entity)
 {
     this._entity = entity;
 }
コード例 #15
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="parent">Parent Entity</param>
 /// <param name="reader">Reader</param>
 internal EntityListReadOnly(EntityBaseReadOnly parent, System.Data.IDataReader reader) : this(reader)
 {
     this.parent = parent;
 }
コード例 #16
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="parent">Parent Entity</param>
 internal EntityListReadOnly(EntityBaseReadOnly parent)
 {
     this.parent = parent;
 }
コード例 #17
0
 /// <summary>
 /// Public constructor taking the entity and a helper
 /// </summary>
 public EntityException(EntityBaseReadOnly entity, SqlHelper helper)
     : this()
 {
     this._entity = entity;
     this._helper = helper;
 }
コード例 #18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="parent">Parent Entity</param>
 /// <param name="table">Data Table</param>
 internal EntityListReadOnly(EntityBaseReadOnly parent, System.Data.DataTable table) : this(table)
 {
     this.parent = parent;
 }
コード例 #19
0
 /// <summary>
 /// Public constructor taking the entity 
 /// </summary>
 public EntityException(EntityBaseReadOnly entity)
     : this()
 {
     this._entity = entity;
 }
コード例 #20
0
 /// <summary>
 /// Public constructor taking the entity
 /// </summary>
 public EntityException(string message, Exception innerException, EntityBaseReadOnly entity) : this(message, innerException)
 {
     this._entity = entity;
 }
コード例 #21
0
 /// <summary>
 /// Public constructor taking the entity and a helper
 /// </summary>
 public EntityException(EntityBaseReadOnly entity, SqlHelper helper) : this()
 {
     this._entity = entity;
     this._helper = helper;
 }
コード例 #22
0
 /// <summary>
 /// Public constructor taking the entity
 /// </summary>
 public EntityCancelEventArgs(EntityBaseReadOnly entity)
 {
     this._entity = entity;
 }
コード例 #23
0
 /// <summary>
 /// Public constructor taking the entity and a helper
 /// </summary>
 public EntityCancelEventArgs(EntityBaseReadOnly entity, SqlHelper helper)
 {
     this._entity = entity;
     this._helper = helper;
 }
コード例 #24
0
 /// <summary>
 /// Public constructor taking the entity 
 /// </summary>
 public EntityException(string message, Exception innerException, EntityBaseReadOnly entity)
     : this(message, innerException)
 {
     this._entity = entity;
 }
コード例 #25
0
 /// <summary>
 /// Public constructor taking the entity
 /// </summary>
 public EntityException(EntityBaseReadOnly entity) : this()
 {
     this._entity = entity;
 }