EDMIService: Rework NewFile and SetAttributeValue

This commit is contained in:
Jonathan Jenne 2021-11-29 11:07:46 +01:00
parent 2bd54ccad0
commit 23aad7e9c0
28 changed files with 847 additions and 203 deletions

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E3DA65CA-964D-4896-991A-B5426884E215}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>EDMIService.Tests</RootNamespace>
<AssemblyName>EDMIService.Tests</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Windows</MyType>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>EDMIService.Tests.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>EDMIService.Tests.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
<Import Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
</ItemGroup>
<ItemGroup>
<Compile Include="UnitTest1.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets')" />
</Project>

View File

@ -0,0 +1,13 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On

View File

@ -0,0 +1,10 @@
<?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>false</MySubMain>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>1</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@ -0,0 +1,18 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
<Assembly: AssemblyTitle("EDMIService.Tests")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("EDMIService.Tests")>
<Assembly: AssemblyCopyright("Copyright © 2021")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
<Assembly: Guid("c5632245-ccc9-4105-ba63-257343d0199c")>
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -0,0 +1,62 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
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.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("EDMIService.Tests.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</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)
resourceCulture = value
End Set
End Property
End Module
End Namespace

View File

@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.EDMIService.Tests.My.MySettings
Get
Return Global.EDMIService.Tests.My.MySettings.Default
End Get
End Property
End Module
End Namespace

View File

@ -0,0 +1,7 @@
<?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>
<Settings />
</SettingsFile>

View File

@ -0,0 +1,9 @@
Imports System.Text
Imports Microsoft.VisualStudio.TestTools.UnitTesting
<TestClass()> Public Class UnitTest1
<TestMethod()> Public Sub TestMethod1()
End Sub
End Class

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="2.1.1" targetFramework="net472" />
<package id="MSTest.TestFramework" version="2.1.1" targetFramework="net472" />
</packages>

View File

@ -0,0 +1,11 @@
Imports DigitalData.Modules.Logging
Public Class BaseClass
Friend LogConfig As LogConfig
Friend Logger As Logger
Public Sub New(pLogConfig As LogConfig)
LogConfig = pLogConfig
Logger = pLogConfig.GetLogger()
End Sub
End Class

View File

@ -0,0 +1,26 @@
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Imports DigitalData.Services.EDMIService.IDB
Public MustInherit Class BaseMethod
Inherits BaseClass
Friend ReadOnly Database As MSSQLServer
Friend ReadOnly Helpers As Helpers
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer)
MyBase.New(pLogConfig)
Database = pMSSQLServer
Helpers = New Helpers(pLogConfig, pMSSQLServer)
End Sub
Public Function LogAndThrow(pMessage As String)
Logger.Warn(pMessage)
Throw New ApplicationException(pMessage)
End Function
Public Function LogAndThrow(pException As Exception)
Logger.Error(pException)
Throw pException
End Function
End Class

View File

@ -11,6 +11,7 @@ Imports DigitalData.Modules.EDMI.API.Rights
Imports DigitalData.Services.EDMIService.Exceptions Imports DigitalData.Services.EDMIService.Exceptions
Imports DigitalData.Services.EDMIService.GlobalState Imports DigitalData.Services.EDMIService.GlobalState
Imports DigitalData.Services.EDMIService.FileStorage Imports DigitalData.Services.EDMIService.FileStorage
Imports DigitalData.Services.EDMIService.FileStorage.SetAttributeValue
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)> <ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
Public Class EDMIService Public Class EDMIService
@ -33,6 +34,9 @@ Public Class EDMIService
Private ReadOnly _Debug As Boolean = False Private ReadOnly _Debug As Boolean = False
Private ReadOnly _Username As String Private ReadOnly _Username As String
Private _IDBHelpers As IDB.Helpers
Public Shared Sub Configure(Config As ServiceConfiguration) Public Shared Sub Configure(Config As ServiceConfiguration)
Dim oBaseAddress = Config.BaseAddresses.Item(0) Dim oBaseAddress = Config.BaseAddresses.Item(0)
Dim oBinding = EDMI.API.Channel.GetBinding() Dim oBinding = EDMI.API.Channel.GetBinding()
@ -53,111 +57,21 @@ Public Class EDMIService
_Username = oUsername _Username = oUsername
_Logger = LogConfig.GetLogger() _Logger = LogConfig.GetLogger()
_Logger.Debug("New Request by User [{0}]", _Username) _Logger.Debug("New Request by User [{0}]", _Username)
_IDBHelpers = New IDB.Helpers(LogConfig, MSSQL_IDB)
End Sub End Sub
Public Function NewFile(Data As NewFile.NewFileRequest) As NewFile.NewFileResponse Implements IEDMIService.NewFile Public Function NewFile(Data As NewFile.NewFileRequest) As NewFile.NewFileResponse Implements IEDMIService.NewFile
_Logger.Debug("Start of Method [NewFile]") _Logger.Debug("Start of Method [NewFile]")
Dim oNewFile As New NewFileMethod(LogConfig, MSSQL_IDB, GlobalState.ObjectStores)
Try Return oNewFile.Run(Data)
Dim oNewObjectIdSQL = $"DECLARE @NEW_IDB_OBJ_ID BIGINT
EXEC PRIDB_NEW_OBJECT '{Data.KindType}','{Data.Who}','{Data.BusinessEntity}',0, @IDB_OBJ_ID = @NEW_IDB_OBJ_ID OUTPUT;
SELECT @NEW_IDB_OBJ_ID"
Dim oObjectId As Long = MSSQL_IDB.GetScalarValue(oNewObjectIdSQL)
_Logger.Info("New Object with Id [{0}] created!", oObjectId)
If IsNothing(oObjectId) Then
LogAndThrow("Could not create new ObjectId!")
End If
'---------------------------------------------------------------------------
' Find ObjectStore by Title
_Logger.Debug("Checking for DataStore [{0}].", Data.StoreName)
Dim oStore = GlobalState.ObjectStores.
Where(Function(store) store.Path.Equals(Data.StoreName, StringComparison.OrdinalIgnoreCase)).
SingleOrDefault()
If oStore Is Nothing Then
LogAndThrow($"DataStore [{Data.StoreName}] does not exist. Exiting.")
End If
' Get Store base path
Dim oBasePath As String = oStore.Path
_Logger.Debug("Store BasePath is [{0}]", oBasePath)
' Get directory by DateImported or, if not supplied, by current date
Dim oSubDirectory As String
If IsNothing(Data.FileImportedAt) Then
oSubDirectory = GetDateSubDirectory(Now)
Else
oSubDirectory = GetDateSubDirectory(Data.FileImportedAt)
End If
_Logger.Debug("Subdirectory is [{0}]", oSubDirectory)
' Check and create final path, if necessary
Dim oFinalPath = Path.Combine(oBasePath, oSubDirectory)
If Not Directory.Exists(oFinalPath) Then
Try
_Logger.Debug("Path does not exist, creating: [{0}]", oFinalPath)
Directory.CreateDirectory(oFinalPath)
_Logger.Debug("Created folder [{0}]", oFinalPath)
Catch ex As Exception
Throw GetFault(ex)
End Try
End If
_Logger.Debug("Final Directory is [{0}]", oFinalPath)
' Get filename
Dim oKeepFileName As Boolean = False
If oStore.IsArchive Then
_Logger.Debug("Object Store is an archive: [{0}]", oStore.IsArchive)
oKeepFileName = True
End If
Dim oFileName As String = GetFileObjectFileName(oObjectId, Data.FileName, oKeepFileName)
_Logger.Debug("Filename is [{0}]", oFileName)
Dim oFileObjectPath As String = Path.Combine(oFinalPath, oFileName)
Dim oFileObjectInfo As FileInfo = New FileInfo(oFileObjectPath)
Dim oFileObjectSize As Long = Data.FileContents.Length
Dim oFileObjectExtension As String = oFileObjectInfo.Extension.Substring(1)
Dim oFileObjectName As String = oFileObjectInfo.Name
_Logger.Debug("File Information for [{0}]:", oFileObjectName)
_Logger.Debug("Size: [{0}]", oFileObjectSize)
_Logger.Debug("Extension: [{0}]", oFileObjectExtension)
_Logger.Debug("Checksum: [{0}]", Data.FileChecksum)
Try
Using oStream = New FileStream(oFileObjectPath, FileMode.Create, FileAccess.Write)
_Logger.Info("ImportFile: Saving file to path [{0}]", oFileObjectPath)
_Logger.Info("ImportFile: Content Length: {0}", oFileObjectSize)
oStream.Write(Data.FileContents, 0, oFileObjectSize)
oStream.Flush(True)
oStream.Close()
End Using
Catch ex As Exception
_Logger.Error(ex)
LogAndThrow("Could not write file to disk!")
End Try
' Insert into DB
Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{oFileObjectPath}', '{oFileObjectName}', '{oFileObjectExtension}',{oFileObjectSize},{Data.FileChecksum} ,'{Data.Who}','{oObjectId}',{oStore.Id}"
Dim oResult As Boolean = MSSQL_IDB.ExecuteNonQuery(oSQL)
If oResult = False Then
LogAndThrow("IDB FileObject could not be created!")
End If
Return New NewFile.NewFileResponse(oObjectId)
Catch ex As FaultException
Return New NewFile.NewFileResponse(ex)
End Try
End Function End Function
Public Function SetAttributeValue(Data As SetAttributeValue.SetAttributeValueRequest) As SetAttributeValue.SetAttributeValueResponse Implements IEDMIService.SetAttributeValue
_Logger.Debug("Start of Method [SetAttributeValue]")
Dim oSetAttributeValue As New SetAttributeValueMethod(LogConfig, MSSQL_IDB)
Return oSetAttributeValue.Run(Data)
End Function
#Region "=== Heartbeat ===" #Region "=== Heartbeat ==="
Public Function Heartbeat() As Boolean Implements IEDMIService.Heartbeat Public Function Heartbeat() As Boolean Implements IEDMIService.Heartbeat
@ -544,23 +458,17 @@ Public Class EDMIService
Public Function TestObjectIdExists(Data As TestObjectIdExistsRequest) As TestObjectIdExistsResponse Implements IEDMIService.TestObjectIdExists Public Function TestObjectIdExists(Data As TestObjectIdExistsRequest) As TestObjectIdExistsResponse Implements IEDMIService.TestObjectIdExists
Try Try
Dim oSQL As String = $"SELECT IDB_OBJ_ID, ACTIVE, DELETED FROM TBIDB_OBJECT WHERE IDB_OBJ_ID = {Data.ObjectId}" Dim oDeleted As Boolean = False
Dim oTable As DataTable = MSSQL_IDB.GetDatatable(oSQL) Dim oActive As Boolean = False
If IsNothing(oTable) OrElse oTable.Rows.Count = 0 Then If _IDBHelpers.TestObjectIdExists(Data.ObjectId, oDeleted, oActive) = False Then
_Logger.Warn("ObjectId {0} does not exist")
Return New TestObjectIdExistsResponse(False) Return New TestObjectIdExistsResponse(False)
End If End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oActive = Utils.NotNull(oRow.Item("ACTIVE"), False)
Dim oDeleted = Utils.NotNull(oRow.Item("DELETED"), False)
Return New TestObjectIdExistsResponse(True) With { Return New TestObjectIdExistsResponse(True) With {
.Deleted = oDeleted, .Deleted = oDeleted,
.Inactive = Not oActive .Inactive = Not oActive
} }
Catch ex As Exception Catch ex As Exception
_Logger.Error(ex) _Logger.Error(ex)
Return New TestObjectIdExistsResponse(False) Return New TestObjectIdExistsResponse(False)
@ -574,17 +482,10 @@ Public Class EDMIService
#End Region #End Region
#Region "=== Private ===" #Region "=== Private ==="
Private Function GetFileObjectFileName(IDB_OBJ_ID As Long, pFilename As String, pKeepFilename As Boolean) As String
If pKeepFilename Then
Return pFilename
Else
Return $"{IDB_OBJ_ID}.ddfo"
End If
End Function
Private Function GetDateSubDirectory(pDate As Date) As String
Return Path.Combine(pDate.ToString("yyyy"), pDate.ToString("MM"), pDate.ToString("dd"))
End Function
Private Function GetFault(Exception As Exception) As FaultException Private Function GetFault(Exception As Exception) As FaultException
Dim oFault As New UnexpectedErrorFault(Exception) Dim oFault As New UnexpectedErrorFault(Exception)
@ -674,10 +575,7 @@ Public Class EDMIService
End If End If
End Function End Function
Private Function LogAndThrow(pMessage As String)
_Logger.Warn(pMessage)
Throw New ApplicationException(pMessage)
End Function
#End Region #End Region

