/// <summary>
        /// single item insert with entity input
        /// </summary>
        /// <param name="input">to-be-inserted instance of entity class</param>
        public Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog Insert(Log4Net.DataSourceEntities.Log input)
        {
            log.Info(string.Format("{0}: Insert", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));
            Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog  _retval = new Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog();
            _retval.OriginalValue = new Log4Net.DataSourceEntities.LogCollection();
            _retval.OriginalValue.Add(input);

            if (input != null)
            {
                Log4Net.EntityFrameworkContext.Log _LinqItem = Log4Net.EntityContracts.ILogHelper.Clone<Log4Net.DataSourceEntities.Log, Log4Net.EntityFrameworkContext.Log>(input);
                this.LinqContext.Log.Add(_LinqItem);
                this.LinqContext.SaveChanges();
                Log4Net.DataSourceEntities.Log _Result = new Log4Net.DataSourceEntities.Log();
                Log4Net.EntityContracts.ILogHelper.Copy<Log4Net.EntityFrameworkContext.Log, Log4Net.DataSourceEntities.Log>(_LinqItem, _Result);
                _retval.Result = new Log4Net.DataSourceEntities.LogCollection();
                _retval.Result.Add(_Result);
            }

            log.Info(string.Format("{0}: Insert", Framework.LoggingOptions.Data_Access_Layer_Process_Ended.ToString()));
            return _retval;
        }
        /// <summary>
        /// The return value of this set of query is: <see cref="ASPNETDB_CACHE.DataSourceEntities.AspNet_SqlCacheTablesForChangeNotification"/>
        /// The key query criteria of this set of query is: Common. 
        /// Common query set is a built-in set of query criteria, which will query all foreign keys, string/text value, and range of datatime
        /// There are 7 methods, 1 internal, 2 private and 4 public, for one set of return value and query criteria:
        /// internal _GetQueryOfEntityOf...(...) gives the Linq Query 
        /// private _ExistsOfEntityOf...(...) returns true if there is any records meets Query Criteria, otherwise false
        /// private _GetCountOfEntityOf...(...) returns count if there is any records meets Query Criteria, otherwise 0
        /// public GetCountOfEntityOf...(...) returns count if there is any records meets Query Criteria, otherwise 0
        /// public ExistsOfEntityOf...(...) returns true if there is any records meets Query Criteria, otherwise false
        /// public GetSingleOfEntityOf...(...) returns the first record if there is any records meets Query Criteria, otherwise null
        /// *public GetCollectionOfEntityOf...(...) returns all records if there is any records meets Query Criteria, otherwise null
        /// </summary>
        /// <param name="currentIndex">current page index</param>
        /// <param name="pageSize">page size</param>
        /// <param name="queryOrderBySettingCollection">query OrderBy setting</param>
        /// <returns>result message with entity collection</returns>
        public Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog GetCollectionOfEntityOfCommon(
			Framework.EntityContracts.QuerySystemDateTimeRangeCriteria criteriaOfDateOftOfCommonOfCommonOfCommon
			,Framework.EntityContracts.QuerySystemStringContainsCriteria criteriaOfThreadOftOfCommonOfCommonOfCommon
			,Framework.EntityContracts.QuerySystemStringContainsCriteria criteriaOfLevelOftOfCommonOfCommonOfCommon
			,Framework.EntityContracts.QuerySystemStringContainsCriteria criteriaOfLoggerOftOfCommonOfCommonOfCommon
			,Framework.EntityContracts.QuerySystemStringContainsCriteria criteriaOfMessageOftOfCommonOfCommonOfCommon
			,Framework.EntityContracts.QuerySystemStringContainsCriteria criteriaOfExceptionOftOfCommonOfCommonOfCommon
			,int currentIndex
			,int pageSize
			,Framework.EntityContracts.QueryOrderBySettingCollection queryOrderBySettingCollection
			)
        {
            log.Info(string.Format("{0}: GetCollectionOfEntityOfCommon", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));

            Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog _retMessage = new Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog();
            try
            {
                bool _Exists = _ExistsOfEntityOfCommon(
				criteriaOfDateOftOfCommonOfCommonOfCommon
				,criteriaOfThreadOftOfCommonOfCommonOfCommon
				,criteriaOfLevelOftOfCommonOfCommonOfCommon
				,criteriaOfLoggerOftOfCommonOfCommonOfCommon
				,criteriaOfMessageOftOfCommonOfCommonOfCommon
				,criteriaOfExceptionOftOfCommonOfCommonOfCommon
				,currentIndex
				,pageSize
				,queryOrderBySettingCollection
			);

                if (_Exists)
                {
                    IQueryable<Log4Net.DataSourceEntities.Log> _Query = _GetQueryOfEntityOfCommon(
				criteriaOfDateOftOfCommonOfCommonOfCommon
				,criteriaOfThreadOftOfCommonOfCommonOfCommon
				,criteriaOfLevelOftOfCommonOfCommonOfCommon
				,criteriaOfLoggerOftOfCommonOfCommonOfCommon
				,criteriaOfMessageOftOfCommonOfCommonOfCommon
				,criteriaOfExceptionOftOfCommonOfCommonOfCommon
				,queryOrderBySettingCollection
			);

                    IEnumerable<Log4Net.DataSourceEntities.Log> _retval;
					
					if (currentIndex == -1 || pageSize == -1)
					{
						_retval = _Query;
					}
					else
					{
						_retval = _Query.Skip(currentIndex).Take(pageSize);
					}
                    _retMessage.DataAccessLayerMessageStatus = Framework.DataSourceEntities.DataAccessLayerMessageStatus.Success;
                    _retMessage.Result = new Log4Net.DataSourceEntities.LogCollection();
					_retMessage.Result.AddRange(_retval);
                }
                else
                {
                    _retMessage.DataAccessLayerMessageStatus = Framework.DataSourceEntities.DataAccessLayerMessageStatus.SuccessButNoResult;
                    _retMessage.Result = null;
                }
            }
            catch (Exception ex)
            {
                _retMessage.DataAccessLayerMessageStatus = Framework.DataSourceEntities.DataAccessLayerMessageStatus.Fail;
                _retMessage.Result = null;
                _retMessage.Message = ex.Message;
                log.Error(string.Format("{0}: GetCollectionOfEntityOfCommon", Framework.LoggingOptions.Data_Access_Layer_Process_Failed.ToString()), ex);
            }
            log.Info(string.Format("{0}: GetCollectionOfEntityOfCommon", Framework.LoggingOptions.Data_Access_Layer_Process_Ended.ToString()));
            return _retMessage;
        }
        /// <summary>
        /// Batches the update with entity collection input.
        /// </summary>
        /// <param name="input">The input.</param>
        public Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog BatchUpdate(Log4Net.DataSourceEntities.LogCollection input)
        {
            log.Info(string.Format("{0}: BatchUpdate", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));

			Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog  _retval = new Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog();
            _retval.OriginalValue = input;

            if (input != null)
            {
                List<Log4Net.EntityFrameworkContext.Log> _ListOfLinq = new List<Log4Net.EntityFrameworkContext.Log>();
                foreach (Log4Net.DataSourceEntities.Log _ItemOfInput in input)
                {
                    Log4Net.EntityFrameworkContext.Log _LinqItem = GetLinqObjectByIdentifier(_ItemOfInput);
                    Log4Net.EntityContracts.ILogHelper.Copy<Log4Net.DataSourceEntities.Log, Log4Net.EntityFrameworkContext.Log>(_ItemOfInput, _LinqItem);
                    _ListOfLinq.Add(_LinqItem);
                }
                this.LinqContext.SaveChanges();

                for (int i = 0; i < input.Count; i++)
                {
                    Log4Net.EntityContracts.ILogHelper.Copy
                        <
                            Log4Net.EntityFrameworkContext.Log, Log4Net.DataSourceEntities.Log
                        >(_ListOfLinq[i], input[i]);
                }
            }
            log.Info(string.Format("{0}: BatchUpdate", Framework.LoggingOptions.Data_Access_Layer_Process_Ended.ToString()));
			return _retval;
        }
        /// <summary>
        /// Batches the delete with entity collection input.
        /// </summary>
        /// <param name="input">The input.</param>
        public Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog BatchDelete(Log4Net.DataSourceEntities.LogCollection input)
        {
            log.Info(string.Format("{0}: BatchDelete", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));

			Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog  _retval = new Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog();
            _retval.OriginalValue = input;

            if (input != null)
            {
                List<Log4Net.EntityFrameworkContext.Log> _ListOfLinq = new List<Log4Net.EntityFrameworkContext.Log>();
                foreach (Log4Net.DataSourceEntities.Log _ItemOfInput in input)
                {
                    Log4Net.EntityFrameworkContext.Log _LinqItem = GetLinqObjectByIdentifier(_ItemOfInput);	
					this.LinqContext.Log.Remove(_LinqItem);
                }
                this.LinqContext.SaveChanges();
            }
            log.Info(string.Format("{0}: BatchDelete", Framework.LoggingOptions.Data_Access_Layer_Process_Ended.ToString()));
			return _retval;
        }
        /// <summary>
        /// Batches insert with entity collection input.
        /// </summary>
        /// <param name="input">The input.</param>
        public Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog BatchInsert(Log4Net.DataSourceEntities.LogCollection input)
        {
            log.Info(string.Format("{0}: BatchInsert", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));

			Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog  _retval = new Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog();
            _retval.OriginalValue = input;

            if (input != null && input.Count > 0)
            {
                try
                {
                    DataTable _DataTable = new DataTable();
				_DataTable.Columns.Add("Id", typeof(System.Int64));
				_DataTable.Columns.Add("Date", typeof(System.DateTime));
				_DataTable.Columns.Add("Thread", typeof(System.String));
				_DataTable.Columns.Add("Level", typeof(System.String));
				_DataTable.Columns.Add("Logger", typeof(System.String));
				_DataTable.Columns.Add("Message", typeof(System.String));
				_DataTable.Columns.Add("Exception", typeof(System.String));

                    foreach (Log4Net.DataSourceEntities.Log _Item in input)
                    {
                        _DataTable.Rows.Add(new object[] { _Item.Id, _Item.Date, _Item.Thread, _Item.Level, _Item.Logger, _Item.Message, _Item.Exception });
                    }

                    using (SqlBulkCopy s = new SqlBulkCopy(this.LinqContext.Database.Connection.ConnectionString))
                    {
                        s.DestinationTableName = "dbo.Log";

					s.ColumnMappings.Add("Id", "Id");
					s.ColumnMappings.Add("Date", "Date");
					s.ColumnMappings.Add("Thread", "Thread");
					s.ColumnMappings.Add("Level", "Level");
					s.ColumnMappings.Add("Logger", "Logger");
					s.ColumnMappings.Add("Message", "Message");
					s.ColumnMappings.Add("Exception", "Exception");

                        s.NotifyAfter = 10000;
                        s.WriteToServer(_DataTable);
                        s.Close();
                    }
                }
                catch (Exception ex)
                {
                    log.Error(string.Format("{0}: Insert", Framework.LoggingOptions.Data_Access_Layer_Process_Ended.ToString()), ex);
                }
            }
            log.Info(string.Format("{0}: BatchInsert", Framework.LoggingOptions.Data_Access_Layer_Process_Ended.ToString()));
			return _retval;
        }
        /// <summary>
        /// single item delete by identifier with entity identifier input
        /// </summary>
        /// <param name="id">delete the item if its identifier equals to this parameter</param>
        public Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog DeleteByIdentifier(Log4Net.DataSourceEntities.LogIdentifier id)
        {
            log.Info(string.Format("{0}: DeleteByIdentifier", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));
            
			Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog  _retval = new Log4Net.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionLog();

            if (id != null)
            {
                Log4Net.EntityFrameworkContext.Log _LinqItem = GetLinqObjectByIdentifier(id);
                if (_LinqItem != null)
                {
					Log4Net.DataSourceEntities.Log _Original = new Log4Net.DataSourceEntities.Log();
					Log4Net.EntityContracts.ILogHelper.Copy<Log4Net.EntityFrameworkContext.Log, Log4Net.DataSourceEntities.Log>(_LinqItem, _Original);

					_retval.OriginalValue = new Log4Net.DataSourceEntities.LogCollection();
					_retval.OriginalValue.Add(_Original);

                    this.LinqContext.Log.Remove(_LinqItem);
                    this.LinqContext.SaveChanges();
                }
            }
            log.Info(string.Format("{0}: DeleteByIdentifier", Framework.LoggingOptions.Data_Access_Layer_Process_Ended.ToString()));
			return _retval;
        }