Beispiel #1
0
        private TableRow GetSqlEntity(string partitionKey, string rowKey, DateTime?timeStamp)
        {
            string   str      = partitionKey;
            string   str1     = rowKey;
            TableRow tableRow = null;

            str  = DevelopmentStorageDbDataContext.EncodeKeyString(str);
            str1 = DevelopmentStorageDbDataContext.EncodeKeyString(str1);
            if (!timeStamp.HasValue || !timeStamp.HasValue)
            {
                tableRow = (
                    from r in this.m_dbContext.TableRows
                    where (r.AccountName == this.AccountName) && (r.TableName == this.m_currentResourceContainer.Name.ToLowerInvariant()) && (r.PartitionKey == str) && (r.RowKey == str1)
                    select r).FirstOrDefault <TableRow>();
            }
            else
            {
                DateTime sql2005DateTime = DevelopmentStorageDbDataContext.GetSql2005DateTime(timeStamp.Value);
                tableRow = (
                    from r in this.m_dbContext.TableRows
                    where (r.AccountName == this.AccountName) && (r.TableName == this.m_currentResourceContainer.Name.ToLowerInvariant()) && (r.PartitionKey == str) && (r.RowKey == str1) && (r.Timestamp == sql2005DateTime)
                    select r).FirstOrDefault <TableRow>();
            }
            return(tableRow);
        }
Beispiel #2
0
 protected Expression VisitConstant(ConstantExpression c)
 {
     if (!(c.Value is IQueryable))
     {
         if (c.Value == null)
         {
             throw new ArgumentException("Nulls are not supported in a query.", "c");
         }
         if (!this.HasOpenPropertyOnStack())
         {
             this.PartialClause.Append(string.Concat("@p", this.paramIndex));
         }
         else
         {
             this.InsertOpenTypeFilters(c.Value, string.Concat("@p", this.paramIndex));
         }
         this.paramIndex++;
         this.pointQueryTracker.AddValue(c.Value);
         if (c.Value is DateTime)
         {
             DateTime sql2005DateTime = DevelopmentStorageDbDataContext.GetSql2005DateTime((DateTime)c.Value);
             this.Parameters.Add(new ParameterRecord(XmlConvert.ToString(sql2005DateTime, XmlDateTimeSerializationMode.Utc), false));
         }
         else if (c.Value is Guid)
         {
             this.Parameters.Add(new ParameterRecord(c.Value.ToString(), false));
         }
         else if (!(c.Value is string))
         {
             this.Parameters.Add(new ParameterRecord(c.Value, false));
         }
         else
         {
             this.Parameters.Add(new ParameterRecord(c.Value, true));
         }
     }
     return(c);
 }