EDMIService: WIP Relations

This commit is contained in:
Jonathan Jenne 2020-12-11 17:02:32 +01:00
parent 39f05386a3
commit 39f4cc5152
25 changed files with 642 additions and 89 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -6,7 +6,7 @@
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<userSettings>
<TestGUI.My.MySettings>
@ -21,4 +21,16 @@
</setting>
</TestGUI.My.MySettings>
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-7.5.0.0" newVersion="7.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@ -32,7 +32,7 @@ Namespace My
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.TestGUI.Form1
Me.MainForm = Global.TestGUI.frmStart
End Sub
End Class
End Namespace

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>Form1</MainForm>
<MainForm>frmStart</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>

View File

@ -1,27 +1,28 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
@ -32,7 +33,7 @@ Namespace My.Resources
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
@ -46,15 +47,15 @@ Namespace My.Resources
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
Set
resourceCulture = value
End Set
End Property

View File

@ -15,7 +15,7 @@ Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0"), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase

View File

@ -11,8 +11,9 @@
<AssemblyName>TestGUI</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -63,15 +64,38 @@
<HintPath>bin\Debug\DigitalData.Controls.LookupGrid.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.5\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="Quartz, Version=3.2.3.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
<HintPath>..\packages\Quartz.3.2.3\lib\net461\Quartz.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
@ -97,16 +121,16 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationEvents.vb" />
<Compile Include="ConfigTest.Designer.vb">
<DependentUpon>ConfigTest.vb</DependentUpon>
<Compile Include="frmConfigTest.Designer.vb">
<DependentUpon>frmConfigTest.vb</DependentUpon>
</Compile>
<Compile Include="ConfigTest.vb">
<Compile Include="frmConfigTest.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="FolderWatcher.Designer.vb">
<DependentUpon>FolderWatcher.vb</DependentUpon>
<Compile Include="frmFolderWatcher.Designer.vb">
<DependentUpon>frmFolderWatcher.vb</DependentUpon>
</Compile>
<Compile Include="FolderWatcher.vb">
<Compile Include="frmFolderWatcher.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.vb">
@ -116,6 +140,18 @@
<DependentUpon>Form1.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="frmRelations.Designer.vb">
<DependentUpon>frmRelations.vb</DependentUpon>
</Compile>
<Compile Include="frmRelations.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmStart.Designer.vb">
<DependentUpon>frmStart.vb</DependentUpon>
</Compile>
<Compile Include="frmStart.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
@ -133,15 +169,21 @@
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ConfigTest.resx">
<DependentUpon>ConfigTest.vb</DependentUpon>
<EmbeddedResource Include="frmConfigTest.resx">
<DependentUpon>frmConfigTest.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FolderWatcher.resx">
<DependentUpon>FolderWatcher.vb</DependentUpon>
<EmbeddedResource Include="frmFolderWatcher.resx">
<DependentUpon>frmFolderWatcher.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmRelations.resx">
<DependentUpon>frmRelations.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmStart.resx">
<DependentUpon>frmStart.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\licenses.licx" />
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
@ -172,6 +214,10 @@
<Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.Database\Database.vbproj">
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
<Name>Database</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.Filesystem\Filesystem.vbproj">
<Project>{991d0231-4623-496d-8bd0-9ca906029cbc}</Project>
<Name>Filesystem</Name>
@ -184,6 +230,10 @@
<Project>{4c86df8f-a280-40d4-85b0-10b1bf66c15c}</Project>
<Name>Windream</Name>
</ProjectReference>
<ProjectReference Include="..\Service.EDMIService\EDMIService.vbproj">
<Project>{a8c3f298-76ab-4359-ab3c-986e313b4336}</Project>
<Name>EDMIService</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@ -1,5 +1,5 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class ConfigTest
Partial Class frmConfigTest
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.

View File

@ -1,7 +1,7 @@
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Logging
Public Class ConfigTest
Public Class frmConfigTest
Private _LogConfig As LogConfig
Private _config As ConfigManager(Of Config)
Private _FilePath As String = IO.Path.Combine(Application.LocalUserAppDataPath, "UserConfig.xml")

View File

@ -1,5 +1,5 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class FolderWatcher
Partial Class frmFolderWatcher
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.

View File

@ -4,7 +4,7 @@ Imports DigitalData.Modules.Filesystem
Imports DigitalData.Modules.Filesystem.FileWatcherFilters
Imports DigitalData.Modules.Logging
Public Class FolderWatcher
Public Class frmFolderWatcher
Private _LogConfig As LogConfig
Private _Logger As Logger

