Exemplo n.º 1
0
        public bool PersistenceToDatabase <T>(IList <T> insertList, IList <T> updateList, IList <T> deleteList) where T : class, new()
        {
            try
            {
                Dictionary <object, ChangeType> tempDictionary = new Dictionary <object, ChangeType>();

                if (insertList != null)
                {
                    foreach (var itemT in insertList)
                    {
                        tempDictionary.Add(itemT, ChangeType.Add);
                    }
                }

                if (updateList != null)
                {
                    foreach (var itemT in updateList)
                    {
                        tempDictionary.Add(itemT, ChangeType.Update);
                    }
                }

                if (deleteList != null)
                {
                    foreach (var itemT in deleteList)
                    {
                        tempDictionary.Add(itemT, ChangeType.Delete);
                    }
                }

                dataAccessor.AcceptChanges(tempDictionary);
            }
            catch (Exception)
            {
#if DEBUG
                throw;
#endif
                return(false);
            }

            return(true);
        }