Exemplo n.º 1
0
        object GetFieldValue(SoodaObject obj, FieldInfo fi, bool isPrecommit)
        {
            object val = obj.GetFieldValue(fi.ClassUnifiedOrdinal);

            if (!fi.IsNullable && SqlBuilder.IsNullValue(val, fi))
            {
                if (!isPrecommit)
                {
                    throw new SoodaDatabaseException(obj.GetObjectKeyString() + "." + fi.Name + " cannot be null on commit.");
                }
                val = fi.PrecommitTypedValue;
                if (val == null)
                {
                    throw new SoodaDatabaseException(obj.GetObjectKeyString() + "." + fi.Name + " is null on precommit and no 'precommitValue' has been defined for it.");
                }
                if (val == SchemaInfo.NullPrecommitValue)
                {
                    val = null;
                }
                if (logger.IsDebugEnabled)
                {
                    logger.Debug("Using precommit value of {0} for {1}.{2}", val, fi.Table.NameToken, fi.Name);
                }
            }
            return(val);
        }
Exemplo n.º 2
0
 internal void AddToPostCommitQueue(SoodaObject o)
 {
     if (transactionLogger.IsTraceEnabled)
     {
         transactionLogger.Trace("Adding {0} to post-commit queue", o.GetObjectKeyString());
     }
     _postCommitQueue.Add(o);
 }
Exemplo n.º 3
0
 object GetFieldValue(SoodaObject obj, FieldInfo fi, bool isPrecommit)
 {
     object val = obj.GetFieldValue(fi.ClassUnifiedOrdinal);
     if (!fi.IsNullable && SqlBuilder.IsNullValue(val, fi))
     {
         if (!isPrecommit)
             throw new SoodaDatabaseException(obj.GetObjectKeyString() + "." + fi.Name + " cannot be null on commit.");
         val = fi.PrecommitTypedValue;
         if (val == null)
             throw new SoodaDatabaseException(obj.GetObjectKeyString() + "." + fi.Name + " is null on precommit and no 'precommitValue' has been defined for it.");
         if (val == SchemaInfo.NullPrecommitValue)
             val = null;
         if (logger.IsDebugEnabled)
         {
             logger.Debug("Using precommit value of {0} for {1}.{2}", val, fi.Table.NameToken, fi.Name);
         }
     }
     return val;
 }