소스 검색

Improvements to the new Client fucntions I made, so they go through the original functions.

Kenric Nugteren 1 년 전
부모
커밋
e38185a3cf
2개의 변경된 파일14개의 추가작업 그리고 17개의 파일을 삭제
  1. 0 1
      InABox.Client.RPC/Transports/RPCClientTransport.cs
  2. 14 16
      InABox.Core/Client/Client.cs

+ 0 - 1
InABox.Client.RPC/Transports/RPCClientTransport.cs

@@ -76,7 +76,6 @@ namespace InABox.Rpc
             where TParameters : IRpcCommandParameters, ISerializeBinary
             where TResult : IRpcCommandResult, ISerializeBinary, new()
         {
-            
             CheckConnection<TCommand, TParameters, TResult>();
             
             var request = new RpcMessage()

+ 14 - 16
InABox.Core/Client/Client.cs

@@ -74,47 +74,47 @@ namespace InABox.Clients
         public static CoreTable Query<TEntity>(Filter<TEntity>? filter = null, Columns<TEntity>? columns = null, SortOrder<TEntity>? orderby = null)
             where TEntity : Entity, IRemotable, IPersistent, new()
         {
-            return CheckClient<TEntity>().Query(filter, columns, orderby);
+            return new Client<TEntity>().Query(filter, columns, orderby);
         }
 
         public static void Query<TEntity>(Filter<TEntity>? filter, Columns<TEntity>? columns, SortOrder<TEntity>? orderby, Action<CoreTable?, Exception?> callback)
             where TEntity : Entity, IRemotable, IPersistent, new()
         {
-            CheckClient<TEntity>().Query(filter, columns, orderby, callback);
+            new Client<TEntity>().Query(filter, columns, orderby, callback);
         }
 
         public static void Save<TEntity>(TEntity entity, string auditNote)
             where TEntity : Entity, IRemotable, IPersistent, new()
         {
-            CheckClient<TEntity>().Save(entity, auditNote);
+            new Client<TEntity>().Save(entity, auditNote);
         }
         public static void Save<TEntity>(IEnumerable<TEntity> entities, string auditNote)
             where TEntity : Entity, IRemotable, IPersistent, new()
         {
-            CheckClient<TEntity>().Save(entities, auditNote);
+            new Client<TEntity>().Save(entities, auditNote);
         }
 
         public static void Save<TEntity>(TEntity entity, string auditNote, Action<TEntity, Exception?> callback)
             where TEntity : Entity, IRemotable, IPersistent, new()
         {
-            CheckClient<TEntity>().Save(entity, auditNote, callback);
+            new Client<TEntity>().Save(entity, auditNote, callback);
         }
         public static void Save<TEntity>(IEnumerable<TEntity> entities, string auditNote, Action<IEnumerable<TEntity>, Exception?> callback)
             where TEntity : Entity, IRemotable, IPersistent, new()
         {
-            CheckClient<TEntity>().Save(entities, auditNote, callback);
+            new Client<TEntity>().Save(entities, auditNote, callback);
         }
 
         public static void Delete<TEntity>(TEntity entity, string auditNote)
             where TEntity : Entity, IRemotable, IPersistent, new()
         {
-            CheckClient<TEntity>().Delete(entity, auditNote);
+            new Client<TEntity>().Delete(entity, auditNote);
         }
 
         public static void Delete<TEntity>(IEnumerable<TEntity> entities, string auditNote)
             where TEntity : Entity, IRemotable, IPersistent, new()
         {
-            CheckClient<TEntity>().Delete(entities, auditNote);
+            new Client<TEntity>().Delete(entities, auditNote);
         }
 
         public static void QueryMultiple(
@@ -334,13 +334,11 @@ namespace InABox.Clients
         {
             try
             {
-                using (var timer = new Profiler<TEntity>(false))
-                {
-                    CheckSupported();
-                    var result = _client.Query(filter, columns, orderby);
-                    timer.Log(result.Rows.Count);
-                    return result;
-                }
+                using var timer = new Profiler<TEntity>(false);
+                CheckSupported();
+                var result = _client.Query(filter, columns, orderby);
+                timer.Log(result.Rows.Count);
+                return result;
             }
             catch(RequestException e)
             {
@@ -361,7 +359,7 @@ namespace InABox.Clients
                 CheckSupported();
                 _client.Query(filter, columns, sort, (c, e) =>
                 {
-                    timer.Dispose(c != null ? c.Rows.Count : -1);
+                    timer.Log(c != null ? c.Rows.Count : -1);
                     callback?.Invoke(c, e);
                 });
             }