public void CurrentTimestampSelection() { var conf = TestConfigurationHelper.GetDefaultConfiguration(); Dialect.Dialect dialect = Dialect.Dialect.GetDialect(conf.Properties); if (!dialect.SupportsCurrentTimestampSelection) { Assert.Ignore("This test does not apply to " + dialect.GetType().FullName); } var sessions = (ISessionFactoryImplementor)conf.BuildSessionFactory(); sessions.ConnectionProvider.Configure(conf.Properties); IDriver driver = sessions.ConnectionProvider.Driver; using (var connection = sessions.ConnectionProvider.GetConnection()) { var statement = driver.GenerateCommand(CommandType.Text, new SqlString(dialect.CurrentTimestampSelectString), Array.Empty <SqlType>()); statement.Connection = connection; using (var reader = statement.ExecuteReader()) { Assert.That(reader.Read(), "should return one record"); Assert.That(reader[0], Is.InstanceOf <DateTime>()); } } }
public static TestDialect GetTestDialect(Dialect.Dialect dialect) { var testDialectTypeName = "NHibernate.Test.TestDialects." + dialect.GetType().Name.Replace("Dialect", "TestDialect"); var testDialectType = System.Type.GetType(testDialectTypeName); if (testDialectType != null) { return((TestDialect)Activator.CreateInstance(testDialectType, dialect)); } return(new TestDialect(dialect)); }
/// <summary> /// Initializes a new instance of the <see cref="MultiCriteriaImpl"/> class. /// </summary> /// <param name="session">The session.</param> /// <param name="factory">The factory.</param> internal MultiCriteriaImpl(SessionImpl session, SessionFactoryImpl factory) { dialect = session.Factory.Dialect; if (!session.Factory.ConnectionProvider.Driver.SupportsMultipleQueries) { throw new NotSupportedException( string.Format("The dialect {0} does not support multiple queries.", dialect.GetType().FullName)); } this.session = session; this.factory = factory; }
protected override bool AppliesTo(Dialect.Dialect dialect) { return(dialect.GetType() == typeof(MsSql2005Dialect) || dialect.GetType() == typeof(MsSql2008Dialect)); }
public bool AppliesToDialect(Dialect.Dialect dialect) { // empty means no scoping return(dialectScopes.IsEmpty || dialectScopes.Contains(dialect.GetType().FullName)); }