Пример #1
0
        public void RenderDateTimeLiteralValue()
        {
            DateTime             dateTime             = new DateTime(2010, 1, 1);
            DateTimeLiteralValue dateTimeLiteralValue = new DateTimeLiteralValue(dateTime);

            Assert.AreEqual("CONVERT(datetime, '20100101')", sqlClientRenderer.Render(dateTimeLiteralValue));
        }
Пример #2
0
        public void CreateDateTimeLiteralValue()
        {
            DateTime             dateTime             = new DateTime(2010, 1, 1);
            DateTimeLiteralValue dateTimeLiteralValue = new DateTimeLiteralValue(dateTime);

            Assert.AreEqual(dateTime, dateTimeLiteralValue.Literal);
        }
Пример #3
0
 public override string Render(DateTimeLiteralValue dateTimeLiteralValue)
 {
     if (ReplaceLiteralsWithParameters)
     {
         return(AddParameter(dateTimeLiteralValue.Literal, DbType.Boolean).Render(this));
     }
     else
     {
         return(string.Format("CONVERT(datetime, '{0}')", Convert.ToDateTime(dateTimeLiteralValue.Literal).ToString("yyyyMMdd")));
     }
 }
Пример #4
0
 public abstract string Render(DateTimeLiteralValue dateTimeLiteralValue);