Exemplo n.º 1
0
        private static DateTime GetDatabaseTimeFromDatabase(ISqlExecuter sqlExecuter)
        {
            DateTime now;

            if (DatabaseLanguageIsMsSql.Value)
            {
                now = MsSqlUtility.GetDatabaseTime(sqlExecuter);
            }
            else if (DatabaseLanguageIsOracle.Value)
            {
                throw new FrameworkException("GetDatabaseTime function is not yet supported in Rhetos for Oracle database.");
            }
            else
            {
                throw new FrameworkException(UnsupportedLanguageError);
            }
            return(DateTime.SpecifyKind(now, DateTimeKind.Local));
        }
Exemplo n.º 2
0
 public static DateTime GetDatabaseTime(ISqlExecuter sqlExecuter)
 {
     return(DatabaseTimeCache.GetDatabaseTimeCached(() =>
     {
         DateTime databaseTime;
         if (DatabaseLanguageIsMsSql.Value)
         {
             databaseTime = MsSqlUtility.GetDatabaseTime(sqlExecuter);
         }
         else if (DatabaseLanguageIsOracle.Value)
         {
             throw new FrameworkException("GetDatabaseTime function is not yet supported in Rhetos for Oracle database.");
         }
         else
         {
             throw new FrameworkException(UnsupportedLanguageError);
         }
         return DateTime.SpecifyKind(databaseTime, DateTimeKind.Local);
     }, () => DateTime.Now));
 }