View File

@ -0,0 +1,37 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmRelations
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.SuspendLayout()
'
'frmRelations
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(800, 450)
Me.Name = "frmRelations"
Me.Text = "frmRelations"
Me.ResumeLayout(False)
End Sub
End Class

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Imports DigitalData.Services.EDMIService
Public Class frmRelations
Private DB As MSSQLServer
Private LogConfig As LogConfig
Private Sub frmRelations_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LogConfig = New LogConfig(LogConfig.PathType.CustomPath, Application.StartupPath)
DB = New MSSQLServer(LogConfig, "Server=SDD-VMP04-SQL17\DD_DEVELOP01;Database=DD_ECM_TEST;User Id=sa;Password=dd;")
Dim oDataSet As New DataSet()
Dim oUsers = DB.GetDatatable("SELECT * FROM TBDD_USER")
oUsers.TableName = "TBDD_USER"
Dim oGroupUser = DB.GetDatatable("SELECT * FROM TBDD_GROUPS_USER")
oGroupUser.TableName = "TBDD_GROUPS_USER"
Dim oCronDetails As DataTable = DB.GetDatatable("SELECT * FROM TBAPPSERV_CRON_DETAIL WHERE DT_NAME = 'TBDD_USER'")
Dim oListener As New DigitalData.Services.EDMIService.JobListener(LogConfig, DB, oDataSet)
oListener.SaveDataTables(New DigitalData.Services.EDMIService.JobResult() With {
.Table = oUsers,
.TableRelationColumn = "GUID",
.ChildTable = oGroupUser,
.ChildRelationColumn = "USER_ID"
}, oCronDetails.Rows.Item(0))
End Sub
End Class

50
GUIs.Test.TestGUI/frmStart.Designer.vb generated Normal file
View File

@ -0,0 +1,50 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmStart
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(12, 12)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(236, 55)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Relations"
Me.Button1.UseVisualStyleBackColor = True
'
'frmStart
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(800, 450)
Me.Controls.Add(Me.Button1)
Me.Name = "frmStart"
Me.Text = "frmStart"
Me.ResumeLayout(False)
End Sub
Friend WithEvents Button1 As Button
End Class

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,5 @@
Public Class frmStart
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
frmRelations.Show()
End Sub
End Class

View File

@ -1,4 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net461" />
<package id="NLog" version="4.7.5" targetFramework="net461" />
<package id="Quartz" version="3.2.3" targetFramework="net461" />
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.7.1" targetFramework="net461" />
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net461" />
</packages>

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
</configSections>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information,ActivityTracing" propagateActivity="true">

View File

@ -134,6 +134,7 @@
<Compile Include="Scheduler.vb" />
<Compile Include="Scheduler\DatatableJob.vb" />
<Compile Include="Scheduler\JobListener.vb" />
<Compile Include="Scheduler\JobResult.vb" />
<Compile Include="ServiceHost.vb" />
<Compile Include="WindowsService.vb">
<SubType>Component</SubType>

View File

@ -1,7 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Profiles />
<Settings />
</SettingsFile>

View File

