Beispiel #1
0
        public int SaveChanges(DataConnection dataConnection)
        {
            int count = 0;

            for (int i = _orderedTableTypes.Length - 1; i >= 0; i--)
            {
                OeLinq2DbTable table = GetTable(_orderedTableTypes[i].ClrTableType);
                if (table != null)
                {
                    count += table.SaveInserted(dataConnection);
                    UpdateIdentities(table, i);

                    count += table.SaveUpdated(dataConnection);
                }
            }

            for (int i = 0; i < _orderedTableTypes.Length; i++)
            {
                OeLinq2DbTable table = GetTable(_orderedTableTypes[i].ClrTableType);
                if (table != null)
                {
                    count += table.SaveDeleted(dataConnection);
                }
            }

            return(count);
        }
Beispiel #2
0
        public int SaveChanges(IEdmModel edmModel, OeEntitySetMetaAdapterCollection entitySetMetaAdapters, DataConnection dataConnection)
        {
            List <ClrTypeEdmSet> clrTypeEdmSetList = GetClrTypeEdmSetList(edmModel, entitySetMetaAdapters);
            int count = 0;

            for (int i = clrTypeEdmSetList.Count - 1; i >= 0; i--)
            {
                OeLinq2DbTable table = GetTable(clrTypeEdmSetList[i].ClrType);

                count += table.SaveInserted(dataConnection);
                UpdateIdentities(table, clrTypeEdmSetList, i);

                count += table.SaveUpdated(dataConnection);
            }

            for (int i = 0; i < clrTypeEdmSetList.Count; i++)
            {
                OeLinq2DbTable table = GetTable(clrTypeEdmSetList[i].ClrType);
                count += table.SaveDeleted(dataConnection);
            }

            return(count);
        }