コード例 #1
0
        internal async Task <bool> SaveValueAsync(int oid, string field, SqoTypeInfo ti, object value)
        {
            if (field == "OID")
            {
                throw new SiaqodbException("OID cannot be saved from client code!");
            }
            ObjectSerializer serializer = SerializerFactory.GetSerializer(this.path, GetFileByType(ti), useElevatedTrust);

            serializer.NeedSaveComplexObjectAsync += new ComplexObjectEventHandler(serializer_NeedSaveComplexObjectAsync);

            if (oid > 0 && oid <= ti.Header.numberOfRecords && !(await serializer.IsObjectDeletedAsync(oid, ti).ConfigureAwait(false)))
            {
                return(await serializer.SaveFieldValueAsync(oid, field, ti, value, this.rawSerializer).ConfigureAwait(false));
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public async Task<TransactionObjectHeader> PreCommitAsync()
        {
            if (objInfo.Oid > 0 && objInfo.Oid <= objInfo.SqoTypeInfo.Header.numberOfRecords && !await serializer.IsObjectDeletedAsync(objInfo.Oid, objInfo.SqoTypeInfo).ConfigureAwait(false))
            {
                originalObject = await engine.LoadObjectByOIDAsync(objInfo.SqoTypeInfo, objInfo.Oid).ConfigureAwait(false);
                TransactionObjectHeader header = new TransactionObjectHeader();
                header.Operation = this.Operation;
                header.OIDofObject = engine.metaCache.GetOIDOfObject(originalObject, objInfo.SqoTypeInfo);
                return header;

            }
            return null;
        }