@ -1,5 +1,9 @@
Imports DigitalData.Modules.Database
Option Explicit On
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Language.Utils
Imports DigitalData.Modules.Logging
Imports Quartz
Public Class DatatableJob
@ -9,16 +13,16 @@ Public Class DatatableJob
Dim oJobData = context.MergedJobDataMap
Dim oLogConfig As LogConfig = oJobData.Item("LogConfig")
Dim oLogger As Logger = oLogConfig.GetLogger()
Dim oDetailRow As DataRow = oJobData.Item("CronJobDetails")
Dim oDatatableName As String = NotNull(oDetailRow.Item("DT_NAME"), String.Empty)
Try
Dim oCronJobTitle As String = oJobData.Item("CronJobTitle")
Dim oDetailRow As DataRow = oJobData.Item("CronJobDetails")
Dim oMSSQL As MSSQLServer = oJobData.Item("MSSQL")
Dim oConnectionId As Integer = oDetailRow.Item("CON_ID")
Dim oTitle As String = oDetailRow.Item("TITLE")
Dim oDatatableName As String = oDetailRow.Item("DT_NAME")
Dim oSQL As String = oDetailRow.Item("COMMAND")
Dim oConnectionId As Integer = NotNull(oDetailRow.Item("CON_ID"), String.Empty)
Dim oTitle As String = NotNull(oDetailRow.Item("TITLE"), String.Empty)
Dim oSQL As String = NotNull(oDetailRow.Item("COMMAND"), String.Empty)
oLogger.Debug("Running Command-Job [{0}]", oTitle)
oLogger.Debug("Datatable Name: {0}", oDatatableName)
@ -26,14 +30,35 @@ Public Class DatatableJob
Dim oConnectionString = oMSSQL.Get_ConnectionStringforID(oConnectionId)
Dim oResult = oMSSQL.GetDatatableWithConnection(oSQL, oConnectionString)
oResult.TableName = oDatatableName
oLogger.Debug("Result Datatable contains [{0}] rows", oResult.Rows.Count)
Dim oTable = oMSSQL.GetDatatableWithConnection(oSQL, oConnectionString)
oTable.TableName = oDatatableName
oLogger.Debug("Result Datatable [{0}] contains [{1}] rows", oTable.TableName, oTable.Rows.Count)
Dim oResult = New JobResult() With {
.Table = oTable
}
Dim oChildTableNAme As String = NotNull(oDetailRow.Item("CHILD_DT_NAME"), String.Empty)
If oChildTableNAme <> String.Empty Then
Dim oParentColumn As String = NotNull(oDetailRow.Item("DT_COLUMN"), String.Empty)
Dim oChildColumn As String = NotNull(oDetailRow.Item("CHILD_DT_COLUMN"), String.Empty)
oLogger.Debug("Child Datatable [{0}] defined, Relation: Parent [{1}] -> Child [{2}]", oChildTableName, oParentColumn, oChildColumn)
Dim oChildTable As DataTable = oMSSQL.GetDatatableWithConnection($"SELECT * FROM {oChildTableName}", oConnectionString)
oChildTable.TableName = oChildTableName
oLogger.Debug("Child Datatable [{0}] contains [{1}] rows", oChildTable.TableName, oChildTable.Rows.Count)
oResult.ChildTable = oChildTable
oResult.ChildRelationColumn = oChildColumn
oResult.TableRelationColumn = oParentColumn
End If
' Das Ergebnis speichern
context.Result = oResult
Catch ex As Exception
oLogger.Warn("Unhandled exception while executing SQL for Datatable {}")
oLogger.Error(ex)
oLogger.Warn("Unhandled exception while executing SQL for Datatable {0}", oDatatableName)
End Try
Return Task.FromResult(True)

View File

