public IUpdateStatement <TEntity> Set <TMember>(
            Expression <Func <TEntity, TMember> > selector,
            TMember value,
            string tableSchema = null,
            string tableName   = null)
        {
            if (entity != null)
            {
                throw new InvalidOperationException(
                          "Set cannot be used once For has been used, please create a new command.");
            }
            IsClean = false;
            var selector1 = ConvertExpression(selector);

            if (!CustomAttributeHandle.IsIdentityField <TEntity>(GetMemberName(selector1)))
            {
                setSelectors.Add(selector1);
                setValues.Add(value);
            }

            selectorswithValue.Add(GetMemberName(selector1), value);
            TableSchema = tableSchema;
            TableName   = GetTableNameChange(tableName);
            return(this);
        }
Beispiel #2
0
        public IInsertStatement <TEntity> With <TMember>(Expression <Func <TEntity, TMember> > selector, TMember value)
        {
            if (entity != null)
            {
                throw new InvalidOperationException("With cannot be used once For has been used, please use FromScratch to reset the command before using With.");
            }
            CheckIdentityFiled();
            IsClean = false;
            Expression <Func <TEntity, object> > selector1 = ConvertExpression(selector);

            if (!CustomAttributeHandle.IsIdentityField <TEntity>(GetMemberName(selector1)))
            {
                selectors.Add(selector1);
                values.Add(value);
            }
            selectorswithValue.Add(GetMemberName(selector1), value);
            return(this);
        }