Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring database #251

Merged
merged 88 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
98d6b16
Initial commit on orphan branch
blidhpxc Feb 22, 2024
0d0fc04
Merge remote-tracking branch 'aasx-server/main'
blidhpxc Mar 1, 2024
7d0b4cc
file error fix
blidhpxc Mar 1, 2024
8ce8359
start
blidhpxc Mar 5, 2024
87b4422
Merge remote-tracking branch 'aasx-server/main'
blidhpxc Mar 7, 2024
b969a1d
merge main
blidhpxc Mar 7, 2024
926b000
merge dev
blidhpxc Mar 7, 2024
fe7bfc4
Database-schema, Clear, Load
blidhpxc Mar 7, 2024
03d6937
delete
blidhpxc Mar 7, 2024
17b6750
works
blidhpxc Mar 8, 2024
4897703
works
blidhpxc Mar 8, 2024
a2d3f87
extrude to seperate files finished
blidhpxc Mar 11, 2024
ff54a09
db name change
blidhpxc Mar 11, 2024
3cecd5b
image of db schema changed
blidhpxc Mar 11, 2024
f03dd01
blazor changes
blidhpxc Mar 12, 2024
38c36f7
blazor changes
blidhpxc Mar 12, 2024
9525437
delete table config
blidhpxc Mar 12, 2024
3671182
delete num to id
blidhpxc Mar 12, 2024
7db3d80
Identifier changed
blidhpxc Mar 12, 2024
db23fc5
outsource of code from page for db
blidhpxc Mar 13, 2024
835e440
fremdschluessel einbau noch nicht fertig
blidhpxc Mar 13, 2024
2fbe953
finish refactoring
blidhpxc Mar 14, 2024
0d4b8a3
bug fix
blidhpxc Mar 14, 2024
11ddf86
bug fix
blidhpxc Mar 21, 2024
35eae17
work on SearchSMEsResult
blidhpxc Apr 4, 2024
be61abd
Edit works now
blidhpxc Apr 5, 2024
2740fe0
smal fix
blidhpxc Apr 10, 2024
af8a872
smal fix
blidhpxc Apr 10, 2024
81fc166
faster
blidhpxc Apr 10, 2024
b22dd70
faster works
blidhpxc Apr 10, 2024
651e594
faster works
blidhpxc Apr 10, 2024
2cc2d72
faster works
blidhpxc Apr 10, 2024
7d6bcd1
Database, not required added
blidhpxc Apr 11, 2024
0007255
Merge remote-tracking branch 'aasx-server/main'
blidhpxc Apr 12, 2024
c1a200f
Bug with searchSMEs and countSMEs fixed
blidhpxc Apr 15, 2024
333f90b
Auslagern von SM zu Json
blidhpxc Apr 16, 2024
386d479
Change
blidhpxc Apr 30, 2024
a791f0b
Merge remote-tracking branch 'aasx-server/main'
blidhpxc Apr 30, 2024
cfdaeff
Merge with main
blidhpxc Apr 30, 2024
943e829
new db image
blidhpxc May 10, 2024
343513f
Merge with remote branch
blidhpxc May 10, 2024
8dc6a9a
merge
blidhpxc May 10, 2024
ec71382
Merge with remote branch
blidhpxc May 27, 2024
7cb4f99
Merge main
blidhpxc May 27, 2024
bf01645
API Work started
blidhpxc May 28, 2024
02f450b
change start parameters
blidhpxc May 29, 2024
ff94f5b
Refactoring database
blidhpxc May 29, 2024
d4895a6
refactoring database
blidhpxc May 29, 2024
a6f24a9
refactoring database
blidhpxc May 29, 2024
d22b0d6
refactoring database
blidhpxc May 29, 2024
44d17d8
refactoring database
blidhpxc May 29, 2024
1874073
merge conflict
blidhpxc May 29, 2024
664d944
Resolve merge conflict
blidhpxc May 29, 2024
1007d66
start working through comments
blidhpxc May 29, 2024
4f9afff
Merge with remote branch
blidhpxc May 29, 2024
3477514
Rework SubmodelRepositoryAPIApi
blidhpxc May 29, 2024
4a87008
API connection to db
blidhpxc May 31, 2024
73506e7
API connection to db
blidhpxc May 31, 2024
9f876b9
API connection to db
blidhpxc May 31, 2024
6bb1e74
merge
blidhpxc Jun 3, 2024
d676ee9
Merge main
blidhpxc Jun 3, 2024
139c4ab
launchSettings.json
blidhpxc Jun 4, 2024
a605fee
work through the comments
blidhpxc Jun 10, 2024
97d4ba3
merge with upstream
blidhpxc Jun 10, 2024
96f644e
merge with upstream
blidhpxc Jun 10, 2024
2d9995a
delete old/unused methode
blidhpxc Jun 10, 2024
08d2bd2
merge with main
blidhpxc Jun 10, 2024
ff2178d
merge with main
blidhpxc Jun 10, 2024
8216e3f
Merge branch 'main' of https://github.com/blidhpxc/aasx-server
blidhpxc Jun 10, 2024
8314010
Merge branch 'main' of https://github.com/blidhpxc/aasx-server
blidhpxc Jun 10, 2024
18532ae
Merge branch 'main' of https://github.com/blidhpxc/aasx-server
blidhpxc Jun 10, 2024
e114b5e
Separate classes
blidhpxc Jun 12, 2024
7eaed2e
launchSettings.json
blidhpxc Jun 12, 2024
90d854e
merge main
blidhpxc Jun 12, 2024
162b13c
merge with local repo
blidhpxc Jun 12, 2024
0ab35a9
merge with local repo
blidhpxc Jun 12, 2024
6c9dd38
merge with local repo
blidhpxc Jun 12, 2024
16dcd92
merge with local repo
blidhpxc Jun 12, 2024
aa999d5
Update Edit.cs
blidhpxc Jun 13, 2024
208c5e6
Update Edit.cs
blidhpxc Jun 13, 2024
d25d9dc
change to string.IsNullOrEmpty
blidhpxc Jun 14, 2024
47d4519
Merge remote-tracking branch 'aasx-server-db/dev-refactoring'
blidhpxc Jun 14, 2024
e3686e2
change to string.IsNullOrEmpty
blidhpxc Jun 14, 2024
1dfbacb
launchSettings.json
blidhpxc Jun 14, 2024
0242fcc
Merge main into database branch
Freezor Jun 14, 2024
2a624e7
Bug fix Search on Page /db/sme?search=
blidhpxc Jun 17, 2024
5b050c7
Bug fix Search on Page /db/sme?search=
blidhpxc Jun 17, 2024
8582bf9
Merge branch 'origin-main' into blidhpxc-main
Freezor Jun 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 80 additions & 118 deletions src/AasxCsharpLibrary/AdminShellPackageEnv.cs

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions src/AasxServer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExampleClient", "ExampleCli
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxServerAspNetCore", "AasxServerAspNetCore\AasxServerAspNetCore.csproj", "{D467D497-18D8-4E26-8671-8AC73BE9AC4F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AasxServerDB", "AasxServerDB\AasxServerDB.csproj", "{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{F847719C-7CF2-40D5-BF7B-6F51E551E13F}"
ProjectSection(SolutionItems) = preProject
..\.github\pull_request_template.md = ..\.github\pull_request_template.md
Expand Down Expand Up @@ -321,6 +323,24 @@ Global
{D467D497-18D8-4E26-8671-8AC73BE9AC4F}.Release|x64.Build.0 = Release|Any CPU
{D467D497-18D8-4E26-8671-8AC73BE9AC4F}.Release|x86.ActiveCfg = Release|Any CPU
{D467D497-18D8-4E26-8671-8AC73BE9AC4F}.Release|x86.Build.0 = Release|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Debug|x64.ActiveCfg = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Debug|x64.Build.0 = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Debug|x86.ActiveCfg = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Debug|x86.Build.0 = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.DebugSlow|Any CPU.ActiveCfg = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.DebugSlow|Any CPU.Build.0 = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.DebugSlow|x64.ActiveCfg = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.DebugSlow|x64.Build.0 = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.DebugSlow|x86.ActiveCfg = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.DebugSlow|x86.Build.0 = Debug|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Release|Any CPU.Build.0 = Release|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Release|x64.ActiveCfg = Release|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Release|x64.Build.0 = Release|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Release|x86.ActiveCfg = Release|Any CPU
{C6A5D01E-BD5C-46DF-875C-E32E9C82342E}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion src/AasxServerAspNetCore/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//var app = builder.Build();

using AasSecurity;
using AasxServer;
using AasxServerDB;
using AasxServerStandardBib.Extensions;
using AasxServerStandardBib.Interfaces;
using AasxServerStandardBib.Logging;
Expand Down
2 changes: 1 addition & 1 deletion src/AasxServerBlazor/Configuration/ServerConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.IO;
using AasSecurity;
using AasxServer;
using AasxServerDB;
using AasxServerStandardBib.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
Expand Down
2,485 changes: 1,244 additions & 1,241 deletions src/AasxServerBlazor/Pages/Atex.razor

Large diffs are not rendered by default.

1,709 changes: 804 additions & 905 deletions src/AasxServerBlazor/Pages/Db.razor

Large diffs are not rendered by default.

62 changes: 31 additions & 31 deletions src/AasxServerBlazor/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"commandLineArgs": "--port 51710 --data-path C:\\Develop\\Aasx\\repo --edit --secret-string=123",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"AasxServerBlazor": {
"commandName": "Project",
"commandLineArgs": "--no-security --secret-string-api 1234 --aasx-in-memory 1000 --data-path \"\\\\wsl.localhost\\Ubuntu\\home\\oze\\plugfest\\aasxs-view\" --edit --external-blazor http://localhost:5001",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"AASREGISTRY": "http://localhost:50001",
"IFRAMEPATH": "https://dpp40-2-v2.industrialdigitaltwin.org/dashboard/submodelViewV3.html"
},
"applicationUrl": "http://localhost:5001",
"jsWebView2Debugging": true
}
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56189",
"sslPort": 0
}
}
{
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"commandLineArgs": "--port 51710 --data-path C:\\Develop\\Aasx\\repo --edit --secret-string=123",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"AasxServerBlazor": {
"commandName": "Project",
"commandLineArgs": "--no-security --secret-string-api 1234 --aasx-in-memory 1000 --data-path \"\\\\wsl.localhost\\Ubuntu\\home\\oze\\plugfest\\aasxs-view\" --edit --external-blazor http://localhost:5001",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aorzelskiGH can we somehow get these changes out of git?

"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"AASREGISTRY": "http://localhost:50001",
"IFRAMEPATH": "https://dpp40-2-v2.industrialdigitaltwin.org/dashboard/submodelViewV3.html"
},
"applicationUrl": "http://localhost:5001",
"jsWebView2Debugging": true
}
},
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56189",
"sslPort": 0
}
}
}
2 changes: 1 addition & 1 deletion src/AasxServerBlazor/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
Expand Down
4 changes: 2 additions & 2 deletions src/AasxServerBlazor/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
}
},
"DatabaseConnection": {
// "ConnectionString": "Host=localhost; Database=AAS; Username=postgres; Password=postres; Include Error Detail=true; Port=5432"
"ConnectionString": "Data Source=$DATAPATH\\database.db"
// "ConnectionString": "Host=localhost; Database=AAS; Username=postgres; Password=postgres; Include Error Detail=true; Port=5432"
"ConnectionString": "Data Source=$DATAPATH/database.db"
blidhpxc marked this conversation as resolved.
Show resolved Hide resolved
},
"AllowedHosts": "*",
"SyntaxHighlight": false
Expand Down
Binary file modified src/AasxServerBlazor/wwwroot/db-schema.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions src/AasxServerDB/AasxServerDB.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
blidhpxc marked this conversation as resolved.
Show resolved Hide resolved
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.13.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AasxCsharpLibrary\AasxCsharpLibrary.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>