View File

@ -127,18 +127,24 @@
<Import Include="System.Threading.Tasks" /> <Import Include="System.Threading.Tasks" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BaseClass.vb" />
<Compile Include="BaseMethod.vb" />
<Compile Include="ClassConstants.vb" /> <Compile Include="ClassConstants.vb" />
<Compile Include="Config.vb" /> <Compile Include="Config.vb" />
<Compile Include="Filestorage\NewFile\NewFileMethod.vb" />
<Compile Include="Filestorage\NewFile\NewFileRequest.vb" /> <Compile Include="Filestorage\NewFile\NewFileRequest.vb" />
<Compile Include="Filestorage\NewFile\NewFileResponse.vb" /> <Compile Include="Filestorage\NewFile\NewFileResponse.vb" />
<Compile Include="Filestorage\SetAttributeValue\SetAttributeValueMethod.vb" />
<Compile Include="Filestorage\SetAttributeValue\SetAttributeValueResponse.vb" />
<Compile Include="Filestorage\SetAttributeValue\SetAttributeValueRequest.vb" />
<Compile Include="GlobalState.vb" /> <Compile Include="GlobalState.vb" />
<Compile Include="Helpers\AccessRightResult.vb" /> <Compile Include="IDB\Helpers.vb" />
<Compile Include="Helpers\Messages.vb" /> <Compile Include="Messages\AccessRightResult.vb" />
<Compile Include="Helpers\BaseResponse.vb" /> <Compile Include="Messages\Messages.vb" />
<Compile Include="Helpers\Exceptions.vb" /> <Compile Include="Messages\BaseResponse.vb" />
<Compile Include="Helpers\DatabaseResult.vb" /> <Compile Include="Exceptions.vb" />
<Compile Include="Messages\DatabaseResult.vb" />
<Compile Include="EDMIService.vb" /> <Compile Include="EDMIService.vb" />
<Compile Include="Helpers\TraceSwitch.vb" />
<Compile Include="Scheduler\Scheduler.vb" /> <Compile Include="Scheduler\Scheduler.vb" />
<Compile Include="Scheduler\DatatableJob.vb" /> <Compile Include="Scheduler\DatatableJob.vb" />
<Compile Include="Scheduler\JobListener.vb" /> <Compile Include="Scheduler\JobListener.vb" />

