rename EDMIAPI to EDMI.API, Rename IDBService to EDMIService

This commit is contained in:
Jonathan Jenne 2020-04-06 13:23:11 +02:00
parent 124cfde45e
commit ae12ea21f2
10 changed files with 814 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="DocumentResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.DocumentResult</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="DocumentResult2" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.DocumentResult2</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="IndexResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.IndexResult</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="NonQueryResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.NonQueryResult</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="ScalarResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.ScalarResult</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="TableResult" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>DigitalData.Modules.EDMI.API.IDBServiceReference.TableResult</TypeInfo>
</GenericObjectDataSource>

View File

@ -0,0 +1,186 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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>{5B1171DC-FFFE-4813-A20D-786AAE47B320}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>DigitalData.Modules.EDMI.API</RootNamespace>
<AssemblyName>DigitalData.Modules.EDMI.API</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Windows</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>DigitalData.Modules.EDMI.API.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>DigitalData.Modules.EDMI.API.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.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</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" />
</ItemGroup>
<ItemGroup>
<Compile Include="Channel.vb" />
<Compile Include="Connected Services\IDBServiceReference\Reference.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.svcmap</DependentUpon>
</Compile>
<Compile Include="Constants.vb" />
<Compile Include="Document.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="app.config" />
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.DocumentResult.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.DocumentResult2.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.IndexResult.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.NonQueryResult.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.ScalarResult.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.EDMI.API.IDBServiceReference.TableResult.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
<None Include="Connected Services\IDBServiceReference\DigitalData.Modules.Filesystem.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Connected Services\IDBServiceReference\DigitalData.Services.IDBService.wsdl" />
<None Include="Connected Services\IDBServiceReference\DigitalData.Services.IDBService.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Connected Services\IDBServiceReference\DigitalData.Services.IDBService1.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Connected Services\IDBServiceReference\service.wsdl" />
<None Include="Connected Services\IDBServiceReference\service.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Connected Services\IDBServiceReference\System.Data.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Connected Services\IDBServiceReference\System.IO.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Connected Services\IDBServiceReference\System.xsd">
<SubType>Designer</SubType>
</None>
<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>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
<Name>Logging</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WCFMetadataStorage Include="Connected Services\IDBServiceReference\" />
</ItemGroup>
<ItemGroup>
<None Include="Connected Services\IDBServiceReference\configuration91.svcinfo" />
</ItemGroup>
<ItemGroup>
<None Include="Connected Services\IDBServiceReference\configuration.svcinfo" />
</ItemGroup>
<ItemGroup>
<None Include="Connected Services\IDBServiceReference\Reference.svcmap">
<Generator>WCF Proxy Generator</Generator>
<LastGenOutput>Reference.vb</LastGenOutput>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@ -0,0 +1,341 @@
Imports System.ServiceModel
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Filesystem
Imports DigitalData.Services.EDMIService
Imports System.IO
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
Public Class EDMIService
Implements IEDMIService
Public Shared LogConfig As LogConfig
Public Shared Database As Firebird
Public Shared AppConfig As AppConfig
Private ReadOnly _logger As Logger
Private _request As Request = Nothing
Private _debug As Boolean = False
Private _username As String
Public Sub New()
Dim oOperationContext As OperationContext = OperationContext.Current
Dim oInstanceContext As InstanceContext = oOperationContext.InstanceContext
Dim oUsername = oOperationContext.ServiceSecurityContext.WindowsIdentity.Name
_username = oUsername
_logger = LogConfig.GetLogger()
End Sub
#Region "Auth"
Private Function TestUserAuth() As Boolean
Try
'Dim oSQL As String = $"SELECT FNIDB_AUTH_USER('{_username}') FROM RDB$DATABASE;"
'Dim oResult As Boolean = Database.GetScalarValue(oSQL)
'Return oResult
Return True
Catch ex As Exception
_logger.Error(ex)
Return False
End Try
End Function
#End Region
#Region "Heartbeat"
Public Function Heartbeat() As Boolean Implements IEDMIService.Heartbeat
Return True
End Function
#End Region
#Region "Request"
Public Sub CreateRequest(Name As String, Optional Debug As Boolean = False)
_request = New Request(Name, _username, Database, Debug)
_debug = Debug
_logger.Info("Creating request {0}/{1}", _request.Name, _request.RequestId)
End Sub
Public Function CreateDatabaseRequest(Name As String, Optional Debug As Boolean = False) As String Implements IEDMIService.CreateDatabaseRequest
CreateRequest(Name, Debug)
Return _request.Name
End Function
Public Sub CloseDatabaseRequest() Implements IEDMIService.CloseDatabaseRequest
If IsNothing(_request) Then
Exit Sub
End If
_logger.Info("Closing request {0}", _request.ToString)
_request.Connection.Close()
_request = Nothing
End Sub
#End Region
#Region "Database"
Private Sub TestRequestCreated()
If IsNothing(_request) Then
Throw New Exceptions.NoRequestException()
End If
End Sub
Public Function ReturnDatatable(SQL As String) As TableResult Implements IEDMIService.ReturnDatatable
Try
TestRequestCreated()
_logger.Info($"ReturnDatatable, SQL: {SQL}")
_request.LogDebug($"ReturnDatatable, SQL: {SQL}")
Dim oResult As DataTable = Database.GetDatatableWithConnection(SQL, _request.Connection)
Return New TableResult(oResult)
Catch ex As Exception
_logger.Error(ex)
_request.LogError(ex.Message)
Return New TableResult(ex.Message)
End Try
End Function
Public Function ReturnScalar(SQL As String) As ScalarResult Implements IEDMIService.ReturnScalar
Try
TestRequestCreated()
_logger.Info($"ReturnScalar, SQL: {SQL}")
_request.LogDebug($"ReturnScalar, SQL: {SQL}")
Dim oResult As Object = Database.GetScalarValueWithConnection(SQL, _request.Connection)
Return New ScalarResult(oResult)
Catch ex As Exception
_logger.Error(ex)
_request.LogError(ex.Message)
Return New ScalarResult(ex.Message)
End Try
End Function
Public Function ExecuteNonQuery(SQL As String) As NonQueryResult Implements IEDMIService.ExecuteNonQuery
Try
TestRequestCreated()
_logger.Info($"ExecuteNonQuery, SQL: {SQL}")
_request.LogDebug($"ExecuteNonQuery, SQL: {SQL}")
Dim oResult As Boolean = Database.ExecuteNonQueryWithConnection(SQL, _request.Connection)
Return New NonQueryResult()
Catch ex As Exception
_logger.Error(ex)
_request.LogError(ex.Message)
Return New NonQueryResult(ex.Message)
End Try
End Function
#End Region
#Region "Document (with FileContainer)"
'Public Function NewFile(FileName As String, Contents() As Byte) As DocumentResult Implements IEDMIService.NewFile
' Try
' Dim oContainer As FileContainer
' Dim oContainerId As String
' If Not TestUserAuth() Then
' Throw New Exception($"User {_username} not authorized.")
' End If
' oContainer = FileContainer.Create(LogConfig, AppConfig.ContainerPassword)
' oContainerId = oContainer.ContainerId
' _logger.Debug("Container created with id {0}", oContainerId)
' Dim oExtension As String = Path.GetExtension(FileName).Substring(1)
' _logger.Debug("File extension of file {0} is {1}", FileName, oExtension)
' Dim oSQL = $"SELECT FNICM_NEW_DOC('010', '{oContainerId}', '{GetContainerName(oContainerId)}', '{FileName}', '{oExtension}', '{_username}') FROM RDB$DATABASE;"
' Dim oDocId As Int64 = Database.GetScalarValue(oSQL)
' If oDocId = -1 Then
' _logger.Warn("Database returned -1 while creating Document Entry. File was not saved!")
' Return Nothing
' End If
' _logger.Debug("Database Entry created with DocId {0}", oDocId)
' oContainer.SetFile(Contents, FileName)
' oContainer.SaveAs(GetContainerPath(oContainerId))
' _logger.Debug("File saved in Container!", FileName)
' Dim oDocument = New DocumentObject(oContainerId, oDocId, FileName)
' Return New DocumentResult(oDocument)
' Catch ex As Exception
' _logger.Error(ex)
' Return New DocumentResult(ex.Message)
' End Try
'End Function
'Public Function UpdateFile(DocObject As DocumentObject, Contents() As Byte) As DocumentResult Implements IEDMIService.UpdateFile
' Try
' TestFileExists(DocObject.ContainerId)
' ' TODO: update db
' Dim oFilePath = GetContainerPath(DocObject.ContainerId)
' Dim oFileContainer As FileContainer = FileContainer.Load(LogConfig, AppConfig.ContainerPassword, oFilePath)
' oFileContainer.SetFile(Contents, oFileContainer.GetFile.FileName)
' oFileContainer.Save()
' Return New DocumentResult(DocObject)
' Catch ex As Exception
' _logger.Error(ex)
' Return Nothing
' End Try
'End Function
'Public Function GetFile(DocObject As DocumentObject) As DocumentResult Implements IEDMIService.GetFile
' Try
' TestFileExists(DocObject.ContainerId)
' Dim oContainerPath = GetContainerPath(DocObject.ContainerId)
' Dim oContainer As FileContainer = FileContainer.Load(LogConfig, AppConfig.ContainerPassword, oContainerPath)
' Dim oContents As Byte() = oContainer.GetFile().Contents
' Return New DocumentResult(DocObject, oContents)
' Catch ex As Exception
' _logger.Error(ex)
' Return New DocumentResult(ex.Message)
' End Try
'End Function
'Public Function DeleteFile(DocObject As DocumentObject) As Boolean Implements IEDMIService.DeleteFile
' Try
' TestFileExists(DocObject.ContainerId)
' Dim oFilePath = GetContainerPath(DocObject.ContainerId)
' IO.File.Delete(oFilePath)
' 'TODO: Delete doc from db
' Return True
' Catch ex As Exception
' _logger.Error(ex)
' Return False
' End Try
'End Function
'Private Function GetContainerPath(ContainerId As String) As String
' Return Path.Combine(AppConfig.ContainerPath, GetContainerName(ContainerId))
'End Function
'Private Function GetContainerName(ContainerId As String) As String
' Return ContainerId & ".enc"
'End Function
'Private Sub TestFileExists(ContainerId)
' Dim oContainerPath = GetContainerPath(ContainerId)
' If Not IO.File.Exists(oContainerPath) Then
' Throw New FileNotFoundException("Container existiert nicht", oContainerPath)
' End If
'End Sub
'Public Function GetDocumentByDocumentId(DocumentId As Long) As DocumentResult Implements IEDMIService.GetDocumentByDocumentId
' Try
' Dim oSQL = $"SELECT GUID, CONTAINER_ID, ORIGINAL_FILENAME FROM TBIDB_DOCUMENT WHERE GUID = {DocumentId}"
' Dim oTable = Database.GetDatatable(oSQL)
' If oTable.Rows.Count = 0 Then
' Return New DocumentResult("Document not found")
' End If
' Dim oRow As DataRow = oTable.Rows.Item(0)
' Dim oDocument As New DocumentObject(
' oRow.Item("CONTAINER_ID"),
' oRow.Item("GUID"),
' oRow.Item("ORIGINAL_FILENAME")
' )
' TestFileExists(oDocument.ContainerId)
' Dim oContainerPath = GetContainerPath(oDocument.ContainerId)
' Dim oContainer As FileContainer = FileContainer.Load(LogConfig, AppConfig.ContainerPassword, oContainerPath)
' Dim oContents As Byte() = oContainer.GetFile().Contents
' Return New DocumentResult(oDocument, oContents)
' Catch ex As Exception
' Return New DocumentResult(ex.Message)
' End Try
'End Function
'Public Function GetDocumentByContainerId(ContainerId As String) As DocumentResult Implements IEDMIService.GetDocumentByContainerId
' Try
' Dim oSQL = $"SELECT GUID, CONTAINER_ID, ORIGINAL_FILENAME FROM TBIDB_DOCUMENT WHERE CONTAINER_ID = '{ContainerId}'"
' Dim oTable = Database.GetDatatable(oSQL)
' If oTable.Rows.Count = 0 Then
' Return New DocumentResult("Document not found")
' End If
' Dim oRow As DataRow = oTable.Rows.Item(0)
' Dim oDocument As New DocumentObject(
' oRow.Item("CONTAINER_ID"),
' oRow.Item("GUID"),
' oRow.Item("ORIGINAL_FILENAME")
' )
' TestFileExists(oDocument.ContainerId)
' Dim oContainerPath = GetContainerPath(oDocument.ContainerId)
' Dim oContainer As FileContainer = FileContainer.Load(LogConfig, AppConfig.ContainerPassword, oContainerPath)
' Dim oContents As Byte() = oContainer.GetFile().Contents
' Return New DocumentResult(oDocument, oContents)
' Catch ex As Exception
' Return New DocumentResult(ex.Message)
' End Try
'End Function
#End Region
#Region "Document"
Public Function ImportFile(FileInfo As FileInfo, Contents() As Byte, [Readonly] As Boolean, RetentionPeriod As Integer) As DocumentResult2 Implements IEDMIService.ImportFile
Dim oFilePath = Path.Combine(AppConfig.ContainerPath, FileInfo.Name)
Dim oDocument = New DocumentResult2.DocumentObject() With {.FileName = FileInfo.Name}
Try
_logger.Info("Saving file [{0}] to path [{1}]", FileInfo.Name, oFilePath)
Using oStream = New FileStream(oFilePath, FileMode.CreateNew)
oStream.Write(Contents, 0, Contents.Length)
oStream.Flush(True)
oStream.Close()
End Using
Dim oAttributes = IO.File.GetAttributes(oFilePath) Or FileAttributes.ReadOnly
If RetentionPeriod Then
_logger.Info("Setting LastAccessTime")
IO.File.SetLastAccessTime(oFilePath, Date.Now.AddYears(30))
End If
If [Readonly] Then
_logger.Info("Setting ReadOnly Attribute")
IO.File.SetAttributes(oFilePath, oAttributes)
End If
Return New DocumentResult2(oDocument)
Catch ex As Exception
_logger.Error(ex)
Return New DocumentResult2(ex.Message)
End Try
End Function
#End Region
#Region "Index"
Public Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult Implements IEDMIService.NewFileIndex
Try
Dim oSQL = $"SELECT FNIDB_NEW_DOC_VALUE({DocObject.DocumentId},'{Syskey}','{LanguageCode}','{Value}','{_username}') FROM RDB$DATABASE;"
Dim oIndexId As Int64 = Database.GetScalarValue(oSQL)
Return New IndexResult(oIndexId)
Catch ex As Exception
_logger.Error(ex)
Return New IndexResult(ex.Message)
End Try
End Function
#End Region
End Class