@ -1,5 +1,8 @@
Imports System.Threading
Option Explicit On
Imports System.Threading
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Language
Imports DigitalData.Modules.Logging
Imports Quartz
Imports Quartz.Listener
@ -23,34 +26,120 @@ Public Class JobListener
Dataset = ResultDataSet
End Sub
Public Overrides Function JobWasExecuted(context As IJobExecutionContext, jobException As JobExecutionException, Optional cancellationToken As CancellationToken = Nothing) As Task
Try
Dim oDataTable As DataTable = context.Result
Dim oDetailRow As DataRow = context.MergedJobDataMap.Item("CronJobDetails")
Dim oDatatableName As String = oDetailRow.Item("DT_NAME")
Dim oDetailId As Integer = oDetailRow.Item("GUID")
Dim oDatatableNameTemp As String = oDatatableName & "-TEMP"
Public Sub ReplaceExistingTable(Name As String, Table As DataTable, DataSet As DataSet)
Dim oDatatableNameTemp As String = Name & "-TEMP"
If Dataset.Tables.Contains(oDatatableName) Then
_Logger.Debug("DataTable [{0}] exists, renaming and replacing in DataSet", oDatatableName)
_Logger.Debug("DataTable [{0}] exists, renaming and replacing in DataSet", Name)
' Rename the new table, add TEMP suffix
oDataTable.TableName = oDatatableNameTemp
Table.TableName = oDatatableNameTemp
' Add the new table to the dataset
Dataset.Tables.Add(oDataTable)
DataSet.Tables.Add(Table)
' Remove the old table
Dataset.Tables.Remove(oDatatableName)
DataSet.Tables.Remove(Name)
' Rename the new table
Dataset.Tables.Item(oDatatableNameTemp).TableName = oDatatableName
Else
_Logger.Debug("DataTable [{0}] does not exist, adding to DataSet", oDatatableName)
Dataset.Tables.Add(oDataTable)
DataSet.Tables.Item(oDatatableNameTemp).TableName = Name
End Sub
Public Sub AddNewTable(Name As String, Table As DataTable, DataSet As DataSet)
_Logger.Debug("DataTable [{0}] does not exist, adding to DataSet", Name)
DataSet.Tables.Add(Table)
End Sub
Public Sub AddRelation(ParentTableName As String, ParentColumnName As String, ChildTableName As String, ChildColumnName As String)
Dim oChild As DataTable = Dataset.Tables.Item(ChildTableName)
Dim oParent As DataTable = Dataset.Tables.Item(ParentTableName)
Dim oRelationName As String = $"{ParentTableName}-{ChildTableName}"
Dim oParentColumn As DataColumn = oParent.Columns.Item(ParentColumnName)
Dim oChildColumn As DataColumn = oChild.Columns.Item(ChildColumnName)
_Logger.Debug("New Relation: {0}/{1} => {2}/{3}", ParentTableName, ParentColumnName, ChildTableName, ChildColumnName)
Try
_Logger.Debug("Creating Relation [{0}]", oRelationName)
_Logger.Debug("ParentColumn exists: {0}", IsNothing(oParentColumn))
_Logger.Debug("ChildColumn exists: {0}", IsNothing(oChildColumn))
Dim oRelation As New DataRelation(oRelationName, oParentColumn, oChildColumn)
_Logger.Debug("Adding Relation [{0}]", oRelationName)
Dataset.Relations.Add(oRelation)
Catch ex As ArgumentNullException
_Logger.Error(ex)
_Logger.Warn("ArgumentNullException in AddRelation: {0}", ex.Message)
Catch ex As DuplicateNameException
_Logger.Error(ex)
_Logger.Warn("DuplicateNameException in AddRelation: {0}", ex.Message)
Catch ex As InvalidConstraintException
_Logger.Error(ex)
_Logger.Warn("DuplicateNameException in AddRelation: {0}", ex.Message)
Catch ex As ArgumentException
_Logger.Error(ex)
_Logger.Warn("ArgumentException in AddRelation: {0}", ex.Message)
Catch ex As Exception
_Logger.Error(ex)
_Logger.Warn("Exception in AddRelation: {0}", ex.Message)
End Try
End Sub
Public Sub SaveDataTables(Result As JobResult, DetailRow As DataRow)
Try
Dim oTable As DataTable = Result.Table
Dim oName As String = DetailRow.Item("DT_NAME")
Dim oDetailId As Integer = DetailRow.Item("GUID")
Dim oDatatableNameTemp As String = oName & "-TEMP"
If Dataset.Tables.Contains(oName) Then
If Result.ChildTable IsNot Nothing Then
ReplaceExistingTable(Result.ChildTable.TableName, Result.ChildTable, Dataset)
End If
ReplaceExistingTable(oName, oTable, Dataset)
If Result.ChildTable IsNot Nothing Then
Dim oRelation = Dataset.Relations.Item($"{oTable.TableName}-{Result.ChildTable.TableName}")
If oRelation IsNot Nothing Then
Dataset.Relations.Remove(oRelation)
End If
AddRelation(oName, Result.TableRelationColumn, Result.ChildTable.TableName, Result.ChildRelationColumn)
End If
Else
AddNewTable(oName, oTable, Dataset)
If Result.ChildTable IsNot Nothing Then
AddNewTable(Result.ChildTable.TableName, Result.ChildTable, Dataset)
AddRelation(oName, Result.TableRelationColumn, Result.ChildTable.TableName, Result.ChildRelationColumn)
End If
End If
_Logger.Debug("Listing Tables in DataSet")
For Each oDataTable As DataTable In Dataset.Tables
_Logger.Debug(oDataTable.TableName)
Next
_Logger.Debug("Listing Relations in Dataset")
For Each oRelation As DataRelation In Dataset.Relations
_Logger.Debug(oRelation.RelationName)
Next
_MSSQL.ExecuteNonQuery($"INSERT INTO TBAPPSERV_CRON_DETAIL_HISTORY (DETAIL_ID) VALUES ({oDetailId})")
Catch ex As Exception
_Logger.Warn("Unexpected error in JobListener: {0}", ex.Message)
_Logger.Error(ex)
End Try
End Sub
Public Overrides Function JobWasExecuted(context As IJobExecutionContext, jobException As JobExecutionException, Optional cancellationToken As CancellationToken = Nothing) As Task
Dim oDetailRow As DataRow = context.MergedJobDataMap.Item("CronJobDetails")
SaveDataTables(context.Result, oDetailRow)
Return MyBase.JobWasExecuted(context, jobException, cancellationToken)
End Function

View File

@ -0,0 +1,6 @@
Public Class JobResult
Public Table As DataTable
Public ChildTable As DataTable
Public TableRelationColumn As String
Public ChildRelationColumn As String
End Class