View File

@ -0,0 +1,200 @@
Imports System.Data.SqlClient
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Database.MSSQLServer.TransactionMode
Imports DigitalData.Modules.Logging
Imports DigitalData.Services.EDMIService.FileStorage
Imports DigitalData.Services.EDMIService.GlobalState
Public Class NewFileMethod
Inherits BaseMethod
Private ReadOnly ObjectStores As List(Of ObjectStore)
Private ReadOnly Connection As SqlConnection
Private ReadOnly Transaction As SqlTransaction
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer, pObjectStores As List(Of ObjectStore))
MyBase.New(pLogConfig, pMSSQLServer)
ObjectStores = pObjectStores
Connection = Database.GetConnection()
Transaction = Connection.BeginTransaction()
End Sub
Public Function Run(pData As NewFile.NewFileRequest) As NewFile.NewFileResponse
Dim oConnection As SqlConnection = Nothing
Dim oTransaction As SqlTransaction = Nothing
Dim oFilePath As String = Nothing
Dim oExistingObjectId = TestFileChecksumExists(pData.FileChecksum)
If oExistingObjectId > 0 Then
Return New NewFile.NewFileResponse(oExistingObjectId)
End If
Try
Dim oObjectId = NewObjectId(pData.KindType, pData.BusinessEntity, pData.Who)
If oObjectId = 0 Then
LogAndThrow("Could not create new ObjectId!")
End If
' Find ObjectStore by Title
Logger.Debug("Checking for DataStore [{0}].", pData.StoreName)
Dim oStore = ObjectStores.
Where(Function(store) store.Title.Equals(pData.StoreName, StringComparison.OrdinalIgnoreCase)).
SingleOrDefault()
If oStore Is Nothing Then
LogAndThrow($"DataStore [{pData.StoreName}] does not exist. Exiting.")
End If
' Get Store base path
Dim oBasePath As String = oStore.Path
Logger.Debug("Store BasePath is [{0}]", oBasePath)
' Get directory by DateImported or, if not supplied, by current date
Dim oSubDirectory As String
If IsNothing(pData.FileImportedAt) Then
oSubDirectory = GetDateSubDirectory(Now)
Else
oSubDirectory = GetDateSubDirectory(pData.FileImportedAt)
End If
Logger.Debug("Subdirectory is [{0}]", oSubDirectory)
' Check and create final path, if necessary
Dim oFinalPath = IO.Path.Combine(oBasePath, oSubDirectory)
If Not IO.Directory.Exists(oFinalPath) Then
Try
Logger.Debug("Path does not exist, creating: [{0}]", oFinalPath)
IO.Directory.CreateDirectory(oFinalPath)
Logger.Debug("Created folder [{0}]", oFinalPath)
Catch ex As Exception
LogAndThrow(ex)
End Try
End If
Logger.Debug("Final Directory is [{0}]", oFinalPath)
' Get filename
Dim oKeepFileName As Boolean = False
If oStore.IsArchive Then
Logger.Debug("Object Store is an archive: [{0}]", oStore.IsArchive)
oKeepFileName = True
End If
Dim oFileName As String = GetFileObjectFileName(oObjectId, pData.FileName, oKeepFileName)
Logger.Debug("Filename is [{0}]", oFileName)
oFilePath = IO.Path.Combine(oFinalPath, oFileName)
Dim oFileObjectInfo As IO.FileInfo = New IO.FileInfo(oFilePath)
Dim oFileObjectSize As Long = pData.FileContents.Length
Dim oFileObjectExtension As String = oFileObjectInfo.Extension.Substring(1)
Dim oFileObjectName As String = oFileObjectInfo.Name
Logger.Debug("File Information for [{0}]:", oFileObjectName)
Logger.Debug("Size: [{0}]", oFileObjectSize)
Logger.Debug("Extension: [{0}]", oFileObjectExtension)
Logger.Debug("Checksum: [{0}]", pData.FileChecksum)
Try
Using oStream = New IO.FileStream(oFilePath, IO.FileMode.Create, IO.FileAccess.Write)
Logger.Info("Saving file to path [{0}]", oFilePath)
oStream.Write(pData.FileContents, 0, oFileObjectSize)
oStream.Flush(True)
oStream.Close()
End Using
Catch ex As Exception
Logger.Error(ex)
LogAndThrow($"Could not write file [{oFilePath}] to disk!")
End Try
'---------------------------------------------------------------------------
Logger.Info("Creating IDB FileObject for ObjectId [{0}].", oObjectId)
' Insert into DB
Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{oFinalPath}', '{oFileObjectName}', '{oFileObjectExtension}',{oFileObjectSize},'{pData.FileChecksum}' ,'{pData.Who}','{oObjectId}',{oStore.Id}"
Dim oResult As Boolean = Database.ExecuteNonQueryWithConnectionObject(oSQL,
oConnection,
MSSQLServer.TransactionMode.ExternalTransaction,
oTransaction)
If oResult = False Then
LogAndThrow("IDB FileObject could not be created!")
End If
' Finally, commit the transaction
oTransaction?.Commit()
Return New NewFile.NewFileResponse(oObjectId)
Catch ex As Exception
Logger.Warn("Error occurred while importing file!")
Logger.Error(ex)
Logger.Info("Cleaning up files.")
If Not IsNothing(oFilePath) AndAlso IO.File.Exists(oFilePath) Then
Try
IO.File.Delete(oFilePath)
Catch exInner As Exception
Logger.Warn("Error while cleaning up files.")
Logger.Error(exInner)
End Try
End If
Logger.Info("Rolling back transaction.")
oTransaction?.Rollback()
Return New NewFile.NewFileResponse(ex)
End Try
End Function
Private Function TestFileChecksumExists(pChecksum As String) As Long
Try
Dim oChecksumSQL = $"SELECT IDB_OBJ_ID FROM TBIDB_FILE_OBJECT WHERE FILE_HASH = '{pChecksum}'"
Dim oExistingObjectId As Long = Database.GetScalarValue(oChecksumSQL)
If oExistingObjectId > 0 Then
Logger.Info("Returning early with ObjectId [{0}] because Checksum [{1}] already exists.", oExistingObjectId, pChecksum)
Return oExistingObjectId
End If
Return Nothing
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
Private Function NewObjectId(pKindType As String, pBusinessEntity As String, pWho As String) As Long
Try
Dim oNewObjectIdSQL = $"DECLARE @NEW_IDB_OBJ_ID BIGINT
EXEC PRIDB_NEW_OBJECT '{pKindType}','{pWho}','{pBusinessEntity}',0, @IDB_OBJ_ID = @NEW_IDB_OBJ_ID OUTPUT;
SELECT @NEW_IDB_OBJ_ID"
Dim oObjectId As Long = Database.GetScalarValueWithConnectionObject(oNewObjectIdSQL, Connection, ExternalTransaction, Transaction)
Logger.Info("New Object with Id [{0}] created!", oObjectId)
If IsNothing(oObjectId) Then
LogAndThrow("Could not create new ObjectId!")
End If
Return oObjectId
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
Private Function GetFileObjectFileName(IDB_OBJ_ID As Long, pFilename As String, pKeepFilename As Boolean) As String
If pKeepFilename Then
Return pFilename
Else
Return $"{IDB_OBJ_ID}.ddfo"
End If
End Function
Private Function GetDateSubDirectory(pDate As Date) As String
Return IO.Path.Combine(pDate.ToString("yyyy"), pDate.ToString("MM"), pDate.ToString("dd"))
End Function
End Class