</Project>
34 changes: 34 additions & 0 deletions src/AasxServerDB/Context/PostgreAasContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Microsoft.EntityFrameworkCore;

/*
* https://learn.microsoft.com/en-us/ef/core/get-started/overview/first-app?tabs=netcore-cli
*
* Initial Migration
* Add-Migration InitialCreate -Context SqliteAasContext -OutputDir Migrations\Sqlite
* Add-Migration InitialCreate -Context PostgreAasContext -OutputDir Migrations\Postgres
*
* Change database
* Add-Migration XXX -Context SqliteAasContext
* Add-Migration XXX -Context PostgreAasContext
* Update-Database -Context SqliteAasContext
* Update-Database -Context PostgreAasContext
*/

namespace AasxServerDB.Context
{
public class PostgreAasContext : AasContext
{
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
if (_con == null)
{
options.UseNpgsql("");
}
else
{
var connectionString = _con["DatabaseConnection:ConnectionString"];
options.UseNpgsql(connectionString);
}
}
}
}
36 changes: 36 additions & 0 deletions src/AasxServerDB/Context/SqliteAasContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Microsoft.EntityFrameworkCore;

/*
* https://learn.microsoft.com/en-us/ef/core/get-started/overview/first-app?tabs=netcore-cli
*
* Initial Migration
* Add-Migration InitialCreate -Context SqliteAasContext -OutputDir Migrations\Sqlite
* Add-Migration InitialCreate -Context PostgreAasContext -OutputDir Migrations\Postgres
*
* Change database
* Add-Migration XXX -Context SqliteAasContext
* Add-Migration XXX -Context PostgreAasContext
* Update-Database -Context SqliteAasContext
* Update-Database -Context PostgreAasContext
*/

namespace AasxServerDB.Context
{
public class SqliteAasContext : AasContext
{
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
if (_con == null)
{
options.UseSqlite("");
}
else
{
var connectionString = _con["DatabaseConnection:ConnectionString"];
if (connectionString != null && connectionString.Contains("$DATAPATH"))
connectionString = connectionString.Replace("$DATAPATH", _dataPath);
options.UseSqlite(connectionString);
}
}
}
}
Loading
Loading