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

Refactoring database #251

merged 88 commits into from
Jun 17, 2024

Conversation

blidhpxc
Copy link
Contributor

@blidhpxc blidhpxc commented May 29, 2024

Description

Clean up the program code with database referenChange of terms to the official standards of the IDTA.ces and clean up of the database structure. Outsource the program code to a separate project ("AasxServerDB"). Changing the terms to the official standards of the IDTA.

Motivation and Context

Cleaning and simplifying the code that works with the database for easier further development of the database.

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

These changes have been tested by running the application with 100.000 aas on a linux server and ensuring that all functionalities work as expected.

Screenshots (if appropriate):

db-schema

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

long first = smeIds.First();
long last = smeIds.Last();
List<SValueSet> valueList = null;
using (AasContext db = new AasContext())
Copy link
Contributor

Choose a reason for hiding this comment

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

Could make this a bit saver and easier readable

Suggested change
using (AasContext db = new AasContext())
using (AasContext db = new AasContext())
{
var watch = System.Diagnostics.Stopwatch.StartNew();
var query = @"
SELECT * FROM SValueSets WHERE ParentSMEId >= {0} AND ParentSMEId <= {1}
UNION
SELECT * FROM IValueSets WHERE ParentSMEId >= {0} AND ParentSMEId <= {1}
UNION
SELECT * FROM DValueSets WHERE ParentSMEId >= {0} AND ParentSMEId <= {1}
";
valueList = await db.SValueSets.FromSqlRaw(query, first, last)
.Where(v => smeIds.Contains(v.SMEId))
.OrderBy(v => v.SMEId)
.ToListAsync();
watch.Stop();
Console.WriteLine($"Getting the value list took this time: {watch.ElapsedMilliseconds} ms");
}

@Freezor Freezor added enhancement New feature or request database Relates to changes involving the database schema, migrations, queries, or overall database managemen labels Jun 13, 2024
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@Freezor Freezor merged commit 52cca0f into eclipse-aaspe:main Jun 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Relates to changes involving the database schema, migrations, queries, or overall database managemen enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants