service client ausgelagert

This commit is contained in:
2025-04-14 13:04:13 +02:00
parent 0f38916521
commit b122048ea1
11 changed files with 45 additions and 220 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@
DebugConfig.txt
Host/Multitenancy/demo.config
*.log.txt
*temp.txt
# Folder
bin[Rr]elease/

View File

@@ -95,6 +95,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="Converter\NewlineConverter.cs" />
<Compile Include="ServiceProxy\GeneratedAiEnhancedService.cs" />
<Compile Include="ViewModel\AiConfigVM.cs" />
<Compile Include="View\Detail\AI\AiConfigView.xaml.cs">
<DependentUpon>AiConfigView.xaml</DependentUpon>

View File

@@ -7,160 +7,8 @@
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BeWo.ServiceProxy
{
using System.Runtime.Serialization;
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
public partial class BeWoFault : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
{
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
private BeWo.ServiceProxy.BeWoFaultType FaultTypeField;
private string InnerExceptionMessageField;
private string InnerExceptionStackTraceField;
private string MessageField;
private string StackTraceField;
public System.Runtime.Serialization.ExtensionDataObject ExtensionData
{
get
{
return this.extensionDataField;
}
set
{
this.extensionDataField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public BeWo.ServiceProxy.BeWoFaultType FaultType
{
get
{
return this.FaultTypeField;
}
set
{
if ((this.FaultTypeField.Equals(value) != true))
{
this.FaultTypeField = value;
this.RaisePropertyChanged("FaultType");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string InnerExceptionMessage
{
get
{
return this.InnerExceptionMessageField;
}
set
{
if ((object.ReferenceEquals(this.InnerExceptionMessageField, value) != true))
{
this.InnerExceptionMessageField = value;
this.RaisePropertyChanged("InnerExceptionMessage");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string InnerExceptionStackTrace
{
get
{
return this.InnerExceptionStackTraceField;
}
set
{
if ((object.ReferenceEquals(this.InnerExceptionStackTraceField, value) != true))
{
this.InnerExceptionStackTraceField = value;
this.RaisePropertyChanged("InnerExceptionStackTrace");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string Message
{
get
{
return this.MessageField;
}
set
{
if ((object.ReferenceEquals(this.MessageField, value) != true))
{
this.MessageField = value;
this.RaisePropertyChanged("Message");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string StackTrace
{
get
{
return this.StackTraceField;
}
set
{
if ((object.ReferenceEquals(this.StackTraceField, value) != true))
{
this.StackTraceField = value;
this.RaisePropertyChanged("StackTrace");
}
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null))
{
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="BeWoFaultType", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
public enum BeWoFaultType : int
{
[System.Runtime.Serialization.EnumMemberAttribute()]
Unknown = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
Concurrency = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
DeleteNotPossible = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
LoginNameTaken = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
CustomWithoutDetails = 4,
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="BeWo.ServiceProxy.IAiEnhancedService")]
public interface IAiEnhancedService

View File

@@ -7,7 +7,6 @@
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BeWo.ServiceProxy
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
@@ -15,29 +14,9 @@ namespace BeWo.ServiceProxy
public interface IOperationsEnhancedService
{
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/GetAiConfig", ReplyAction="http://tempuri.org/IOperationsEnhancedService/GetAiConfigResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/GetAiConfigBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.Shared.DataContracts.Feature.AI.AiConfigDC GetAiConfig();
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/UpdateAiConfig", ReplyAction="http://tempuri.org/IOperationsEnhancedService/UpdateAiConfigResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/UpdateAiConfigBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.Shared.DataContracts.Feature.AI.AiConfigDC UpdateAiConfig(BS.Shared.DataContracts.Feature.AI.AiConfigDC toUpdate);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/GetAiModels", ReplyAction="http://tempuri.org/IOperationsEnhancedService/GetAiModelsResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/GetAiModelsBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiModelDC> GetAiModels();
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/GetAiConversations", ReplyAction="http://tempuri.org/IOperationsEnhancedService/GetAiConversationsResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/GetAiConversationsBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(int uicontext);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/CreateAiConversation", ReplyAction="http://tempuri.org/IOperationsEnhancedService/CreateAiConversationResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/CreateAiConversationBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, long modell_oid);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/SendNewMessage", ReplyAction="http://tempuri.org/IOperationsEnhancedService/SendNewMessageResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/SendNewMessageBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
System.Collections.Generic.List<BS.Shared.DataContracts.AiConversationMessageDC> SendNewMessage(long conversation, string message);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/HelloWorld", ReplyAction="http://tempuri.org/IOperationsEnhancedService/HelloWorldResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/HelloWorldBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
void HelloWorld();
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
@@ -74,34 +53,9 @@ namespace BeWo.ServiceProxy
{
}
public BS.Shared.DataContracts.Feature.AI.AiConfigDC GetAiConfig()
public void HelloWorld()
{
return base.Channel.GetAiConfig();
}
public BS.Shared.DataContracts.Feature.AI.AiConfigDC UpdateAiConfig(BS.Shared.DataContracts.Feature.AI.AiConfigDC toUpdate)
{
return base.Channel.UpdateAiConfig(toUpdate);
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiModelDC> GetAiModels()
{
return base.Channel.GetAiModels();
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(int uicontext)
{
return base.Channel.GetAiConversations(uicontext);
}
public BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, long modell_oid)
{
return base.Channel.CreateAiConversation(conversation, modell_oid);
}
public System.Collections.Generic.List<BS.Shared.DataContracts.AiConversationMessageDC> SendNewMessage(long conversation, string message)
{
return base.Channel.SendNewMessage(conversation, message);
base.Channel.HelloWorld();
}
}
}

View File

@@ -64,7 +64,8 @@ namespace BeWo.ServiceProxy
{ typeof(IMailService), new EndpointAddress(_ServerName + "MailService.svc") },
{ typeof(IAccountingService), new EndpointAddress(_ServerName + "AccountingService.svc") },
{ typeof(IGkvAccountingService), new EndpointAddress(_ServerName + "GkvAccountingService.svc") },
{ typeof(IReportService), new EndpointAddress(_ServerName + "ReportService.svc") }
{ typeof(IReportService), new EndpointAddress(_ServerName + "ReportService.svc") },
{ typeof(IAiEnhancedService), new EndpointAddress(_ServerName + "AiEnhancedService.svc") }
};
}
@@ -74,6 +75,18 @@ namespace BeWo.ServiceProxy
_ProxyCache = new Dictionary<Type, object>();
}
#region AiEnhancedService
public static void DoAiEnhancedServiceSnyc(Action<IAiEnhancedService> pAction)
=> DoSync<AiEnhancedServiceClient, IAiEnhancedService>(pAction);
public static T DoAiEnhancedServiceSnyc<T>(Func<IAiEnhancedService, T> pFunc)
=> DoSync<AiEnhancedServiceClient, IAiEnhancedService, T>(pFunc);
public static void DoAiEnhancedServiceAsnyc(Action<IAiEnhancedService> pAction, Action pCallback = null, bool showWaitDialog = true, UserControl caller = null)
=> DoAsync<AiEnhancedServiceClient, IAiEnhancedService>(pAction, pCallback, showWaitDialog, caller?.Dispatcher);
public static void DoAiEnhancedServiceAsnyc<T>(Func<IAiEnhancedService, T> pFunc, Action<T> pCallback = null, bool showWaitDialog = true, UserControl caller = null)
=> DoAsync<AiEnhancedServiceClient, IAiEnhancedService, T>(pFunc, pCallback, showWaitDialog, caller?.Dispatcher);
#endregion
#region OperationsEnhancedService
public static void DoOperationsEnhancedServiceSnyc(Action<IOperationsEnhancedService> pAction)
=> DoSync<OperationsEnhancedServiceClient, IOperationsEnhancedService>(pAction);
public static T DoOperationsEnhancedServiceSnyc<T>(Func<IOperationsEnhancedService, T> pFunc)
@@ -82,6 +95,8 @@ namespace BeWo.ServiceProxy
=> DoAsync<OperationsEnhancedServiceClient, IOperationsEnhancedService>(pAction, pCallback, showWaitDialog, caller?.Dispatcher);
public static void DoOperationsEnhancedServiceAsnyc<T>(Func<IOperationsEnhancedService, T> pFunc, Action<T> pCallback = null, bool showWaitDialog = true, UserControl caller = null)
=> DoAsync<OperationsEnhancedServiceClient, IOperationsEnhancedService, T>(pFunc, pCallback, showWaitDialog, caller?.Dispatcher);
#endregion
public static void DoAccountingServiceAsync<T>(Func<IAccountingService, T> pFunc, Action<T> pCallBack, bool showWaitDialog)
{

View File

@@ -55,7 +55,7 @@ namespace BeWo.View.Detail.AI
private void OpenAiSetting()
{
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiModels(), (x) =>
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiModels(), (x) =>
{
ViewModel.Models.MakeEqualTo(x);
popup_settings.IsOpen = true;

View File

@@ -30,7 +30,7 @@ namespace BeWo.View.Master
{
InitializeComponent();
OpenAiSettingCommand = new DelegateCommand(OpenAiSetting);
//OpenAiSettingCommand = new DelegateCommand(OpenAiSetting);
}
public AiConversationListVM ViewModel
@@ -48,16 +48,16 @@ namespace BeWo.View.Master
private void ReloadButton_OnClick(object sender, RoutedEventArgs e)
{
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiModels(), (x) => { ViewModel.Models.MakeEqualTo(x); }, true, this);
//ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiModels(), (x) => { ViewModel.Models.MakeEqualTo(x); }, true, this);
}
public void OpenAiSetting()
{
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiModels(), (x) =>
{
ViewModel.Models.MakeEqualTo(x);
popup_settings.IsOpen = true;
}, true, this);
//ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiModels(), (x) =>
//{
// ViewModel.Models.MakeEqualTo(x);
// popup_settings.IsOpen = true;
//}, true, this);
}
}
}

View File

@@ -117,7 +117,7 @@ namespace BeWo.ViewModel.ListViewModel
conv.UIContext = UIContext;
conv.ContextBeWoObjects = ContextBeWoObjects;
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.CreateAiConversation(conv, Config.SelectedModel.Oid.Value), dc => {
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.CreateAiConversation(conv, Config.SelectedModel.Oid.Value), dc => {
var vm = new AiConversationVM(dc);
VMList.Insert(0, vm);
SelectedVM = vm;
@@ -137,7 +137,7 @@ namespace BeWo.ViewModel.ListViewModel
conv.Messages.VMList.Add(msg_vm);
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.SendNewMessage(conv.DataContract.Oid.Value, MessageInput), (messages) =>
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.SendNewMessage(conv.DataContract.Oid.Value, MessageInput), (messages) =>
{
if (messages.Count != 2)
throw new InvalidOperationException("message count: " + messages.Count);
@@ -188,7 +188,7 @@ namespace BeWo.ViewModel.ListViewModel
private void ReloadConfig()
{
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiConfig(), (x) =>
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiConfig(), (x) =>
{
if (Config is null)
Config = new AiConfigVM(x);
@@ -201,7 +201,7 @@ namespace BeWo.ViewModel.ListViewModel
if (!Config.IsDirty)
return;
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.UpdateAiConfig(Config.CommitToDataContract()), (x) =>
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.UpdateAiConfig(Config.CommitToDataContract()), (x) =>
{
Config.Update(x);
});
@@ -209,7 +209,7 @@ namespace BeWo.ViewModel.ListViewModel
private void ReloadModels()
{
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiModels(), (x) =>
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiModels(), (x) =>
{
Models.MakeEqualTo(x);
@@ -221,7 +221,7 @@ namespace BeWo.ViewModel.ListViewModel
{
var ui_context = UIContext;
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiConversations(ui_context), (x) =>
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiConversations(ui_context), (x) =>
{
x.Reverse();
var vms = new AiConversationListVM(x);

View File

@@ -48,6 +48,7 @@
<endpoint binding="basicHttpBinding" bindingConfiguration="BeWoBasicEndpoint" contract="BeWo.ServiceProxy.IMailService" name="MailServiceEndpoint" />
<endpoint binding="basicHttpBinding" bindingConfiguration="BeWoBasicEndpoint" contract="BeWo.ServiceProxy.IReportService" name="ReportServiceEndpoint" />
<endpoint binding="basicHttpBinding" bindingConfiguration="BeWoBasicEndpoint" contract="BeWo.ServiceProxy.IOperationsEnhancedService" name="OperationsEnhancedServiceEndpoint" />
<endpoint binding="basicHttpBinding" bindingConfiguration="BeWoBasicEndpoint" contract="BeWo.ServiceProxy.IAiEnhancedService" name="AiEnhancedServiceEndpoint" />
</client>
<behaviors>
<endpointBehaviors>

View File

@@ -15,6 +15,8 @@ namespace BeWo.Service.ServiceContracts
[ServiceContract]
public interface IOperationsEnhancedService : IService
{
[FaultContract(typeof(BeWoFault))]
[OperationContract]
void HelloWorld();
}
}

View File

@@ -26,6 +26,9 @@ namespace BeWo.Service.ServiceImplementations
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class OperationsEnhancedServiceImp : IOperationsEnhancedService
{
public void HelloWorld()
{
throw new NotImplementedException();
}
}
}