diff --git a/FunGame.Core/Api/Data/SQLHelper.cs b/FunGame.Core/Api/Data/SQLHelper.cs
index 9c62f04..b10834c 100644
--- a/FunGame.Core/Api/Data/SQLHelper.cs
+++ b/FunGame.Core/Api/Data/SQLHelper.cs
@@ -8,7 +8,7 @@ namespace Milimoe.FunGame.Core.Api.Data
/// 需要在Server中继承此类实现。
/// Milimoe.FunGame.Core.Service.SQLManager也是
///
- public class SQLHelper : ISQLHelper
+ public abstract class SQLHelper : ISQLHelper
{
public string Script { get; set; } = "";
@@ -18,24 +18,10 @@ namespace Milimoe.FunGame.Core.Api.Data
public SQLResult Result { get; }
- public SQLServerInfo ServerInfo { get; }
+ public abstract SQLServerInfo ServerInfo { get; }
public int UpdateRows { get; }
- public static SQLHelper GetHelper(EntityType type)
- {
- return new SQLHelper(type);
- }
-
- private SQLHelper(EntityType type = EntityType.Empty, SQLServerInfo? info = null, SQLResult result = SQLResult.Success, int rows = 0)
- {
- this.EntityType = type;
- if (info == null) this.ServerInfo = SQLServerInfo.Create();
- else this.ServerInfo = info;
- this.Result = result;
- this.UpdateRows = rows;
- }
-
public virtual SQLResult Execute()
{
return SQLResult.NotFound;
diff --git a/FunGame.Core/Interface/Base/ISQLHelper.cs b/FunGame.Core/Interface/Base/ISQLHelper.cs
index e18a211..5ca08c6 100644
--- a/FunGame.Core/Interface/Base/ISQLHelper.cs
+++ b/FunGame.Core/Interface/Base/ISQLHelper.cs
@@ -1,4 +1,5 @@
-using Milimoe.FunGame.Core.Library.Constant;
+using Milimoe.FunGame.Core.Library.Common.Network;
+using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Interface.Base
{
@@ -9,6 +10,6 @@ namespace Milimoe.FunGame.Core.Interface.Base
public object Entity { get; }
public SQLResult Result { get; }
int UpdateRows { get; }
- public Library.Common.Network.SQLServerInfo ServerInfo { get; }
+ public SQLServerInfo ServerInfo { get; }
}
}
diff --git a/FunGame.Core/Service/SQLManager.cs b/FunGame.Core/Service/SQLManager.cs
index 34bb309..048642e 100644
--- a/FunGame.Core/Service/SQLManager.cs
+++ b/FunGame.Core/Service/SQLManager.cs
@@ -1,84 +1,41 @@
-using Milimoe.FunGame.Core.Api.Data;
-using Milimoe.FunGame.Core.Library.Constant;
+using System.Data;
using System.Text;
+using Milimoe.FunGame.Core.Api.Data;
+using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Service
{
///
/// 需要在Server中继承此类实现
///
- public class SQLManager
+ public abstract class SQLManager
{
- internal SQLHelper SQLHelper { get; }
+ public SQLHelper? SQLHelper { get; }
- internal SQLManager(SQLHelper SQLHelper)
- {
- this.SQLHelper = SQLHelper;
- }
+ public abstract int Add(StringBuilder sql, ref SQLResult result);
- protected virtual int Add(StringBuilder sql, ref SQLResult result)
- {
- return 0;
- }
+ public abstract int Add(string sql, ref SQLResult result);
- protected virtual int Add(string sql, ref SQLResult result)
- {
- return 0;
- }
+ public abstract SQLResult Execute();
- protected virtual SQLResult Execute()
- {
- return SQLResult.NotFound;
- }
+ public abstract SQLResult Execute(StringBuilder sql);
- protected virtual SQLResult Execute(StringBuilder sql)
- {
- return SQLResult.NotFound;
- }
+ public abstract SQLResult Execute(string sql);
- protected virtual SQLResult Execute(string sql)
- {
- return SQLResult.NotFound;
- }
+ public abstract DataSet ExecuteDataSet(StringBuilder sql);
- protected virtual object Query(EntityType type, StringBuilder sql)
- {
- return General.EntityInstance;
- }
+ public abstract DataSet ExecuteDataSet(string sql);
- protected virtual T? Query(StringBuilder sql)
- {
- return default;
- }
+ public abstract object Query(EntityType type, StringBuilder sql);
- protected virtual object Query(EntityType type, string sql)
- {
- return General.EntityInstance;
- }
+ public abstract object Query(EntityType type, string sql);
- protected virtual T? Query(string sql)
- {
- return default;
- }
+ public abstract int Remove(StringBuilder sql, ref SQLResult result);
- protected virtual int Remove(StringBuilder sql, ref SQLResult result)
- {
- return 0;
- }
+ public abstract int Remove(string sql, ref SQLResult result);
- protected virtual int Remove(string sql, ref SQLResult result)
- {
- return 0;
- }
-
- protected virtual int Update(StringBuilder sql, ref SQLResult result)
- {
- return 0;
- }
-
- protected virtual int Update(string sql, ref SQLResult result)
- {
- return 0;
- }
+ public abstract int Update(StringBuilder sql, ref SQLResult result);
+
+ public abstract int Update(string sql, ref SQLResult result);
}
}
diff --git a/FunGame.Core/Service/SocketManager.cs b/FunGame.Core/Service/SocketManager.cs
index 132240d..4046822 100644
--- a/FunGame.Core/Service/SocketManager.cs
+++ b/FunGame.Core/Service/SocketManager.cs
@@ -9,24 +9,12 @@ namespace Milimoe.FunGame.Core.Service
///
/// 客户端专用Socket
///
- internal static Socket? Socket
- {
- get
- {
- return _Socket;
- }
- }
+ internal static Socket? Socket => _Socket;
///
/// 服务器端专用Socket
///
- internal static Socket? ServerSocket
- {
- get
- {
- return _ServerSocket;
- }
- }
+ internal static Socket? ServerSocket => _ServerSocket;
private static Socket? _Socket = null;
private static Socket? _ServerSocket = null;
diff --git a/FunGame.Core/Service/ThreadManager.cs b/FunGame.Core/Service/ThreadManager.cs
index d2f8d13..e91384d 100644
--- a/FunGame.Core/Service/ThreadManager.cs
+++ b/FunGame.Core/Service/ThreadManager.cs
@@ -34,13 +34,7 @@ namespace Milimoe.FunGame.Core.Service
///
/// Thread的Key
/// Thread对象
- internal BaseModel this[string name]
- {
- get
- {
- return Threads[name];
- }
- }
+ internal BaseModel this[string name] => Threads[name];
///
/// 向线程管理器中添加Thread
diff --git a/FunGame.Desktop/Model/MainModel.cs b/FunGame.Desktop/Model/MainModel.cs
index bc7ba02..bebdeea 100644
--- a/FunGame.Desktop/Model/MainModel.cs
+++ b/FunGame.Desktop/Model/MainModel.cs
@@ -329,7 +329,6 @@ namespace Milimoe.FunGame.Desktop.Model
Main.OnFailedConnectEvent(new GeneralEventArgs());
Close();
}
-
return result;
}