View File

@ -1,9 +1,9 @@
Imports System.Runtime.Serialization Imports System.Runtime.Serialization
Namespace FileStorage.NewFile Namespace FileStorage.SetAttributeValue
<Serializable> <Serializable>
<DataContract> <DataContract>
Public Class NewFileResponse Public Class SetAttributeValueResponse
Inherits Messages.BaseResponse Inherits Messages.BaseResponse
<DataMember> <DataMember>
@ -14,8 +14,8 @@ Namespace FileStorage.NewFile
ObjectId = pObjectId ObjectId = pObjectId
End Sub End Sub
Public Sub New(pException As Exception) Public Sub New(pException As Exception, Optional pDetails As String = "")
MyBase.New(pException) MyBase.New(pException, pDetails)
End Sub End Sub
End Class End Class

View File

@ -0,0 +1,31 @@
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Database
Imports DigitalData.Services.EDMIService.IDB
Namespace FileStorage.SetAttributeValue
Public Class SetAttributeValueMethod
Inherits BaseMethod
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer)
MyBase.New(pLogConfig, pDatabase)
End Sub
Public Function Run(pData As SetAttributeValueRequest) As SetAttributeValueResponse
Try
If Helpers.TestObjectIdExists(pData.ObjectId) = False Then
LogAndThrow("ObjectId does not exist!")
End If
'TODO: Finish
Return New SetAttributeValueResponse(pData.ObjectId)
Catch ex As Exception
Logger.Warn("Error occurred while setting attribute value!")
Return New SetAttributeValueResponse(ex)
End Try
End Function
End Class
End Namespace

