private void CommitNewObjectsToDb(ObjectsByPropertyIndexSet plan)
        {
            List <MetadataProperty> metaProps = this.GetMetaProps(plan.IndexSet);
            StringBuilder           sql       = new StringBuilder(string.Format("INSERT INTO [{0}]([{1}]", (object)this.FClass.DataTable, (object)this.FClass.IDProperty.DataField));
            int paramIndex1 = 1;

            StorageCommitPlan.MetaPropsToSql((IList <MetadataProperty>)metaProps, sql, ",", "[{0}]", (DataType[])null, ref paramIndex1);
            sql.Append(") VALUES (?");
            DataType[] paramTypes = new DataType[paramIndex1];
            object[]   values     = new object[paramIndex1];
            paramTypes[0] = DataType.String;
            int paramIndex2 = 1;

            StorageCommitPlan.MetaPropsToSql((IList <MetadataProperty>)metaProps, sql, ",", "?", paramTypes, ref paramIndex2);
            sql.Append(")");
            InDbCommand command = this.FSession.Db.CreateCommand(sql.ToString(), paramTypes);

            try
            {
                for (int index1 = 0; index1 < plan.Count; ++index1)
                {
                    DataObject dataObject = plan[index1];
                    int        index2     = 1;
                    values[0] = (object)dataObject.Id.ToString();
                    StorageCommitPlan.CopyPropsToParams(dataObject, (IList <MetadataProperty>)metaProps, values, ref index2);
                    command.Execute(values);
                }
            }
            finally
            {
                command.Dispose();
            }
        }
        private void AddModifiedObjectInfos(
            ObjectsByPropertyIndexSet plan,
            ICollection <ModifiedObjectInfo> modifiedObjects)
        {
            List <MetadataProperty> metaProps = this.GetMetaProps(plan.IndexSet);

            for (int index = 0; index < plan.Count; ++index)
            {
                DataObject         dataObject         = plan[index];
                ModifiedObjectInfo modifiedObjectInfo = new ModifiedObjectInfo(dataObject.Id.ToString());
                StorageCommitPlan.CopyPropsToModifiedObjectInfoProperties(dataObject, (IEnumerable <MetadataProperty>)metaProps, (IDictionary <MetadataProperty, object>)modifiedObjectInfo.Properties);
                modifiedObjects.Add(modifiedObjectInfo);
            }
        }
        private void CommitModifiedObjectsToDb(ObjectsByPropertyIndexSet plan)
        {
            if (plan.IndexSet.IsEmpty)
            {
                return;
            }
            List <MetadataProperty> metaProps = this.GetMetaProps(plan.IndexSet);
            StringBuilder           sql       = new StringBuilder(string.Format("UPDATE [{0}] SET ", (object)this.FClass.DataTable));
            int paramIndex1 = 0;

            StorageCommitPlan.MetaPropsToSql((IList <MetadataProperty>)metaProps, sql, (string)null, "[{0}]=?", (DataType[])null, ref paramIndex1);
            sql.Append(string.Format(" WHERE [{0}]=?", (object)this.FClass.IDProperty.DataField));
            DataType[] paramTypes  = new DataType[paramIndex1 + 1];
            object[]   values      = new object[paramIndex1 + 1];
            int        paramIndex2 = 0;

            StorageCommitPlan.MetaPropsToSql((IList <MetadataProperty>)metaProps, (StringBuilder)null, (string)null, (string)null, paramTypes, ref paramIndex2);
            paramTypes[paramIndex2] = DataType.String;
            InDbCommand command = this.FSession.Db.CreateCommand(sql.ToString(), paramTypes);

            try
            {
                for (int index1 = 0; index1 < plan.Count; ++index1)
                {
                    DataObject dataObject = plan[index1];
                    int        index2     = 0;
                    StorageCommitPlan.CopyPropsToParams(dataObject, (IList <MetadataProperty>)metaProps, values, ref index2);
                    values[index2] = (object)dataObject.Id.ToString();
                    command.Execute(values);
                }
            }
            finally
            {
                command.Dispose();
            }
        }