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

            if (input != null)
            {
                MSBuildLogsExtended.LinqToSqlContexts.Solution _LinqItem = MSBuildLogsExtended.EntityContracts.ISolutionHelper.Clone<MSBuildLogsExtended.DataSourceEntities.Solution, MSBuildLogsExtended.LinqToSqlContexts.Solution>(input);
                this.LinqContext.Solution.InsertOnSubmit(_LinqItem);
                this.LinqContext.SubmitChanges();
                MSBuildLogsExtended.DataSourceEntities.Solution _Result = new MSBuildLogsExtended.DataSourceEntities.Solution();
                MSBuildLogsExtended.EntityContracts.ISolutionHelper.Copy<MSBuildLogsExtended.LinqToSqlContexts.Solution, MSBuildLogsExtended.DataSourceEntities.Solution>(_LinqItem, _Result);
                _retval.Result = new MSBuildLogsExtended.DataSourceEntities.SolutionCollection();
                _retval.Result.Add(_Result);
            }

            log.Info(string.Format("{0}: Insert", Framework.LoggingOptions.Data_Access_Layer_Process_Ended.ToString()));
            return _retval;
        }
        /// <summary>
        /// single item update with entity input
        /// </summary>
        /// <param name="input">to-be-updated instance of entity class</param>
        public MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution Update(MSBuildLogsExtended.DataSourceEntities.Solution input)
        {
            log.Info(string.Format("{0}: Update", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));
            MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution  _retval = new MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution();
            _retval.OriginalValue = new MSBuildLogsExtended.DataSourceEntities.SolutionCollection();
            _retval.OriginalValue.Add(input);

            if (input != null)
            {
                MSBuildLogsExtended.LinqToSqlContexts.Solution _LinqItem = GetLinqObjectByIdentifier(input);
                if (_LinqItem != null)
                {
                    //MSBuildLogsExtended.EntityContracts.ISolutionHelper.Copy<MSBuildLogsExtended.DataSourceEntities.Solution, MSBuildLogsExtended.LinqToSqlContexts.Solution>(input, _LinqItem);
                    _LinqItem.Id = input.Id;
                    _LinqItem.ExternalParentId = input.ExternalParentId;
                    _LinqItem.Name = input.Name;
                    _LinqItem.Description = input.Description;
                    this.LinqContext.SubmitChanges();
					MSBuildLogsExtended.DataSourceEntities.Solution _Result = new MSBuildLogsExtended.DataSourceEntities.Solution();
					MSBuildLogsExtended.EntityContracts.ISolutionHelper.Copy<MSBuildLogsExtended.LinqToSqlContexts.Solution, MSBuildLogsExtended.DataSourceEntities.Solution>(_LinqItem, _Result);
					_retval.Result = new MSBuildLogsExtended.DataSourceEntities.SolutionCollection();
					_retval.Result.Add(_Result);
                }
            }
            log.Info(string.Format("{0}: Update", Framework.LoggingOptions.Data_Access_Layer_Process_Started.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 MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution GetCollectionOfEntityOfCommon(
			Framework.EntityContracts.QuerySystemStringContainsCriteria criteriaOfExternalParentIdOftOfCommonOfCommonOfCommon
			,Framework.EntityContracts.QuerySystemStringContainsCriteria criteriaOfNameOftOfCommonOfCommonOfCommon
			,Framework.EntityContracts.QuerySystemStringContainsCriteria criteriaOfDescriptionOftOfCommonOfCommonOfCommon
			,int currentIndex
			,int pageSize
			,Framework.EntityContracts.QueryOrderBySettingCollection queryOrderBySettingCollection
			)
        {
            log.Info(string.Format("{0}: GetCollectionOfEntityOfCommon", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));

            MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution _retMessage = new MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution();
            try
            {
                bool _Exists = _ExistsOfEntityOfCommon(
				criteriaOfExternalParentIdOftOfCommonOfCommonOfCommon
				,criteriaOfNameOftOfCommonOfCommonOfCommon
				,criteriaOfDescriptionOftOfCommonOfCommonOfCommon
				,currentIndex
				,pageSize
				,queryOrderBySettingCollection
			);

                if (_Exists)
                {
                    IQueryable<MSBuildLogsExtended.DataSourceEntities.Solution> _Query = _GetQueryOfEntityOfCommon(
				criteriaOfExternalParentIdOftOfCommonOfCommonOfCommon
				,criteriaOfNameOftOfCommonOfCommonOfCommon
				,criteriaOfDescriptionOftOfCommonOfCommonOfCommon
				,queryOrderBySettingCollection
			);

                    IEnumerable<MSBuildLogsExtended.DataSourceEntities.Solution> _retval;
					
					if (currentIndex == -1 || pageSize == -1)
					{
						_retval = _Query;
					}
					else
					{
						_retval = _Query.Skip(currentIndex).Take(pageSize);
					}
                    _retMessage.DataAccessLayerMessageStatus = Framework.DataSourceEntities.DataAccessLayerMessageStatus.Success;
                    _retMessage.Result = new MSBuildLogsExtended.DataSourceEntities.SolutionCollection();
					_retMessage.Result.AddRange(_retval);

                    _retMessage.QueryPagingResult = new Framework.EntityContracts.QueryPagingResult
                    {
                        RecordCountOfCurrentPage = _retval.Count(),
                        CountOfRecords = _Query.Count(),
                        CurrentIndexOfStartRecord = currentIndex,
                        PageSize = pageSize,
                    };
                }
                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 MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution BatchUpdate(MSBuildLogsExtended.DataSourceEntities.SolutionCollection input)
        {
            log.Info(string.Format("{0}: BatchUpdate", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));

			MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution  _retval = new MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution();
            _retval.OriginalValue = input;

            if (input != null)
            {
                List<MSBuildLogsExtended.LinqToSqlContexts.Solution> _ListOfLinq = new List<MSBuildLogsExtended.LinqToSqlContexts.Solution>();
                foreach (MSBuildLogsExtended.DataSourceEntities.Solution _ItemOfInput in input)
                {
                    MSBuildLogsExtended.LinqToSqlContexts.Solution _LinqItem = GetLinqObjectByIdentifier(_ItemOfInput);
                    MSBuildLogsExtended.EntityContracts.ISolutionHelper.Copy<MSBuildLogsExtended.DataSourceEntities.Solution, MSBuildLogsExtended.LinqToSqlContexts.Solution>(_ItemOfInput, _LinqItem);
                    _ListOfLinq.Add(_LinqItem);
                }
                this.LinqContext.SubmitChanges();

                for (int i = 0; i < input.Count; i++)
                {
                    MSBuildLogsExtended.EntityContracts.ISolutionHelper.Copy
                        <
                            MSBuildLogsExtended.LinqToSqlContexts.Solution, MSBuildLogsExtended.DataSourceEntities.Solution
                        >(_ListOfLinq[i], input[i]);
                }
            }
            log.Info(string.Format("{0}: BatchUpdate", 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 MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution BatchInsert(MSBuildLogsExtended.DataSourceEntities.SolutionCollection input)
        {
            log.Info(string.Format("{0}: BatchInsert", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));
            #region insert row-by-row to be removed

/*

            if (input != null)
            {
                List<MSBuildLogsExtended.LinqToSqlContexts.Solution> _ListOfLinq = MSBuildLogsExtended.EntityContracts.ISolutionHelper.CloneCollection
                    <
                        MSBuildLogsExtended.DataSourceEntities.SolutionCollection, List<MSBuildLogsExtended.LinqToSqlContexts.Solution>,
                        MSBuildLogsExtended.DataSourceEntities.Solution, MSBuildLogsExtended.LinqToSqlContexts.Solution
                    >(input);
                this.LinqContext.Solution.InsertAllOnSubmit<MSBuildLogsExtended.LinqToSqlContexts.Solution>(_ListOfLinq);
                this.LinqContext.SubmitChanges();
                for (int i = 0; i < input.Count; i++)
                {
                    MSBuildLogsExtended.EntityContracts.ISolutionHelper.Copy
                        <
                            MSBuildLogsExtended.LinqToSqlContexts.Solution, MSBuildLogsExtended.DataSourceEntities.Solution
                        >(_ListOfLinq[i], input[i]);
                }
            }

*/

            #endregion insert row-by-row to be removed

			MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution  _retval = new MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution();
            _retval.OriginalValue = input;

            if (input != null && input.Count > 0)
            {
                try
                {
                    DataTable _DataTable = new DataTable();
				_DataTable.Columns.Add("Id", typeof(System.Int32));
				_DataTable.Columns.Add("ExternalParentId", typeof(System.String));
				_DataTable.Columns.Add("Name", typeof(System.String));
				_DataTable.Columns.Add("Description", typeof(System.String));

                    foreach (MSBuildLogsExtended.DataSourceEntities.Solution _Item in input)
                    {
                        _DataTable.Rows.Add(new object[] { _Item.Id, _Item.ExternalParentId, _Item.Name, _Item.Description });
                    }

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

					s.ColumnMappings.Add("Id", "Id");
					s.ColumnMappings.Add("ExternalParentId", "ExternalParentId");
					s.ColumnMappings.Add("Name", "Name");
					s.ColumnMappings.Add("Description", "Description");

                        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 MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution DeleteByIdentifier(MSBuildLogsExtended.DataSourceEntities.SolutionIdentifier id)
        {
            log.Info(string.Format("{0}: DeleteByIdentifier", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));
            
			MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution  _retval = new MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution();

            if (id != null)
            {
                MSBuildLogsExtended.LinqToSqlContexts.Solution _LinqItem = GetLinqObjectByIdentifier(id);
                if (_LinqItem != null)
                {
					MSBuildLogsExtended.DataSourceEntities.Solution _Original = new MSBuildLogsExtended.DataSourceEntities.Solution();
					MSBuildLogsExtended.EntityContracts.ISolutionHelper.Copy<MSBuildLogsExtended.LinqToSqlContexts.Solution, MSBuildLogsExtended.DataSourceEntities.Solution>(_LinqItem, _Original);

					_retval.OriginalValue = new MSBuildLogsExtended.DataSourceEntities.SolutionCollection();
					_retval.OriginalValue.Add(_Original);

                    this.LinqContext.Solution.DeleteOnSubmit(_LinqItem);
                    this.LinqContext.SubmitChanges();
                }
            }
            log.Info(string.Format("{0}: DeleteByIdentifier", 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 MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution GetCollectionOfEntityOfAll(
			int currentIndex
			,int pageSize
			,Framework.EntityContracts.QueryOrderBySettingCollection queryOrderBySettingCollection
			)
        {
            log.Info(string.Format("{0}: GetCollectionOfEntityOfAll", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));

            MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution _retMessage = new MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution();
            try
            {
                bool _Exists = _ExistsOfEntityOfAll(
				currentIndex
				,pageSize
				,queryOrderBySettingCollection
			);

                if (_Exists)
                {
                    IQueryable<MSBuildLogsExtended.DataSourceEntities.Solution> _Query = _GetQueryOfEntityOfAll(
				queryOrderBySettingCollection
			);

                    IEnumerable<MSBuildLogsExtended.DataSourceEntities.Solution> _retval;
					
					if (currentIndex == -1 || pageSize == -1)
					{
						_retval = _Query;
					}
					else
					{
						_retval = _Query.Skip(currentIndex).Take(pageSize);
					}
                    _retMessage.DataAccessLayerMessageStatus = Framework.DataSourceEntities.DataAccessLayerMessageStatus.Success;
                    _retMessage.Result = new MSBuildLogsExtended.DataSourceEntities.SolutionCollection();
					_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}: GetCollectionOfEntityOfAll", Framework.LoggingOptions.Data_Access_Layer_Process_Failed.ToString()), ex);
            }
            log.Info(string.Format("{0}: GetCollectionOfEntityOfAll", Framework.LoggingOptions.Data_Access_Layer_Process_Ended.ToString()));
            return _retMessage;
        }
        /// <summary>
        /// Batches the delete with entity collection input.
        /// </summary>
        /// <param name="input">The input.</param>
        public MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution BatchDelete(MSBuildLogsExtended.DataSourceEntities.SolutionCollection input)
        {
            log.Info(string.Format("{0}: BatchDelete", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));

			MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution  _retval = new MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution();
            _retval.OriginalValue = input;

            if (input != null)
            {
                List<MSBuildLogsExtended.EntityFrameworkContext.Solution> _ListOfLinq = new List<MSBuildLogsExtended.EntityFrameworkContext.Solution>();
                foreach (MSBuildLogsExtended.DataSourceEntities.Solution _ItemOfInput in input)
                {
                    MSBuildLogsExtended.EntityFrameworkContext.Solution _LinqItem = GetLinqObjectByIdentifier(_ItemOfInput);	
					this.LinqContext.Solution.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 MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution BatchInsert(MSBuildLogsExtended.DataSourceEntities.SolutionCollection input)
        {
            log.Info(string.Format("{0}: BatchInsert", Framework.LoggingOptions.Data_Access_Layer_Process_Started.ToString()));

			MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution  _retval = new MSBuildLogsExtended.DataSourceEntities.DataAccessLayerMessageOfEntityCollectionSolution();
            _retval.OriginalValue = input;

            if (input != null && input.Count > 0)
            {
                try
                {
                    DataTable _DataTable = new DataTable();
				_DataTable.Columns.Add("Id", typeof(System.Int32));
				_DataTable.Columns.Add("ExternalParentId", typeof(System.String));
				_DataTable.Columns.Add("Name", typeof(System.String));
				_DataTable.Columns.Add("Description", typeof(System.String));

                    foreach (MSBuildLogsExtended.DataSourceEntities.Solution _Item in input)
                    {
                        _DataTable.Rows.Add(new object[] { _Item.Id, _Item.ExternalParentId, _Item.Name, _Item.Description });
                    }

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

					s.ColumnMappings.Add("Id", "Id");
					s.ColumnMappings.Add("ExternalParentId", "ExternalParentId");
					s.ColumnMappings.Add("Name", "Name");
					s.ColumnMappings.Add("Description", "Description");

                        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;
        }