diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 532b61a2e2f790f0ba7e308820205826d94b4c04..3258bacc9c30fb3897a2ea1b322c9e5e0764e15d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,10 +28,6 @@ migrate: - dotnet run --project .\src\Database.Actions -- --action-create --name $DB_NAME --source $DB_DATA_SOURCE --user $DB_USER_ID --pw $DB_PASSWORD # Scaffold created database - dotnet ef dbcontext scaffold "Data Source=$DB_DATA_SOURCE;Integrated Security=False;User ID=$DB_USER_ID;Password=$DB_PASSWORD;Database=$DB_NAME" Microsoft.EntityFrameworkCore.SqlServer -o DataModel -c "Model" -f --no-onconfiguring --project "src\Scaffolding" - # Remove the hardcoded Connection String inside \DataModel\Model.cs - - Set-Content -Path ".\src\Scaffolding\DataModel\Model.txt" -Value (Get-Content -Path ".\src\Scaffolding\DataModel\Model.cs" | where { $_ | Select-String -Pattern '#warning' -NotMatch } | where { $_ | Select-String -Pattern 'Data Source=' -NotMatch } ) -Force - - Set-Content -Path ".\src\Scaffolding\DataModel\Model.cs" -Value (Get-Content -Path ".\src\Scaffolding\DataModel\Model.txt") -Force - - Remove-Item ".\src\Scaffolding\DataModel\Model.txt" artifacts: paths: - src\Scaffolding\DataModel diff --git a/src/Database.Actions/Database.Actions.csproj b/src/Database.Actions/Database.Actions.csproj index 9774fa0c9b8dfa1ae0afa121e8e9ea96532d9d11..15404668a16c7710dab61e34fc5a84bfc65c15ff 100644 --- a/src/Database.Actions/Database.Actions.csproj +++ b/src/Database.Actions/Database.Actions.csproj @@ -1,14 +1,14 @@ <Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <OutputType>Exe</OutputType> + <RootNamespace>Coscine.Database.Actions</RootNamespace> + <AssemblyName>Coscine.Database.Actions</AssemblyName> + <TargetFramework>net6.0</TargetFramework> + <Version>2.17.0</Version> + </PropertyGroup> - <PropertyGroup> - <OutputType>Exe</OutputType> - <RootNamespace>Coscine.Database.Actions</RootNamespace> - <AssemblyName>Coscine.Database.Actions</AssemblyName> - <TargetFramework>net6.0</TargetFramework> - <Version>2.17.0</Version> - </PropertyGroup> <ItemGroup> - <PackageReference Include="Coscine.Database.Helpers" Version="2.*-*" /> + <PackageReference Include="Coscine.Database.Helpers" Version="*-*" /> <PackageReference Include="Coscine.Migrations" Version="2.*-*" /> </ItemGroup> </Project> diff --git a/src/Database.Tests/Database.Tests.csproj b/src/Database.Tests/Database.Tests.csproj index 088cb752282158b3a2819f6bbd5ab23213df634b..2f6b9ccf43792f2e4c51443d5430b659eda7e9cf 100644 --- a/src/Database.Tests/Database.Tests.csproj +++ b/src/Database.Tests/Database.Tests.csproj @@ -3,20 +3,22 @@ <OutputType>Library</OutputType> <RootNamespace>Coscine.Database.Tests</RootNamespace> <AssemblyName>Coscine.Database.Tests</AssemblyName> - <TargetFrameworks>net6.0;net461</TargetFrameworks> + <TargetFramework>net6.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <Version>2.17.0</Version> </PropertyGroup> + <ItemGroup> <ProjectReference Include="..\Database\Database.csproj" /> </ItemGroup> + <ItemGroup> - <PackageReference Include="Coscine.Configuration" Version="2.*-*" /> - <PackageReference Include="Coscine.Database.Helpers" Version="2.*-*" /> - <PackageReference Include="Coscine.Migrations" Version="2.*-*" /> - <PackageReference Include="linq2db" Version="3.2.3" /> - <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" /> - <PackageReference Include="NUnit" Version="3.13.1" /> - <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" /> + <PackageReference Include="Coscine.Configuration" Version="*-*" /> + <PackageReference Include="Coscine.Database.Helpers" Version="*-*" /> + <PackageReference Include="Coscine.Migrations" Version="*-*" /> + <PackageReference Include="linq2db" Version="4.3.0" /> + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" /> + <PackageReference Include="NUnit" Version="3.13.3" /> + <PackageReference Include="NUnit3TestAdapter" Version="4.3.1" /> </ItemGroup> </Project> diff --git a/src/Database.Tests/ModelTests.cs b/src/Database.Tests/ModelTests.cs index ab7e65638701573b8c16faa9b6cc11f4a6fd3b83..c271ca85f7cfc2fd0bea4b725f5d7a960e729d37 100644 --- a/src/Database.Tests/ModelTests.cs +++ b/src/Database.Tests/ModelTests.cs @@ -1,7 +1,5 @@ -using Coscine.Database.Models; -using NUnit.Framework; +using NUnit.Framework; using System; -using System.Collections.Generic; namespace Coscine.Database.Tests { diff --git a/src/Database/CoscineDB.cs b/src/Database/CoscineDB.cs index b3ccbac43c2de5b53db2dbdf904a73d51047df68..2be07fbc00da8250479acd567f20432e255f045e 100644 --- a/src/Database/CoscineDB.cs +++ b/src/Database/CoscineDB.cs @@ -1,7 +1,7 @@ -using Microsoft.EntityFrameworkCore; -using Coscine.Database.Settings; +using Coscine.Configuration; using Coscine.Database.DataModel; -using Coscine.Configuration; +using Coscine.Database.Settings; +using Microsoft.EntityFrameworkCore; namespace Coscine.Database { diff --git a/src/Database/CustomDesignTimeService.cs b/src/Database/CustomDesignTimeService.cs index 1bd05650b496aa3f716531fc80761551429c6ec0..ab3d2219b32104a23cde42912ad5f00c88c79491 100644 --- a/src/Database/CustomDesignTimeService.cs +++ b/src/Database/CustomDesignTimeService.cs @@ -8,7 +8,7 @@ namespace Coscine.Database public void ConfigureDesignTimeServices(IServiceCollection serviceCollection) => serviceCollection.AddSingleton<IPluralizer, CustomPluralizer>(); } - + public class CustomPluralizer : IPluralizer { Inflector.Inflector _inflector = new Inflector.Inflector(System.Globalization.CultureInfo.GetCultureInfo("en-us")); diff --git a/src/Database/Database.csproj b/src/Database/Database.csproj index 0d2e20cf376c138a9f8c4d72db2bf9a2a8308b59..f71f9e46b7b8b120d77436471e0514a3a07d4448 100644 --- a/src/Database/Database.csproj +++ b/src/Database/Database.csproj @@ -1,44 +1,46 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Library</OutputType> <RootNamespace>Coscine.Database</RootNamespace> <AssemblyName>Coscine.Database</AssemblyName> - <TargetFrameworks>net6.0;net461</TargetFrameworks> + <TargetFramework>net6.0</TargetFramework> <Version>2.17.0</Version> </PropertyGroup> + <PropertyGroup> <Authors>RWTH Aachen University</Authors> <Company>IT Center, RWTH Aachen University</Company> - <Copyright>2022 IT Center, RWTH Aachen University</Copyright> + <Copyright>2023 IT Center, RWTH Aachen University</Copyright> <Description>Database is a part of the Coscine group.</Description> <PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageProjectUrl>https://git.rwth-aachen.de/coscine/backend/libraries/database</PackageProjectUrl> <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> </PropertyGroup> + <PropertyGroup> <SignAssembly>true</SignAssembly> <AssemblyOriginatorKeyFile>Coscine.Database.Key.snk</AssemblyOriginatorKeyFile> </PropertyGroup> + <ItemGroup> <None Include="Coscine.Database.Key.snk" /> <Reference Include="System.Web" Condition="'$(TargetFramework)' == 'net461'" /> </ItemGroup> + <ItemGroup> <Compile Include="..\Scaffolding\DataModel\*.*"> <Link>DataModel\%(Filename)%(Extension)</Link> </Compile> </ItemGroup> + <ItemGroup> - <PackageReference Include="Coscine.Configuration" Version="2.*-*" /> - <PackageReference Include="LinqKit" Version="1.1.23" /> + <PackageReference Include="Coscine.Configuration" Version="*-*" /> + <PackageReference Include="LinqKit" Version="1.2.3" /> <PackageReference Include="Inflector.NetStandard" Version="1.2.2" /> - <!-- Note: use newest Microsoft.EntityFrameworkCore Version for net6.0 --> - <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.4" Condition="'$(TargetFramework)' == 'net6.0'" PrivateAssets="all" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.4" Condition="'$(TargetFramework)' == 'net6.0'" /> - <!-- Note: use Microsoft.EntityFrameworkCore Version 3.x.x for compatibility with net461 --> - <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.12" Condition="'$(TargetFramework)' == 'net461'" PrivateAssets="all" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.12" Condition="'$(TargetFramework)' == 'net461'" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.11" PrivateAssets="all" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.11" /> </ItemGroup> + <PropertyGroup> <LangVersion>Preview</LangVersion> </PropertyGroup> diff --git a/src/Database/Models/ActivatedFeaturesModel.cs b/src/Database/Models/ActivatedFeaturesModel.cs index 9066ee4e312f4307da3ebe67a80294f76e7fd724..afbfccdaa80ab0de66419b5892f9dcc42d70fd8b 100644 --- a/src/Database/Models/ActivatedFeaturesModel.cs +++ b/src/Database/Models/ActivatedFeaturesModel.cs @@ -42,10 +42,10 @@ namespace Coscine.Database.Models if (!IsFeatureActive(projectId, featureId)) { Insert(new ActivatedFeature - { - ProjectId = projectId, - FeatureId = featureId - }); + { + ProjectId = projectId, + FeatureId = featureId + }); } } @@ -53,11 +53,12 @@ namespace Coscine.Database.Models { if (IsFeatureActive(projectId, featureId)) { - foreach(var feature in GetAllWhere((activatedFeatures) => activatedFeatures.FeatureId == featureId - && activatedFeatures.ProjectId == projectId)) { + foreach (var feature in GetAllWhere((activatedFeatures) => activatedFeatures.FeatureId == featureId + && activatedFeatures.ProjectId == projectId)) + { Delete(feature); } - + } } diff --git a/src/Database/Models/ApiTokenModel.cs b/src/Database/Models/ApiTokenModel.cs index 539f35452bc9cb4d69ac7c41f74f8062ec7c2d2e..18e81840e9a03dce0c9c49ef0a23fc60620d07e5 100644 --- a/src/Database/Models/ApiTokenModel.cs +++ b/src/Database/Models/ApiTokenModel.cs @@ -1,10 +1,10 @@ using Coscine.Database.DataModel; -using Microsoft.EntityFrameworkCore; using Coscine.Database.ReturnObjects; +using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; -using System.Linq.Expressions; using System.Linq; +using System.Linq.Expressions; namespace Coscine.Database.Models { diff --git a/src/Database/Models/ContactChangeModel.cs b/src/Database/Models/ContactChangeModel.cs index 29a5cf0bafbf7deca0cb052aed4ae50f25cff4b3..b50f9df08c0efe8f1a8d18943b6d15780f5b0564 100644 --- a/src/Database/Models/ContactChangeModel.cs +++ b/src/Database/Models/ContactChangeModel.cs @@ -94,7 +94,7 @@ namespace Coscine.Database.Models throw new MissingFieldException("INVALID: The Token " + token.ToString() + " is not valid. No entry inside the Database."); } } - + private void DeleteExpiredDbEntries(Guid userId) { IEnumerable<ContactChange> emailData = GetAllWhere((contactChange) => contactChange.UserId == userId); @@ -149,7 +149,7 @@ namespace Coscine.Database.Models public static ContactChange FromObject(ContactChangeObject contactChangeObject) { - return new ContactChange() + return new ContactChange() { RelationId = contactChangeObject.RelationId, UserId = contactChangeObject.UserId, diff --git a/src/Database/Models/DatabaseModel.cs b/src/Database/Models/DatabaseModel.cs index 1f9b7f272aa3e1286195cedb7f98e472c88266d0..f466ace3add9047c8d7844283285fc12ed037ef8 100644 --- a/src/Database/Models/DatabaseModel.cs +++ b/src/Database/Models/DatabaseModel.cs @@ -1,11 +1,9 @@ -using Coscine.Database.DataModel; -using Coscine.Database.Util; -using Microsoft.EntityFrameworkCore; +using Coscine.Database.Util; +using LinqKit; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; -using LinqKit; namespace Coscine.Database.Models { @@ -68,7 +66,7 @@ namespace Coscine.Database.Models { return DatabaseConnection.ConnectToDatabase((db) => { - return (int) db.Update(databaseObject).State; + return (int)db.Update(databaseObject).State; }); } diff --git a/src/Database/Models/KpiModel.cs b/src/Database/Models/KpiModel.cs index 0d1bd8ae6e319002c6bfd4e20200a64ae65088a1..dda25049ff0242d7cc96c2cd3c8fa23227e1fe82 100644 --- a/src/Database/Models/KpiModel.cs +++ b/src/Database/Models/KpiModel.cs @@ -1,11 +1,6 @@ using Coscine.Database.DataModel; using Microsoft.EntityFrameworkCore; -using Coscine.Database.Util; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Coscine.Database.Models { diff --git a/src/Database/Models/ProjectRoleModel.cs b/src/Database/Models/ProjectRoleModel.cs index 7b660a9dbaa6d1c32ec62487a9f3fac1f3f6d7f3..398bcbb9f2ef7a17e65cd5326c7530d0afc6dc01 100644 --- a/src/Database/Models/ProjectRoleModel.cs +++ b/src/Database/Models/ProjectRoleModel.cs @@ -8,15 +8,15 @@ using System.Linq.Expressions; namespace Coscine.Database.Models { public class ProjectRoleModel : DatabaseModel<ProjectRole> - { + { public ProjectRole SetFromObject(ProjectRoleObject projectRoleObject) { // Remove existing roles if they exist - var existingRoles = GetAllWhere((dbProjectRole) => dbProjectRole.ProjectId == projectRoleObject.ProjectId && dbProjectRole.UserId == projectRoleObject.User.Id); + var existingRoles = GetAllWhere((dbProjectRole) => dbProjectRole.ProjectId == projectRoleObject.ProjectId && dbProjectRole.UserId == projectRoleObject.User.Id); if (existingRoles.Count() > 0) { - foreach(var role in existingRoles) + foreach (var role in existingRoles) { CheckIfLastOwnerWillBeRemoved(role.RoleId, projectRoleObject.ProjectId); Delete(role); diff --git a/src/Database/Models/ResourceModel.cs b/src/Database/Models/ResourceModel.cs index e788ee709e4e61b7cd134dbb4f40d454040ca844..a372ba44174f48aa2bfe600a825b3703a944c59a 100644 --- a/src/Database/Models/ResourceModel.cs +++ b/src/Database/Models/ResourceModel.cs @@ -1,4 +1,3 @@ -using Coscine.Configuration; using Coscine.Database.DataModel; using Coscine.Database.ReturnObjects; using Coscine.Database.Util; diff --git a/src/Database/Models/RoleModel.cs b/src/Database/Models/RoleModel.cs index 7538342bd9cbd11e3d8b98df2cb556fc48c734ff..4d522c91171fca6a4d132fce9ee11217adc68fec 100644 --- a/src/Database/Models/RoleModel.cs +++ b/src/Database/Models/RoleModel.cs @@ -1,6 +1,5 @@ using Coscine.Database.DataModel; using Coscine.Database.Util; - using System; using System.Linq; using System.Linq.Expressions; @@ -26,9 +25,9 @@ namespace Coscine.Database.Models public Role GetOwnerRole() { - return DatabaseConnection.ConnectToDatabase((db) => + return DatabaseConnection.ConnectToDatabase((db) => (from tableEntry in GetITableFromDatabase(db) - where tableEntry.DisplayName == "Owner" + where tableEntry.DisplayName.ToLower().Equals(UserRoles.Owner.ToLower()) select tableEntry).First()); } } diff --git a/src/Database/Models/UserModel.cs b/src/Database/Models/UserModel.cs index 799fe4201d78f273830af4efdf4692d9b5e864ee..a4f0efcf5222effe2ff063b3ca27a21aaa8b83e0 100644 --- a/src/Database/Models/UserModel.cs +++ b/src/Database/Models/UserModel.cs @@ -35,10 +35,11 @@ namespace Coscine.Database.Models var externalAuthenticatorModel = new ExternalAuthenticatorModel(); var externalAuthenticators = externalAuthenticatorModel.GetAllWhere( - (externalAuthenticator) => + (externalAuthenticator) => (from relation in externalAuthenticator.ExternalIds - where relation.UserId == user.Id select relation).Any()) - .Select((externalAuthenticator) => + where relation.UserId == user.Id + select relation).Any()) + .Select((externalAuthenticator) => new ExternalAuthenticatorsObject( externalAuthenticator.Id, externalAuthenticator.DisplayName)); @@ -75,7 +76,7 @@ namespace Coscine.Database.Models user.TitleId = userObject.Title?.Id; user.Givenname = userObject.Givenname; user.Surname = userObject.Surname; - user.DisplayName = userObject.DisplayName; + user.DisplayName = userObject.DisplayName; user.Organization = userObject.Organization; user.Institute = userObject.Institute; user.LanguageId = userObject.Language?.Id; diff --git a/src/Database/ReturnObjects/KpiObject.cs b/src/Database/ReturnObjects/KpiObject.cs index 880dd20baf9d7dc62d98fd944e4028f431ffd1fe..fdd8b12fc4e52760a3e7324b9c5e528b5a320246 100644 --- a/src/Database/ReturnObjects/KpiObject.cs +++ b/src/Database/ReturnObjects/KpiObject.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; namespace Coscine.Database.ReturnObjects { @@ -19,9 +14,9 @@ namespace Coscine.Database.ReturnObjects public string AdditionalInfo1 { get; set; } public string AdditionalInfo2 { get; set; } public string AdditionalInfo3 { get; set; } - public string AdditionalInfo4 { get; set; } + public string AdditionalInfo4 { get; set; } public string AdditionalInfo5 { get; set; } - public bool SentSuccessfully { get; set; } + public bool SentSuccessfully { get; set; } public KpiObject(Guid id, string measurementId, string ikz, double value, DateTime start, DateTime end, string additionalInfo = "", string additionalInfo1 = "", string additionalInfo2 = "", string additionalInfo3 = "", string additionalInfo4 = "", string additionalInfo5 = "", bool sentSuccessfully = false) { diff --git a/src/Database/ReturnObjects/ProjectQuotaReturnObject.cs b/src/Database/ReturnObjects/ProjectQuotaReturnObject.cs index dd9382fa63e77e98070a7d889ab5f11a711ce43c..2edae310d4e3bc386ce86ff1e06adc0f530eb9bc 100644 --- a/src/Database/ReturnObjects/ProjectQuotaReturnObject.cs +++ b/src/Database/ReturnObjects/ProjectQuotaReturnObject.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; namespace Coscine.Database.ReturnObjects; diff --git a/src/Database/ReturnObjects/RdsS3ResourceTypeObject.cs b/src/Database/ReturnObjects/RdsS3ResourceTypeObject.cs index 22b16a5ca1c435af1c4cbd40868f9bc160d1bdb9..dc58fcfdfd12e6788befaf845446a2e2a25583a9 100644 --- a/src/Database/ReturnObjects/RdsS3ResourceTypeObject.cs +++ b/src/Database/ReturnObjects/RdsS3ResourceTypeObject.cs @@ -2,16 +2,16 @@ namespace Coscine.Database.ReturnObjects { - [Serializable] - public class RdsS3ResourceTypeObject : ResourceTypeOptionObject - { - public Guid Id { get; set; } - public string BucketName { get; set; } - public string ReadAccessKey { get; set; } - public string ReadSecretKey { get; set; } - public string WriteAccessKey { get; set; } - public string WriteSecretKey { get; set; } - public string Endpoint { get; set; } - public int? Size { get; set; } - } + [Serializable] + public class RdsS3ResourceTypeObject : ResourceTypeOptionObject + { + public Guid Id { get; set; } + public string BucketName { get; set; } + public string ReadAccessKey { get; set; } + public string ReadSecretKey { get; set; } + public string WriteAccessKey { get; set; } + public string WriteSecretKey { get; set; } + public string Endpoint { get; set; } + public int? Size { get; set; } + } } \ No newline at end of file diff --git a/src/Database/ReturnObjects/ResourceObject.cs b/src/Database/ReturnObjects/ResourceObject.cs index be658ca0d908b060eaeeae3a334b95f60d2173ce..3f4790ac5b522a707951d5f9661b84eb0d06f19c 100644 --- a/src/Database/ReturnObjects/ResourceObject.cs +++ b/src/Database/ReturnObjects/ResourceObject.cs @@ -27,8 +27,8 @@ namespace Coscine.Database.ReturnObjects public Guid? Creator { get; set; } public bool Archived { get; set; } public bool Deleted { get; set; } - - public ResourceObject(Guid id, string displayName, string resourceName, string description, string keywords, string usageRights, ResourceTypeObject type, IEnumerable<DisciplineObject> disciplines, VisibilityObject visibility, LicenseObject license, JObject resourceTypeOption, string applicationProfile, JToken fixedValues, DateTime? dateCreated, Guid? creator = null, bool archived = false, bool deleted = false) + + public ResourceObject(Guid id, string displayName, string resourceName, string description, string keywords, string usageRights, ResourceTypeObject type, IEnumerable<DisciplineObject> disciplines, VisibilityObject visibility, LicenseObject license, JObject resourceTypeOption, string applicationProfile, JToken fixedValues, DateTime? dateCreated, Guid? creator = null, bool archived = false, bool deleted = false) { Id = id; @@ -37,7 +37,7 @@ namespace Coscine.Database.ReturnObjects Description = description; Keywords = keywords; UsageRights = usageRights; - + Type = type; Disciplines = disciplines; Visibility = visibility; diff --git a/src/Database/Util/DatabaseConnection.cs b/src/Database/Util/DatabaseConnection.cs index e323adc41bb308e14a38a273be8385076eb05636..807c8dc1dda52eda895a457bfabf48bbc4fff632 100644 --- a/src/Database/Util/DatabaseConnection.cs +++ b/src/Database/Util/DatabaseConnection.cs @@ -1,6 +1,4 @@ -using Coscine.Database.DataModel; -using System; -using System.Linq; +using System; namespace Coscine.Database.Util { diff --git a/src/Database/Util/Linq2DbMigration.cs b/src/Database/Util/Linq2DbMigration.cs index bdb3b4997a0a69938e48e210ad36b003700a4198..7037c94900ac604db72e3f3ce833edae8611b181 100644 --- a/src/Database/Util/Linq2DbMigration.cs +++ b/src/Database/Util/Linq2DbMigration.cs @@ -1,10 +1,6 @@ using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.ChangeTracking; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Coscine.Database.Settings @@ -35,28 +31,28 @@ namespace Coscine.Database.Settings } } - namespace Coscine.Database.Util +namespace Coscine.Database.Util { public static class Linq2DbMigration { [Obsolete("Please use DbSet<T>.Add instead.")] public static int Insert<T>(this DbContext db, T t) where T : class { - return (int) db.Add(t).State; + return (int)db.Add(t).State; } [Obsolete("Please use DbSet<T>.RemoveRange instead.")] public static int Delete<T>(this DbContext db, IEnumerable<T> t) where T : class { db.RemoveRange(t); - return (int) EntityState.Deleted; + return (int)EntityState.Deleted; } [Obsolete("Please use DbSet<T>.Remove instead.")] public static int Delete<T>(this DbContext db, T t) where T : class { - return (int) db.Remove(t).State; + return (int)db.Remove(t).State; } } } diff --git a/src/Database/Util/RandomHelper.cs b/src/Database/Util/RandomHelper.cs index 8fa2f30d23b0f14dcf335bedad0eb199e08f3194..d3b8bbdfae84b617544be3a3cd509ec6734dfa80 100644 --- a/src/Database/Util/RandomHelper.cs +++ b/src/Database/Util/RandomHelper.cs @@ -8,7 +8,7 @@ namespace Coscine.Database.Util const string humanSafeChars = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"; const string urlSafeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; const char separatorChar = '-'; - static readonly RandomNumberGenerator rng = RandomNumberGenerator.Create(); + static readonly RandomNumberGenerator rng = RandomNumberGenerator.Create(); public static string GenerateRandomChunk(int length, int chunks = 1, bool humanSafe = false) { diff --git a/src/Database/Util/UserRoles.cs b/src/Database/Util/UserRoles.cs index 9c22a86fa2f02731643f4c48cc073508f8521d75..d4638546eb5b398c0b8554f66f7597cef831f5e2 100644 --- a/src/Database/Util/UserRoles.cs +++ b/src/Database/Util/UserRoles.cs @@ -1,8 +1,13 @@ namespace Coscine.Database.Util { + /// <summary> + /// User Roles in Coscine (Database mirror) + /// </summary> + /// <remarks>ALWAYS KEEP UP TO DATE WITH THE DATABASE TABLE!</remarks> public class UserRoles { - public static string Member { get; } = "member"; public static string Owner { get; } = "owner"; + public static string Member { get; } = "member"; + public static string Guest { get; } = "guest"; } } diff --git a/src/Scaffolding/DataModel/ActivatedFeature.cs b/src/Scaffolding/DataModel/ActivatedFeature.cs index 1c7552b69874f3c73f0adf7fe29b450572ba89fc..9b69c016210b0e7d614fcc7f924e88a5982b42c2 100644 --- a/src/Scaffolding/DataModel/ActivatedFeature.cs +++ b/src/Scaffolding/DataModel/ActivatedFeature.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ActivatedFeature diff --git a/src/Scaffolding/DataModel/ApiToken.cs b/src/Scaffolding/DataModel/ApiToken.cs index 132c0bec8eb35a96f07c732f20c901328727fe0d..61e2d07ca36fb1fdcd920fb9d33388cc37769d32 100644 --- a/src/Scaffolding/DataModel/ApiToken.cs +++ b/src/Scaffolding/DataModel/ApiToken.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ApiToken diff --git a/src/Scaffolding/DataModel/ContactChange.cs b/src/Scaffolding/DataModel/ContactChange.cs index abed9b1417ba07f9a723fc34598b653fed0ae0f5..1ffafc06b0061c3c269968893f66357826f50d17 100644 --- a/src/Scaffolding/DataModel/ContactChange.cs +++ b/src/Scaffolding/DataModel/ContactChange.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ContactChange diff --git a/src/Scaffolding/DataModel/Discipline.cs b/src/Scaffolding/DataModel/Discipline.cs index 48ac8705c1178eea8d7dbb5b8b8a52e729dcc459..6fc1d7e5e542094621c7ded10d1e1a871477b69f 100644 --- a/src/Scaffolding/DataModel/Discipline.cs +++ b/src/Scaffolding/DataModel/Discipline.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Discipline diff --git a/src/Scaffolding/DataModel/ExternalAuthenticator.cs b/src/Scaffolding/DataModel/ExternalAuthenticator.cs index 6a3ec8f12bf6980d504091c37c311a6cce885b10..61115f145b37f3b523f9350017c160668af4b8c7 100644 --- a/src/Scaffolding/DataModel/ExternalAuthenticator.cs +++ b/src/Scaffolding/DataModel/ExternalAuthenticator.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ExternalAuthenticator diff --git a/src/Scaffolding/DataModel/ExternalId.cs b/src/Scaffolding/DataModel/ExternalId.cs index 35b36d328621e25ee843d1f7f1e41aed4be575ea..b25c56d450796c23dce8fd20690b54c7b166b5ce 100644 --- a/src/Scaffolding/DataModel/ExternalId.cs +++ b/src/Scaffolding/DataModel/ExternalId.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ExternalId diff --git a/src/Scaffolding/DataModel/Feature.cs b/src/Scaffolding/DataModel/Feature.cs index 15797b25aa060e0992ec8e6edc1b438f776b7aba..6683419a0c23ac97b69043dcad23cc834527b52c 100644 --- a/src/Scaffolding/DataModel/Feature.cs +++ b/src/Scaffolding/DataModel/Feature.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Feature diff --git a/src/Scaffolding/DataModel/GitlabResourceType.cs b/src/Scaffolding/DataModel/GitlabResourceType.cs index 6891e663a907419c16ec8d48a21b94c981fd0ba7..7e661c9bfa675e437de9f2a5b62402fd079fd191 100644 --- a/src/Scaffolding/DataModel/GitlabResourceType.cs +++ b/src/Scaffolding/DataModel/GitlabResourceType.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class GitlabResourceType diff --git a/src/Scaffolding/DataModel/Group.cs b/src/Scaffolding/DataModel/Group.cs index 5089a11a5f10248de71237ba48ffe61c0c69b228..98a154271dfeeee07680b4b1529a0cef9c5a94cd 100644 --- a/src/Scaffolding/DataModel/Group.cs +++ b/src/Scaffolding/DataModel/Group.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Group diff --git a/src/Scaffolding/DataModel/GroupMembership.cs b/src/Scaffolding/DataModel/GroupMembership.cs index 40e310ca0a046250b8a3fbcc585483a676d7cce5..d50c63ed5bdad87f2bc5d87e62f5dbb49658a7ab 100644 --- a/src/Scaffolding/DataModel/GroupMembership.cs +++ b/src/Scaffolding/DataModel/GroupMembership.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class GroupMembership diff --git a/src/Scaffolding/DataModel/Invitation.cs b/src/Scaffolding/DataModel/Invitation.cs index bf4a9ec3ddf0e7e7baad5d2d497593c9e237ea46..5f3efbb55764f08e9348b98927bd1ac5b33e5f2f 100644 --- a/src/Scaffolding/DataModel/Invitation.cs +++ b/src/Scaffolding/DataModel/Invitation.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Invitation diff --git a/src/Scaffolding/DataModel/Kpi.cs b/src/Scaffolding/DataModel/Kpi.cs index bfa004e411522ca060a35509126bf36bb84b7e2c..dba34ad90999e2066451fd088a9d26de3ab3bf51 100644 --- a/src/Scaffolding/DataModel/Kpi.cs +++ b/src/Scaffolding/DataModel/Kpi.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Kpi diff --git a/src/Scaffolding/DataModel/Language.cs b/src/Scaffolding/DataModel/Language.cs index c0bd2ccaa9170e6f1f85aaa030ac2fae7ed4b9bd..a2134a469a7436fd1001f22e091a3cbea8fe40ea 100644 --- a/src/Scaffolding/DataModel/Language.cs +++ b/src/Scaffolding/DataModel/Language.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Language diff --git a/src/Scaffolding/DataModel/License.cs b/src/Scaffolding/DataModel/License.cs index 52eb539f216a221dcb0b85506729e366589880ac..169e2f1693fed78912f9561ae85922def01e2344 100644 --- a/src/Scaffolding/DataModel/License.cs +++ b/src/Scaffolding/DataModel/License.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class License diff --git a/src/Scaffolding/DataModel/LinkedResourceType.cs b/src/Scaffolding/DataModel/LinkedResourceType.cs index 1b07722c893c205fea35aa4f1b59f3c7dd2fc214..3f617dbbb5e22a9ca4ee90b446d578a71a2ed25d 100644 --- a/src/Scaffolding/DataModel/LinkedResourceType.cs +++ b/src/Scaffolding/DataModel/LinkedResourceType.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class LinkedResourceType diff --git a/src/Scaffolding/DataModel/Log.cs b/src/Scaffolding/DataModel/Log.cs index 1d4432d07fb822d684d914c3085312550d11b62b..b10200247bb76271feec16c1eeed242d5c81b9dc 100644 --- a/src/Scaffolding/DataModel/Log.cs +++ b/src/Scaffolding/DataModel/Log.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Log diff --git a/src/Scaffolding/DataModel/MetadataExtraction.cs b/src/Scaffolding/DataModel/MetadataExtraction.cs index 381f5425256fb6b7d2381079d1f6f58bd545d823..a7b4bd32d3a7a0a4a2133b1206b8d5356c720bb1 100644 --- a/src/Scaffolding/DataModel/MetadataExtraction.cs +++ b/src/Scaffolding/DataModel/MetadataExtraction.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class MetadataExtraction diff --git a/src/Scaffolding/DataModel/Model.cs b/src/Scaffolding/DataModel/Model.cs index e9eefbf81b28e15c638a91531800914530859300..f8934d767c8d612d1cb047d7ee44dce3e832faff 100644 --- a/src/Scaffolding/DataModel/Model.cs +++ b/src/Scaffolding/DataModel/Model.cs @@ -1,11 +1,8 @@ using System; +using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Model : DbContext @@ -58,13 +55,6 @@ namespace Coscine.Database.DataModel public virtual DbSet<VersionInfo> VersionInfos { get; set; } public virtual DbSet<Visibility> Visibilities { get; set; } - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - if (!optionsBuilder.IsConfigured) - { - } - } - protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<ActivatedFeature>(entity => @@ -156,8 +146,8 @@ namespace Coscine.Database.DataModel entity.Property(e => e.ExternalId1) .IsRequired() - .HasColumnName("ExternalId") - .HasMaxLength(255); + .HasMaxLength(255) + .HasColumnName("ExternalId"); entity.Property(e => e.Organization).HasMaxLength(255); @@ -306,8 +296,8 @@ namespace Coscine.Database.DataModel entity.Property(e => e.Ikz).HasMaxLength(9); entity.Property(e => e.MeasurementId) - .HasColumnName("MeasurementID") - .HasMaxLength(500); + .HasMaxLength(500) + .HasColumnName("MeasurementID"); entity.Property(e => e.Start) .HasColumnType("datetime") @@ -345,8 +335,7 @@ namespace Coscine.Database.DataModel { entity.ToTable("Log"); - entity.HasIndex(e => new { e.UserId, e.LogLevel, e.ServerTimestamp }) - .HasName("log_idx_userid_loglevel_servertime"); + entity.HasIndex(e => new { e.UserId, e.LogLevel, e.ServerTimestamp }, "log_idx_userid_loglevel_servertime"); entity.Property(e => e.Id).HasDefaultValueSql("(newid())"); @@ -367,8 +356,8 @@ namespace Coscine.Database.DataModel entity.Property(e => e.Status).HasMaxLength(200); entity.Property(e => e.Uri) - .HasColumnName("URI") - .HasMaxLength(500); + .HasMaxLength(500) + .HasColumnName("URI"); }); modelBuilder.Entity<MetadataExtraction>(entity => @@ -500,6 +489,7 @@ namespace Coscine.Database.DataModel entity.HasOne(d => d.Resource) .WithMany(p => p.ProjectResources) .HasForeignKey(d => d.ResourceId) + .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_ProjectResource_ResourceId_Resources_Id"); }); @@ -686,6 +676,7 @@ namespace Coscine.Database.DataModel entity.HasOne(d => d.Resource) .WithMany(p => p.ResourceDisciplines) .HasForeignKey(d => d.ResourceId) + .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("FK_ResourceDiscipline_ResourceId_Resources_Id"); }); @@ -841,8 +832,7 @@ namespace Coscine.Database.DataModel entity.ToTable("VersionInfo"); - entity.HasIndex(e => e.Version) - .HasName("UC_Version") + entity.HasIndex(e => e.Version, "UC_Version") .IsUnique() .IsClustered(); diff --git a/src/Scaffolding/DataModel/Project.cs b/src/Scaffolding/DataModel/Project.cs index 0a9b7886275e72800dcc343fb97fd3a0b3f11b60..24f0af4476a7c91e9ed09f11a509a3ed628c85f9 100644 --- a/src/Scaffolding/DataModel/Project.cs +++ b/src/Scaffolding/DataModel/Project.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Project diff --git a/src/Scaffolding/DataModel/ProjectDiscipline.cs b/src/Scaffolding/DataModel/ProjectDiscipline.cs index 31ebc39f2efe03ee044dbefa43e41315e1ac9daf..538fc0f276094490a7e5625233d4653e626a6d8d 100644 --- a/src/Scaffolding/DataModel/ProjectDiscipline.cs +++ b/src/Scaffolding/DataModel/ProjectDiscipline.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ProjectDiscipline diff --git a/src/Scaffolding/DataModel/ProjectInstitute.cs b/src/Scaffolding/DataModel/ProjectInstitute.cs index 2562b230dba1fad4b7d22bca2c4cf4612fe3ab2c..0039de3581dad363c9be29f25b124239305dd167 100644 --- a/src/Scaffolding/DataModel/ProjectInstitute.cs +++ b/src/Scaffolding/DataModel/ProjectInstitute.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ProjectInstitute diff --git a/src/Scaffolding/DataModel/ProjectQuota.cs b/src/Scaffolding/DataModel/ProjectQuota.cs index a64d449825fe008732d01a886e28779868f349b6..c066c930a4a84e6fa56c420af3a52a6f150feb28 100644 --- a/src/Scaffolding/DataModel/ProjectQuota.cs +++ b/src/Scaffolding/DataModel/ProjectQuota.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ProjectQuota diff --git a/src/Scaffolding/DataModel/ProjectResource.cs b/src/Scaffolding/DataModel/ProjectResource.cs index d66f35c122d6a97c606b3902c27639a0a1e6c086..33cc60434b7025f9d62ce70734ea371119230a07 100644 --- a/src/Scaffolding/DataModel/ProjectResource.cs +++ b/src/Scaffolding/DataModel/ProjectResource.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ProjectResource diff --git a/src/Scaffolding/DataModel/ProjectRole.cs b/src/Scaffolding/DataModel/ProjectRole.cs index daccbd261b35b3c740f542ebd4a1570824437785..5689809da7de6c19b79b1387e2e374206213c3a3 100644 --- a/src/Scaffolding/DataModel/ProjectRole.cs +++ b/src/Scaffolding/DataModel/ProjectRole.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ProjectRole diff --git a/src/Scaffolding/DataModel/RdsS3resourceType.cs b/src/Scaffolding/DataModel/RdsS3resourceType.cs index d12f37f8729fba7a3183927fbf69df4beae39ad4..6d2fe6d3f4f356ae28539057f77eccdc1995b5a2 100644 --- a/src/Scaffolding/DataModel/RdsS3resourceType.cs +++ b/src/Scaffolding/DataModel/RdsS3resourceType.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class RdsS3resourceType diff --git a/src/Scaffolding/DataModel/RdsS3wormResourceType.cs b/src/Scaffolding/DataModel/RdsS3wormResourceType.cs index f1e983acc4138dcdbf529cd9a6681679222c67cd..bed83e7e359e32db6fa92ab62b6f0770e838d5e9 100644 --- a/src/Scaffolding/DataModel/RdsS3wormResourceType.cs +++ b/src/Scaffolding/DataModel/RdsS3wormResourceType.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class RdsS3wormResourceType diff --git a/src/Scaffolding/DataModel/RdsresourceType.cs b/src/Scaffolding/DataModel/RdsresourceType.cs index 158142d103d4043109542acfc3313b5ebe8d1eaf..325cf59e003a2262836534dedaa98576934606b9 100644 --- a/src/Scaffolding/DataModel/RdsresourceType.cs +++ b/src/Scaffolding/DataModel/RdsresourceType.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class RdsresourceType diff --git a/src/Scaffolding/DataModel/Resource.cs b/src/Scaffolding/DataModel/Resource.cs index 9fc62ec0c9c59f49885f08b028d83802ce6e2549..d528af2741387c682db33c4b3dbdd1e5d4a9266d 100644 --- a/src/Scaffolding/DataModel/Resource.cs +++ b/src/Scaffolding/DataModel/Resource.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Resource diff --git a/src/Scaffolding/DataModel/ResourceDiscipline.cs b/src/Scaffolding/DataModel/ResourceDiscipline.cs index bdf727a9551a7bac7d11897291932d79325835f7..8aa629a154a11438a3a416e1632102e7f3a2b329 100644 --- a/src/Scaffolding/DataModel/ResourceDiscipline.cs +++ b/src/Scaffolding/DataModel/ResourceDiscipline.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ResourceDiscipline diff --git a/src/Scaffolding/DataModel/ResourceType.cs b/src/Scaffolding/DataModel/ResourceType.cs index 29483469cbedfd6a5d2075fcb44c29714b8697fa..3446862c8528f196ad39fe9dfcba1e2e6fd0f93c 100644 --- a/src/Scaffolding/DataModel/ResourceType.cs +++ b/src/Scaffolding/DataModel/ResourceType.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class ResourceType diff --git a/src/Scaffolding/DataModel/Role.cs b/src/Scaffolding/DataModel/Role.cs index e43b5987a282d2f2dc3b9e90eaa50c866d3bbd6a..af33132cd100282ec60fb3d8ff6a05fc56a6ad3d 100644 --- a/src/Scaffolding/DataModel/Role.cs +++ b/src/Scaffolding/DataModel/Role.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Role diff --git a/src/Scaffolding/DataModel/S3resourceType.cs b/src/Scaffolding/DataModel/S3resourceType.cs index 0547f3b61929f97a6254ac323890316bd3988d2a..eebca74dbd42de80a3a22439e98360ccaafa33e6 100644 --- a/src/Scaffolding/DataModel/S3resourceType.cs +++ b/src/Scaffolding/DataModel/S3resourceType.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class S3resourceType diff --git a/src/Scaffolding/DataModel/SubProject.cs b/src/Scaffolding/DataModel/SubProject.cs index bf47edd86680bfd87cf4072d2f0745f3a9cf1e9e..c10b03504d2cb0799cda1681c72d7785834b12b1 100644 --- a/src/Scaffolding/DataModel/SubProject.cs +++ b/src/Scaffolding/DataModel/SubProject.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class SubProject diff --git a/src/Scaffolding/DataModel/Title.cs b/src/Scaffolding/DataModel/Title.cs index b921efaf4baed497648813abe7bc57f932a9888b..5bcbfe7dd3f476e696c7699960a9b20dbaa24a56 100644 --- a/src/Scaffolding/DataModel/Title.cs +++ b/src/Scaffolding/DataModel/Title.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Title diff --git a/src/Scaffolding/DataModel/Tosaccepted.cs b/src/Scaffolding/DataModel/Tosaccepted.cs index 6eefb860cca67e9236190f361b4c1613fa375bc4..9ff5959965287a425b80b2a8e1bf3002b8bd7c7d 100644 --- a/src/Scaffolding/DataModel/Tosaccepted.cs +++ b/src/Scaffolding/DataModel/Tosaccepted.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Tosaccepted diff --git a/src/Scaffolding/DataModel/User.cs b/src/Scaffolding/DataModel/User.cs index 5d7ef888b1925fb46a791dfe153fa07419615684..a459fceba82bc5404e2bdf707e3dc64025e64cd8 100644 --- a/src/Scaffolding/DataModel/User.cs +++ b/src/Scaffolding/DataModel/User.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class User diff --git a/src/Scaffolding/DataModel/UserDiscipline.cs b/src/Scaffolding/DataModel/UserDiscipline.cs index c4c7be05317ee015eab396d35581848b8f1c5955..ccabb856de2960e4d2cf85c29c4033a34e33a118 100644 --- a/src/Scaffolding/DataModel/UserDiscipline.cs +++ b/src/Scaffolding/DataModel/UserDiscipline.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class UserDiscipline diff --git a/src/Scaffolding/DataModel/VersionInfo.cs b/src/Scaffolding/DataModel/VersionInfo.cs index 043ca3ce48528d09b68bc48e08306c080dde545e..475f698bd99906a8fbda98935595f97a75421a22 100644 --- a/src/Scaffolding/DataModel/VersionInfo.cs +++ b/src/Scaffolding/DataModel/VersionInfo.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class VersionInfo diff --git a/src/Scaffolding/DataModel/Visibility.cs b/src/Scaffolding/DataModel/Visibility.cs index 8022d3f32a99f218f94523f4f3d91c9c1776e9a4..f796cb5d815f73d833b24ca4178b70a3c4d9de55 100644 --- a/src/Scaffolding/DataModel/Visibility.cs +++ b/src/Scaffolding/DataModel/Visibility.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -// Code scaffolded by EF Core assumes nullable reference types (NRTs) are not used or disabled. -// If you have enabled NRTs for your project, then un-comment the following line: -// #nullable disable - namespace Coscine.Database.DataModel { public partial class Visibility diff --git a/src/Scaffolding/Scaffolding.csproj b/src/Scaffolding/Scaffolding.csproj index e8e5720d2ce8463a33373813ebc8c3df401bc373..c59f70b5c4fccf87ff301315a998e1b2698acd5d 100644 --- a/src/Scaffolding/Scaffolding.csproj +++ b/src/Scaffolding/Scaffolding.csproj @@ -2,13 +2,13 @@ <PropertyGroup> <RootNamespace>Coscine.Database</RootNamespace> <AssemblyName>Coscine.Database.Scaffolding</AssemblyName> - <TargetFrameworks>net6.0;net461</TargetFrameworks> + <TargetFramework>net6.0</TargetFramework> <Version>2.17.0</Version> </PropertyGroup> + <ItemGroup> <PackageReference Include="Inflector.NetStandard" Version="1.2.2" /> - <!-- Note: use Microsoft.EntityFrameworkCore Version 3.x.x for compatibility with net461 --> - <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.12" PrivateAssets="all" /> - <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.12" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.11" PrivateAssets="all" /> + <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.11" /> </ItemGroup> </Project>