mirror of
https://github.com/hanzoai/jube-fork.git
synced 2026-10-30 18:33:33 +00:00
Refactors startup and DI, implements a local LRU cache to reduce Redis load, introduces high-performance dictionaries, and optimizes Invoke routing for parallelism. Includes Redis and library upgrades, schema migrations, logging improvements, and overall code cleanup for better performance, readability, and maintainabilit
60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
/* Copyright (C) 2022-present Jube Holdings Limited.
|
|
*
|
|
* This file is part of Jube™ software.
|
|
*
|
|
* Jube™ is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License
|
|
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
* Jube™ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU Affero General Public License along with Jube™. If not,
|
|
* see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
using System;
|
|
|
|
namespace Jube.Data.Extension
|
|
{
|
|
public static class Extension
|
|
{
|
|
public static string AsString(this object obj)
|
|
{
|
|
return (string)obj;
|
|
}
|
|
|
|
public static double AsDouble(this object obj)
|
|
{
|
|
return (double)obj;
|
|
}
|
|
|
|
public static int AsInt(this object obj)
|
|
{
|
|
return (int)obj;
|
|
}
|
|
|
|
public static long AsLong(this object obj)
|
|
{
|
|
return (long)obj;
|
|
}
|
|
|
|
public static short AsShort(this object obj)
|
|
{
|
|
return (short)obj;
|
|
}
|
|
|
|
public static byte AsByte(this object obj)
|
|
{
|
|
return (byte)obj;
|
|
}
|
|
|
|
public static Guid AsGuid(this object obj)
|
|
{
|
|
return Guid.Parse(obj.ToString() ?? string.Empty);
|
|
}
|
|
|
|
public static DateTime AsDateTime(this object obj)
|
|
{
|
|
return Convert.ToDateTime(obj);
|
|
}
|
|
}
|
|
} |