From 1a1c8e71fcd14858f595029f089b2d4a00202b32 Mon Sep 17 00:00:00 2001
From: ogi <Administrator@S-OGI-PC>
Date: Fri, 05 Dec 2025 09:24:16 +0900
Subject: [PATCH] プロジェクトファイルを追加。
---
HotelPms.Data.Client/GrpcFactory.cs | 79 +++++++++++++++++++++++++++++++++++++++
1 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/HotelPms.Data.Client/GrpcFactory.cs b/HotelPms.Data.Client/GrpcFactory.cs
new file mode 100644
index 0000000..304554c
--- /dev/null
+++ b/HotelPms.Data.Client/GrpcFactory.cs
@@ -0,0 +1,79 @@
+using Grpc.Net.Client;
+using Grpc.Net.Client.Web;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HotelPms.Data.Client
+{
+ public class GrpcFactory : IDisposable
+ {
+ public static string Url = "https://localhost:7240"; //托管
+ //public static string Url = "https://localhost:5001"; //
+ //public static string Url = "https://133.125.63.43:46492"; //Web ⇒OK
+
+ private static GrpcFactory m_Default = null;
+
+ public static GrpcFactory Instance
+ {
+ get
+ {
+ if (m_Default == null) { m_Default = new GrpcFactory(); }
+ return m_Default;
+ }
+ }
+
+
+
+ /// <summary>
+ /// チャネル
+ /// </summary>
+ public GrpcChannel Channel { get; private set; } = null;
+
+ /// <summary>
+ /// GrpcTableの取得、更新用クライアント
+ /// </summary>
+ public GrpcTableCore.GrpcTableCoreClient TableCore { get; private set; } = null;
+
+ /// <summary>
+ /// GrpcSetの取得、更新用クライアント
+ /// </summary>
+ public GrpcSetCore.GrpcSetCoreClient SetCore { get; private set; } = null;
+
+ #region 各テーブルのクラウド
+
+ //public MenuCore.MenuCoreClient Menu { get; private set; } = null;
+
+ #endregion
+
+ public GrpcFactory()
+ {
+ var httpClientHandler = new HttpClientHandler();
+ httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
+ var httpClient = new HttpClient(new GrpcWebHandler(GrpcWebMode.GrpcWeb, httpClientHandler));
+ //var httpClient = new HttpClient(httpClientHandler);
+ GrpcChannelOptions options = new GrpcChannelOptions()
+ {
+ MaxReceiveMessageSize = int.MaxValue,
+ HttpClient = httpClient
+ };
+ Channel = GrpcChannel.ForAddress(Url, options);
+ TableCore = new GrpcTableCore.GrpcTableCoreClient(Channel);
+ SetCore = new GrpcSetCore.GrpcSetCoreClient(Channel);
+
+ #region 各テーブルのクラウド
+
+ //Menu = new MenuCore.MenuCoreClient(Channel);
+
+ #endregion
+ }
+
+ public void Dispose()
+ {
+ if (Channel != null) { Channel.Dispose(); }
+ }
+ }
+}
--
Gitblit v1.10.0