View File

@ -0,0 +1,23 @@
Imports System.Runtime.Serialization
Namespace FileStorage.SetAttributeValue
<Serializable>
<DataContract>
Public Class SetAttributeValueRequest
''' <summary>
''' Object Id
''' </summary>
<DataMember>
Public Property ObjectId As Long
<DataMember>
Public Property AttributeName As String
<DataMember>
Public Property AttributeValue As String
<DataMember>
Public Property Who As Long
End Class
End Namespace

View File

@ -0,0 +1,22 @@
Imports System.Runtime.Serialization
Namespace FileStorage.NewFile
<Serializable>
<DataContract>
Public Class NewFileResponse
Inherits Messages.BaseResponse
<DataMember>
Public Property ObjectId As Long
Public Sub New(pObjectId As Long)
MyBase.New()
ObjectId = pObjectId
End Sub
Public Sub New(pException As Exception, Optional pDetails As String = "")
MyBase.New(pException, pDetails)
End Sub
End Class
End Namespace

View File

@ -1,34 +0,0 @@
Public Class TraceSwitch
Inherits SourceSwitch
Public Sub New(Name As String)
MyBase.New("System.ServiceModel")
Level = SourceLevels.Information
WcfTracesController.Instance.LevelController = AddressOf WcfTracesLevelController
End Sub
Public Sub WcfTracesLevelController(ByVal level As SourceLevels)
Me.Level = level
End Sub
End Class
Public Class WcfTracesController
Private Shared Controller As WcfTracesController = Nothing
Private Sub New()
End Sub
Public Delegate Sub TraceLevelController(ByVal level As SourceLevels)
Public LevelController As TraceLevelController
Public Shared ReadOnly Property Instance As WcfTracesController
Get
If Controller Is Nothing Then
Controller = New WcfTracesController()
End If
Return Controller
End Get
End Property
End Class

View File

@ -0,0 +1,44 @@
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Language
Imports DigitalData.Modules.Logging
Imports DigitalData.Services.EDMIService.Messages
Namespace IDB
Public Class Helpers
Inherits BaseClass
Private MSSQLServer As MSSQLServer
Public Sub New(pLogConfig As LogConfig, pMSSQLServer As MSSQLServer)
MyBase.New(pLogConfig)
MSSQLServer = pMSSQLServer
End Sub
Public Function TestObjectIdExists(pObjectId As Long, Optional ByRef IsDeleted As Boolean = False, Optional ByRef IsActive As Boolean = False) As Boolean
Try
Dim oSQL As String = $"SELECT IDB_OBJ_ID, ACTIVE, DELETED FROM TBIDB_OBJECT WHERE IDB_OBJ_ID = {pObjectId}"
Dim oTable As DataTable = MSSQLServer.GetDatatable(oSQL)
If IsNothing(oTable) OrElse oTable.Rows.Count = 0 Then
Logger.Warn("ObjectId {0} does not exist")
Return False
End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oActive = Utils.NotNull(oRow.Item("ACTIVE"), False)
Dim oDeleted = Utils.NotNull(oRow.Item("DELETED"), False)
IsDeleted = oDeleted
IsActive = oActive
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
End Class
End Namespace

View File

@ -66,6 +66,9 @@ Interface IEDMIService
<OperationContract> <OperationContract>
Function NewFile(Data As NewFile.NewFileRequest) As NewFile.NewFileResponse Function NewFile(Data As NewFile.NewFileRequest) As NewFile.NewFileResponse
<OperationContract>
Function SetAttributeValue(Data As SetAttributeValue.SetAttributeValueRequest) As SetAttributeValue.SetAttributeValueResponse
'----------------------------------------------------- '-----------------------------------------------------
' Everything below this line is subject to change! ' Everything below this line is subject to change!
'----------------------------------------------------- '-----------------------------------------------------

View File

@ -9,6 +9,8 @@ Namespace Messages
Public Property OK As Boolean Public Property OK As Boolean
<DataMember> <DataMember>
Public Property ErrorMessage As String Public Property ErrorMessage As String
<DataMember>
Public Property ErrorDetails As String
Public Sub New() Public Sub New()
OK = True OK = True
@ -23,6 +25,12 @@ Namespace Messages
OK = False OK = False
ErrorMessage = Exception.Message ErrorMessage = Exception.Message
End Sub End Sub
Public Sub New(Exception As Exception, Details As String)
OK = False
ErrorMessage = Exception.Message
ErrorDetails = Details
End Sub
End Class End Class
End Namespace End Namespace

View File

@ -38,23 +38,9 @@ Public Class WindowsService
Try Try
Dim oServicePath As String = AppDomain.CurrentDomain.BaseDirectory Dim oServicePath As String = AppDomain.CurrentDomain.BaseDirectory
_LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"), Nothing, Nothing, Nothing, 3) _LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"), FileKeepRangeInDays:=3)
_Logger = _LogConfig.GetLogger() _Logger = _LogConfig.GetLogger()
Try
Dim directory As New IO.DirectoryInfo(_LogConfig.LogDirectory)
For Each file As IO.FileInfo In directory.GetFiles
If (Now - file.CreationTime).Days > 29 Then
file.Delete()
Else
Exit For
End If
Next
Catch ex As Exception
_Logger.Error(ex)
End Try
_Logger.Info("Service {0} is starting...", SERVICE_DISPLAY_NAME) _Logger.Info("Service {0} is starting...", SERVICE_DISPLAY_NAME)
_Logger.Info("ServiceDirectory: {0}", oServicePath) _Logger.Info("ServiceDirectory: {0}", oServicePath)
@ -132,28 +118,6 @@ Public Class WindowsService
End Try End Try
End Sub End Sub
Private Sub UpdateTraceLogging()
Try
' Changing Tracelevels programmatically,
' See: https://wcfpro.wordpress.com/2010/11/21/how-to-add-wcf-traces-programmatically/
_Logger.Debug("UpdateTraceLogging running..")
_Logger.Debug("SourceLevels is off by default")
Dim oTraceLevel = SourceLevels.Off
_Logger.Debug("Debug is currently set to {0}", _ConfigManager.Config.Debug)
If _ConfigManager.Config.Debug Then
oTraceLevel = SourceLevels.Warning
End If
_Logger.Debug("Setting TraceLevel to {0}", oTraceLevel)
WcfTracesController.Instance.LevelController(oTraceLevel)
Catch ex As Exception
_Logger.Warn("TraceLogging could not be updated!")
_Logger.Error(ex)
End Try
End Sub
Private Function StartFirebird() As Firebird Private Function StartFirebird() As Firebird
_Logger.Debug("Connecting to Firebird") _Logger.Debug("Connecting to Firebird")