View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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>{A8C3F298-76AB-4359-AB3C-986E313B4336}</ProjectGuid>
<OutputType>Exe</OutputType>
<StartupObject>DigitalData.Services.EDMIService.WindowsService</StartupObject>
<RootNamespace>DigitalData.Services.EDMIService</RootNamespace>
<AssemblyName>EDMIService</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Console</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>EDMIService.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>EDMIService.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="FirebirdSql.Data.FirebirdClient, Version=6.4.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL">
<HintPath>..\..\packages\FirebirdSql.Data.FirebirdClient.6.4.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</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" />
</ItemGroup>
<ItemGroup>
<Compile Include="AppConfig.vb" />
<Compile Include="Results\BaseResult.vb" />
<Compile Include="Results\ContainerResult.vb" />
<Compile Include="Results\DocumentResult.vb" />
<Compile Include="Exceptions.vb" />
<Compile Include="Results\DatabaseResult.vb" />
<Compile Include="EDMIService.vb" />
<Compile Include="Results\DocumentResult2.vb" />
<Compile Include="Results\IndexResult.vb" />
<Compile Include="WindowsService.vb">
<SubType>Component</SubType>
</Compile>
<Compile Include="IEDMIService.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>
<Compile Include="ProjectInstaller.vb">
<SubType>Component</SubType>
</Compile>
<Compile Include="Request.vb" />
<Compile Include="SettingsModule.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.vb</DependentUpon>
</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="App.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Modules.Database\Database.vbproj">
<Project>{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}</Project>
<Name>Database</Name>
</ProjectReference>
<ProjectReference Include="..\..\Modules.EDMIAPI\EDMI.API.vbproj">
<Project>{5B1171DC-FFFE-4813-A20D-786AAE47B320}</Project>
<Name>EDMI.API</Name>
</ProjectReference>
<ProjectReference Include="..\..\Modules.Filesystem\Filesystem.vbproj">
<Project>{991D0231-4623-496D-8BD0-9CA906029CBC}</Project>
<Name>Filesystem</Name>
</ProjectReference>
<ProjectReference Include="..\..\Modules.Logging\Logging.vbproj">
<Project>{903B2D7D-3B80-4BE9-8713-7447B704E1B0}</Project>
<Name>Logging</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@ -0,0 +1,61 @@
Imports System.IO
Imports System.ServiceModel
Imports DigitalData.Modules.Filesystem
<ServiceContract([Namespace]:="http://DigitalData.Services.EDMIService")>
Interface IEDMIService
#Region "Heartbeat"
<OperationContract>
Function Heartbeat() As Boolean
#End Region
#Region "Database"
<OperationContract>
Function CreateDatabaseRequest(Name As String, Optional Debug As Boolean = False) As String
<OperationContract>
Sub CloseDatabaseRequest()
<OperationContract>
Function ReturnDatatable(SQL As String) As TableResult
<OperationContract>
Function ReturnScalar(SQL As String) As ScalarResult
<OperationContract>
Function ExecuteNonQuery(SQL As String) As NonQueryResult
#End Region
#Region "Document (with FileContainer)"
'<OperationContract>
'Function NewFile(FileName As String, Contents As Byte()) As DocumentResult
'<OperationContract>
'Function UpdateFile(DocObject As DocumentObject, Contents As Byte()) As DocumentResult
'<OperationContract>
'Function GetFile(DocObject As DocumentObject) As DocumentResult
'<OperationContract>
'Function DeleteFile(DocObject As DocumentObject) As Boolean
'<OperationContract>
'Function GetDocumentByDocumentId(DocumentId As Int64) As DocumentResult
'<OperationContract>
'Function GetDocumentByContainerId(ContainerId As String) As DocumentResult
#End Region
#Region "Document (New)"
<OperationContract>
Function ImportFile(FileInfo As FileInfo, Contents As Byte(), [ReadOnly] As Boolean, RetentionTime As Integer) As DocumentResult2
#End Region
#Region "Index"
<OperationContract>
Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult
#End Region
End Interface