public void RenderDateTimeLiteralValue() { DateTime dateTime = new DateTime(2010, 1, 1); DateTimeLiteralValue dateTimeLiteralValue = new DateTimeLiteralValue(dateTime); Assert.AreEqual("CONVERT(datetime, '20100101')", sqlClientRenderer.Render(dateTimeLiteralValue)); }
public void CreateDateTimeLiteralValue() { DateTime dateTime = new DateTime(2010, 1, 1); DateTimeLiteralValue dateTimeLiteralValue = new DateTimeLiteralValue(dateTime); Assert.AreEqual(dateTime, dateTimeLiteralValue.Literal); }
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"))); } }
public abstract string Render(DateTimeLiteralValue dateTimeLiteralValue);