Ejemplo n.º 1
0
        public IColumnMap Generated(bool allowUpdates = false)
        {
            if (IgnoreOperations.HasFlag(SqlOperation.Select))
            {
                throw new InvalidOperationException($"Column '{ColumnName}' cannot be generated because select operations are ignored.");
            }

            Behavior         |= ColumnBehavior.Generated;
            IgnoreOperations |= SqlOperation.Insert | (allowUpdates ? 0 : SqlOperation.Update);

            return(this);
        }
Ejemplo n.º 2
0
        public IColumnMap Key(bool isGenerated = true)
        {
            if (IgnoreOperations.HasFlag(SqlOperation.Select))
            {
                throw new InvalidOperationException($"Column '{ColumnName}' cannot be a key because select operations are ignored.");
            }

            Behavior |= ColumnBehavior.Key;

            if (isGenerated)
            {
                return(Generated());
            }
            else
            {
                IgnoreOperations |= SqlOperation.Update;
            }

            return(this);
        }