Пример #1
0
        static void InsertWithChildrenRecursive(this SQLiteConnection conn, object element, bool replace, bool recursive, ISet <object> objectCache = null)
        {
            objectCache = objectCache ?? new HashSet <object>();
            if (objectCache.Contains(element))
            {
                return;
            }

            conn.InsertElement(element, replace, objectCache);

            objectCache.Add(element);
            conn.InsertChildrenRecursive(element, replace, recursive, objectCache);

            conn.UpdateWithChildren(element);
        }
Пример #2
0
        static void InsertAllWithChildrenRecursive(this SQLiteConnection conn, IEnumerable elements, bool replace, bool recursive, ISet <object> objectCache = null)
        {
            if (elements == null)
            {
                return;
            }

            objectCache = objectCache ?? new HashSet <object>();
            var insertedElements = conn.InsertElements(elements, replace, objectCache).Cast <object>().ToList();

            foreach (var element in insertedElements)
            {
                conn.InsertChildrenRecursive(element, replace, recursive, objectCache);
            }

            foreach (var element in insertedElements)
            {
                conn.UpdateWithChildren(element);
            }
        }