From 26b4940f2e3f95f44e468d5e2d08ad7af0595da3 Mon Sep 17 00:00:00 2001 From: Marcel Nellesen <nellesen@itc.rwth-aachen.de> Date: Fri, 28 Feb 2020 14:48:15 +0100 Subject: [PATCH] New: moved models and return objects coscine/issues#670 New: better connection string settings coscine/issues#670 --- .gitlab-ci.yml | 10 - publishDocs.ps1 | 19 - src/Database.Tests/Database.Tests.csproj | 30 +- .../CopyMe.SqlServer.tt.txt | 56 - .../DataAnnotations.ttinclude | 65 - .../LinqToDB.Templates/DataModel.ttinclude | 871 ------- .../EditableObject.ttinclude | 250 -- .../LinqToDB.Templates/Humanizer.ttinclude | 15 - ...inqToDB.SqlServer.SqlTypes.Tools.ttinclude | 3 - .../LinqToDB.SqlServer.Tools.ttinclude | 2 - .../LinqToDB.SqlServer.ttinclude | 144 -- .../LinqToDB.Tools.ttinclude | 1 - .../LinqToDB.Templates/LinqToDB.ttinclude | 1044 -------- .../MultipleFiles.ttinclude | 70 - .../NotifyDataErrorInfo.ttinclude | 133 - .../NotifyPropertyChanged.ttinclude | 382 --- .../ObsoleteAttributes.ttinclude | 100 - .../PluralizationService.ttinclude | 185 -- .../LinqToDB.Templates/T4Model.ttinclude | 1564 ------------ .../LinqToDB.Templates/Validation.ttinclude | 189 -- src/Database.Tests/ModelTests.cs | 37 +- src/Database.Tests/Properties/AssemblyInfo.cs | 6 +- src/Database.Tests/TestCoscineDB.cs | 10 +- src/Database.Tests/packages.config | 2 + src/Database.sln | 9 - src/Database/App.config | 17 + src/Database/DataModel/CsDatabase.tt | 11 +- src/Database/Database.csproj | 58 + src/Database/Database.nuspec | 2 +- src/Database/Models/DatabaseModel.cs | 97 + src/Database/Models/DisciplineModel.cs | 25 + .../Models/ExternalAuthenticatorModel.cs | 25 + src/Database/Models/ExternalIdModel.cs | 29 + .../Models/GitlabResourceTypeModel.cs | 25 + src/Database/Models/InstituteModel.cs | 25 + src/Database/Models/LicenseModel.cs | 23 + src/Database/Models/MetadataModel.cs | 60 + src/Database/Models/ProjectDisciplineModel.cs | 25 + src/Database/Models/ProjectInstituteModel.cs | 25 + src/Database/Models/ProjectModel.cs | 390 +++ src/Database/Models/ProjectResourceModel.cs | 25 + src/Database/Models/ProjectRoleModel.cs | 68 + src/Database/Models/RDSResourceTypeModel.cs | 25 + .../Models/ResourceDisciplineModel.cs | 25 + src/Database/Models/ResourceModel.cs | 346 +++ src/Database/Models/ResourceTypeModel.cs | 25 + src/Database/Models/RoleModel.cs | 35 + src/Database/Models/S3ResourceTypeModel.cs | 25 + src/Database/Models/SubProjectModel.cs | 34 + src/Database/Models/UserModel.cs | 25 + src/Database/Models/VisibilityModel.cs | 25 + src/Database/Properties/AssemblyInfo.cs | 6 +- .../ReturnObjects/DisciplineObject.cs | 22 + .../ReturnObjects/GitlabResourceTypeObject.cs | 22 + src/Database/ReturnObjects/IReturnObject.cs | 6 + src/Database/ReturnObjects/InstituteObject.cs | 19 + src/Database/ReturnObjects/LicenseObject.cs | 18 + src/Database/ReturnObjects/ProjectObject.cs | 47 + .../ReturnObjects/ProjectRoleObject.cs | 20 + .../ReturnObjects/RDSResourceTypeObject.cs | 19 + src/Database/ReturnObjects/ResourceObject.cs | 51 + .../ReturnObjects/ResourceTypeObject.cs | 22 + .../ReturnObjects/ResourceTypeOptionObject.cs | 9 + src/Database/ReturnObjects/RoleObject.cs | 18 + .../ReturnObjects/S3ResourceTypeObject.cs | 22 + src/Database/ReturnObjects/UserObject.cs | 30 + .../ReturnObjects/VisibilityObject.cs | 17 + .../ReturnObjects/WaterbutlerFolder.cs | 52 + .../Settings/ConnectionStringSettings.cs | 12 + src/Database/Settings/CoscineSettings.cs | 47 + src/Database/Util/DatabaseConnection.cs | 27 + src/Database/Util/UserRoles.cs | 8 + src/Database/packages.config | 3 + src/Migrator/App.config | 6 - src/Migrator/Assets/Institutes.csv | 1357 ----------- src/Migrator/Assets/Licenses.rdf | 101 - src/Migrator/Assets/dfg_structure.rdf | 2138 ----------------- .../CopyMe.SqlServer.tt.txt | 56 - .../DataAnnotations.ttinclude | 65 - .../LinqToDB.Templates/DataModel.ttinclude | 871 ------- .../EditableObject.ttinclude | 250 -- .../LinqToDB.Templates/Humanizer.ttinclude | 15 - ...inqToDB.SqlServer.SqlTypes.Tools.ttinclude | 3 - .../LinqToDB.SqlServer.Tools.ttinclude | 2 - .../LinqToDB.SqlServer.ttinclude | 144 -- .../LinqToDB.Tools.ttinclude | 1 - .../LinqToDB.Templates/LinqToDB.ttinclude | 1044 -------- .../MultipleFiles.ttinclude | 70 - .../NotifyDataErrorInfo.ttinclude | 133 - .../NotifyPropertyChanged.ttinclude | 382 --- .../ObsoleteAttributes.ttinclude | 100 - .../PluralizationService.ttinclude | 185 -- .../LinqToDB.Templates/T4Model.ttinclude | 1564 ------------ .../LinqToDB.Templates/Validation.ttinclude | 189 -- .../Migration201907011352ProjectApi.cs | 145 -- .../Migration201907081510EnhanceProjectApi.cs | 29 - .../Migration201907100900UserProfilesApi.cs | 91 - .../Migration201908071616RdsResource.cs | 19 - .../Migration201908121401GitlabResource.cs | 18 - ...igration201908231520ResourceDisplayName.cs | 18 - .../Migrations/Migration201908290941ORCiD.cs | 22 - ...Migration201909111125ProjectEnhancement.cs | 111 - .../Migration201909160919UserEnhancement.cs | 20 - ...igration201909190938ResourceEnhancement.cs | 102 - ...igration201910021300ResourceDescription.cs | 18 - ...ration201910161154InstitutesDisciplines.cs | 78 - .../Migration201910241600ResourceMetadata.cs | 20 - .../Migration201911040900EnglishDFG.cs | 122 - .../Migration201911121400Logging.cs | 39 - .../Migration201912060900BucketApplication.cs | 52 - ...Migration201912091553ShibbolethAddition.cs | 33 - .../Migration202001071100ExtendLogging.cs | 26 - .../Migration202001131100ResourceCreator.cs | 27 - .../Migration202001270800ResourceFlags.cs | 27 - ...gration202002041409ProjectDeletedColumn.cs | 24 - .../Migration202002101300MoreLicenses.cs | 62 - src/Migrator/Migrator.cs | 90 - src/Migrator/Migrator.csproj | 212 -- src/Migrator/Program.cs | 79 - src/Migrator/Properties/AssemblyInfo.cs | 16 - src/Migrator/packages.config | 36 - 121 files changed, 2010 insertions(+), 15391 deletions(-) delete mode 100644 publishDocs.ps1 delete mode 100644 src/Database.Tests/LinqToDB.Templates/CopyMe.SqlServer.tt.txt delete mode 100644 src/Database.Tests/LinqToDB.Templates/DataAnnotations.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/DataModel.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/EditableObject.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/Humanizer.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.SqlTypes.Tools.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.Tools.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/LinqToDB.Tools.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/LinqToDB.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/MultipleFiles.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/NotifyDataErrorInfo.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/NotifyPropertyChanged.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/ObsoleteAttributes.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/PluralizationService.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/T4Model.ttinclude delete mode 100644 src/Database.Tests/LinqToDB.Templates/Validation.ttinclude create mode 100644 src/Database/App.config create mode 100644 src/Database/Models/DatabaseModel.cs create mode 100644 src/Database/Models/DisciplineModel.cs create mode 100644 src/Database/Models/ExternalAuthenticatorModel.cs create mode 100644 src/Database/Models/ExternalIdModel.cs create mode 100644 src/Database/Models/GitlabResourceTypeModel.cs create mode 100644 src/Database/Models/InstituteModel.cs create mode 100644 src/Database/Models/LicenseModel.cs create mode 100644 src/Database/Models/MetadataModel.cs create mode 100644 src/Database/Models/ProjectDisciplineModel.cs create mode 100644 src/Database/Models/ProjectInstituteModel.cs create mode 100644 src/Database/Models/ProjectModel.cs create mode 100644 src/Database/Models/ProjectResourceModel.cs create mode 100644 src/Database/Models/ProjectRoleModel.cs create mode 100644 src/Database/Models/RDSResourceTypeModel.cs create mode 100644 src/Database/Models/ResourceDisciplineModel.cs create mode 100644 src/Database/Models/ResourceModel.cs create mode 100644 src/Database/Models/ResourceTypeModel.cs create mode 100644 src/Database/Models/RoleModel.cs create mode 100644 src/Database/Models/S3ResourceTypeModel.cs create mode 100644 src/Database/Models/SubProjectModel.cs create mode 100644 src/Database/Models/UserModel.cs create mode 100644 src/Database/Models/VisibilityModel.cs create mode 100644 src/Database/ReturnObjects/DisciplineObject.cs create mode 100644 src/Database/ReturnObjects/GitlabResourceTypeObject.cs create mode 100644 src/Database/ReturnObjects/IReturnObject.cs create mode 100644 src/Database/ReturnObjects/InstituteObject.cs create mode 100644 src/Database/ReturnObjects/LicenseObject.cs create mode 100644 src/Database/ReturnObjects/ProjectObject.cs create mode 100644 src/Database/ReturnObjects/ProjectRoleObject.cs create mode 100644 src/Database/ReturnObjects/RDSResourceTypeObject.cs create mode 100644 src/Database/ReturnObjects/ResourceObject.cs create mode 100644 src/Database/ReturnObjects/ResourceTypeObject.cs create mode 100644 src/Database/ReturnObjects/ResourceTypeOptionObject.cs create mode 100644 src/Database/ReturnObjects/RoleObject.cs create mode 100644 src/Database/ReturnObjects/S3ResourceTypeObject.cs create mode 100644 src/Database/ReturnObjects/UserObject.cs create mode 100644 src/Database/ReturnObjects/VisibilityObject.cs create mode 100644 src/Database/ReturnObjects/WaterbutlerFolder.cs create mode 100644 src/Database/Settings/ConnectionStringSettings.cs create mode 100644 src/Database/Settings/CoscineSettings.cs create mode 100644 src/Database/Util/DatabaseConnection.cs create mode 100644 src/Database/Util/UserRoles.cs delete mode 100644 src/Migrator/App.config delete mode 100644 src/Migrator/Assets/Institutes.csv delete mode 100644 src/Migrator/Assets/Licenses.rdf delete mode 100644 src/Migrator/Assets/dfg_structure.rdf delete mode 100644 src/Migrator/LinqToDB.Templates/CopyMe.SqlServer.tt.txt delete mode 100644 src/Migrator/LinqToDB.Templates/DataAnnotations.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/DataModel.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/EditableObject.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/Humanizer.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.SqlTypes.Tools.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.Tools.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/LinqToDB.Tools.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/LinqToDB.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/MultipleFiles.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/NotifyDataErrorInfo.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/NotifyPropertyChanged.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/ObsoleteAttributes.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/PluralizationService.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/T4Model.ttinclude delete mode 100644 src/Migrator/LinqToDB.Templates/Validation.ttinclude delete mode 100644 src/Migrator/Migrations/Migration201907011352ProjectApi.cs delete mode 100644 src/Migrator/Migrations/Migration201907081510EnhanceProjectApi.cs delete mode 100644 src/Migrator/Migrations/Migration201907100900UserProfilesApi.cs delete mode 100644 src/Migrator/Migrations/Migration201908071616RdsResource.cs delete mode 100644 src/Migrator/Migrations/Migration201908121401GitlabResource.cs delete mode 100644 src/Migrator/Migrations/Migration201908231520ResourceDisplayName.cs delete mode 100644 src/Migrator/Migrations/Migration201908290941ORCiD.cs delete mode 100644 src/Migrator/Migrations/Migration201909111125ProjectEnhancement.cs delete mode 100644 src/Migrator/Migrations/Migration201909160919UserEnhancement.cs delete mode 100644 src/Migrator/Migrations/Migration201909190938ResourceEnhancement.cs delete mode 100644 src/Migrator/Migrations/Migration201910021300ResourceDescription.cs delete mode 100644 src/Migrator/Migrations/Migration201910161154InstitutesDisciplines.cs delete mode 100644 src/Migrator/Migrations/Migration201910241600ResourceMetadata.cs delete mode 100644 src/Migrator/Migrations/Migration201911040900EnglishDFG.cs delete mode 100644 src/Migrator/Migrations/Migration201911121400Logging.cs delete mode 100644 src/Migrator/Migrations/Migration201912060900BucketApplication.cs delete mode 100644 src/Migrator/Migrations/Migration201912091553ShibbolethAddition.cs delete mode 100644 src/Migrator/Migrations/Migration202001071100ExtendLogging.cs delete mode 100644 src/Migrator/Migrations/Migration202001131100ResourceCreator.cs delete mode 100644 src/Migrator/Migrations/Migration202001270800ResourceFlags.cs delete mode 100644 src/Migrator/Migrations/Migration202002041409ProjectDeletedColumn.cs delete mode 100644 src/Migrator/Migrations/Migration202002101300MoreLicenses.cs delete mode 100644 src/Migrator/Migrator.cs delete mode 100644 src/Migrator/Migrator.csproj delete mode 100644 src/Migrator/Program.cs delete mode 100644 src/Migrator/Properties/AssemblyInfo.cs delete mode 100644 src/Migrator/packages.config diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 70f41bc..b339a45 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,5 @@ stages: - test - - docs - release - releasetrigger @@ -19,15 +18,6 @@ cake:Test: - master - tags -docs: - stage: docs - script: - - .\publishDocs.ps1 $GITLAB_TOKEN - variables: - GIT_STRATEGY: clone - only: - - tags - cake:Release: stage: release script: diff --git a/publishDocs.ps1 b/publishDocs.ps1 deleted file mode 100644 index f49b3b9..0000000 --- a/publishDocs.ps1 +++ /dev/null @@ -1,19 +0,0 @@ -param( - $token -) - -$remoteUrl = git config --get remote.origin.url -$remoteUrl = $remoteUrl.replace("git@", "") -$remoteUrl = $remoteUrl -replace "https(.*?)@","" -$remoteUrl = $remoteUrl.replace(":", "/") -$remoteUrl = $remoteUrl.replace(".git", ".wiki.git") - -$temporaryFolderName = "publishDocsTempFolder" - -git clone "https://gitlab-ci-token:$($token)@$($remoteUrl)" $temporaryFolderName -cd $temporaryFolderName -Remove-Item * -cp -r ../docs/* ./ -git add . -git commit -m "Docs: Documentation Update" -git push \ No newline at end of file diff --git a/src/Database.Tests/Database.Tests.csproj b/src/Database.Tests/Database.Tests.csproj index 24994a4..e69aa88 100644 --- a/src/Database.Tests/Database.Tests.csproj +++ b/src/Database.Tests/Database.Tests.csproj @@ -35,6 +35,12 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="Consul, Version=0.7.2.6, Culture=neutral, PublicKeyToken=20a6ad9a81df1d95, processorArchitecture=MSIL"> + <HintPath>..\packages\Consul.0.7.2.6\lib\net45\Consul.dll</HintPath> + </Reference> + <Reference Include="Coscine.Configuration, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL"> + <HintPath>..\packages\Coscine.Configuration.1.4.0\lib\net461\Coscine.Configuration.dll</HintPath> + </Reference> <Reference Include="FluentMigrator, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> <HintPath>..\packages\FluentMigrator.3.1.3\lib\net461\FluentMigrator.dll</HintPath> </Reference> @@ -65,6 +71,7 @@ </Reference> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Core" /> + <Reference Include="System.Net.Http.WebRequest" /> <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.4.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath> </Reference> @@ -87,39 +94,16 @@ <Compile Include="TestCoscineDB.cs" /> </ItemGroup> <ItemGroup> - <None Include="LinqToDB.Templates\DataAnnotations.ttinclude" /> - <None Include="LinqToDB.Templates\DataModel.ttinclude" /> - <None Include="LinqToDB.Templates\EditableObject.ttinclude" /> - <None Include="LinqToDB.Templates\Humanizer.ttinclude" /> - <None Include="LinqToDB.Templates\LinqToDB.SqlServer.SqlTypes.Tools.ttinclude" /> - <None Include="LinqToDB.Templates\LinqToDB.SqlServer.Tools.ttinclude" /> - <None Include="LinqToDB.Templates\LinqToDB.SqlServer.ttinclude" /> - <None Include="LinqToDB.Templates\LinqToDB.Tools.ttinclude" /> - <None Include="LinqToDB.Templates\LinqToDB.ttinclude" /> - <None Include="LinqToDB.Templates\MultipleFiles.ttinclude" /> - <None Include="LinqToDB.Templates\NotifyDataErrorInfo.ttinclude" /> - <None Include="LinqToDB.Templates\NotifyPropertyChanged.ttinclude" /> - <None Include="LinqToDB.Templates\ObsoleteAttributes.ttinclude" /> - <None Include="LinqToDB.Templates\PluralizationService.ttinclude" /> - <None Include="LinqToDB.Templates\T4Model.ttinclude" /> - <None Include="LinqToDB.Templates\Validation.ttinclude" /> <None Include="packages.config" /> </ItemGroup> <ItemGroup> <WCFMetadata Include="Connected Services\" /> </ItemGroup> - <ItemGroup> - <Content Include="LinqToDB.Templates\CopyMe.SqlServer.tt.txt" /> - </ItemGroup> <ItemGroup> <ProjectReference Include="..\Database\Database.csproj"> <Project>{a7369ea1-f9ab-49d2-bdb1-c3facd37bbd0}</Project> <Name>Database</Name> </ProjectReference> - <ProjectReference Include="..\Migrator\Migrator.csproj"> - <Project>{a48a255e-d08a-4336-b481-266debfabde9}</Project> - <Name>Migrator</Name> - </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> diff --git a/src/Database.Tests/LinqToDB.Templates/CopyMe.SqlServer.tt.txt b/src/Database.Tests/LinqToDB.Templates/CopyMe.SqlServer.tt.txt deleted file mode 100644 index 891b6b7..0000000 --- a/src/Database.Tests/LinqToDB.Templates/CopyMe.SqlServer.tt.txt +++ /dev/null @@ -1,56 +0,0 @@ -<#@ template language="C#" debug="True" hostSpecific="True" #> -<#@ output extension=".generated.cs" #> -<#@ include file="$(LinqToDBT4SqlServerTemplatesDirectory)LinqToDB.SqlServer.Tools.ttinclude" #> -<#@ include file="$(LinqToDBT4SqlServerTemplatesDirectory)PluralizationService.ttinclude" #> -<# //@ include file="$(ProjectDir)LinqToDB.Templates\LinqToDB.SqlServer.Tools.ttinclude" #> -<# //@ include file="$(ProjectDir)LinqToDB.Templates\PluralizationService.ttinclude" #> -<# - /* - 1. Create new *.tt file (e.g. MyDatabase.tt) in a folder where you would like to generate your data model - and copy content from this file to it. For example: - - MyProject - DataModels - MyDatabase.tt - - 2. Modify the connection settings below to connect to your database. - - 3. Add connection string to the web/app.config file: - - <connectionStrings> - <add name="MyDatabase" providerName="System.Data.SqlClient" - connectionString="Data Source=.;Database=MyDatabase;User Id=User;Password=TestPassword;" /> - </connectionStrings> - - 4. To access your database use the following code: - - using (var db = new MyDatabaseDB()) - { - var q = - from c in db.Customers - select c; - - foreach (var c in q) - Console.WriteLine(c.ContactName); - } - - 5. See more at https://github.com/linq2db/t4models - - If you need to use the Microsoft.SqlServer.Types namespace, install the Microsoft.SqlServer.Types nuget, - and replace the following include at the top of this file: - - "$(ProjectDir)LinqToDB.Templates\LinqToDB.SqlServer.Tools.ttinclude" - - with - - "$(ProjectDir)LinqToDB.Templates\LinqToDB.SqlServer.SqlTypes.Tools.ttinclude" - */ - - NamespaceName = "DataModels"; - - LoadSqlServerMetadata("MyServer", "MyDatabase", "User", "Password"); -// LoadSqlServerMetadata(".", "MyDatabase"); // Integrated Security -// LoadSqlServerMetadata(string connectionString); - - GenerateModel(); -#> diff --git a/src/Database.Tests/LinqToDB.Templates/DataAnnotations.ttinclude b/src/Database.Tests/LinqToDB.Templates/DataAnnotations.ttinclude deleted file mode 100644 index a98aea2..0000000 --- a/src/Database.Tests/LinqToDB.Templates/DataAnnotations.ttinclude +++ /dev/null @@ -1,65 +0,0 @@ -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - beforeGenerateModel(); - DataAnnotationsImpl(); - }; - } -#> -<#+ -void DataAnnotationsImpl() -{ - foreach (Class cl in GetTreeNodes(Model).OfType<Class>()) - { - foreach (var p in GetTreeNodes(cl).OfType<Property>()) - { - if (p.DisplayName != null) - { - p.Attributes.Add(new Attribute("Display", "Name=" + ToStringLiteral(p.DisplayName)) { IsSeparated = true }); - } - - if (p.IsRequired) - { - var attr = new Attribute("Required") { IsSeparated = true }; - - if (p.IsRequiredMessage != null) - attr.Parameters.Add(string.Format("ErrorMessage=" + ToStringLiteral(p.IsRequiredMessage), p.DisplayName ?? p.Name)); - - p.Attributes.Add(attr); - } - - if (p.StringLength > 0) - { - var attr = new Attribute("StringLength", p.StringLength.ToString()) { IsSeparated = true }; - - if (p.StringLengthMessage != null) - attr.Parameters.Add(string.Format("ErrorMessage=" + ToStringLiteral(p.StringLengthMessage), p.DisplayName ?? p.Name)); - - p.Attributes.Add(attr); - -// p.Attributes.Add( -// new Attribute("StringLength", -// p.StringLength.ToString(), -// "ErrorMessage=" + ToStringLiteral(string.Format( -// "The {0} must be a string with a maximum length of {1}.", -// p.DisplayName ?? "field", -// p.StringLength))) -// { -// IsSeparated = true -// }); - } - } - } -} - -partial class Property -{ - public string DisplayName; - public bool IsRequired; - public string IsRequiredMessage; - public int StringLength; - public string StringLengthMessage; -} -#> diff --git a/src/Database.Tests/LinqToDB.Templates/DataModel.ttinclude b/src/Database.Tests/LinqToDB.Templates/DataModel.ttinclude deleted file mode 100644 index b28013d..0000000 --- a/src/Database.Tests/LinqToDB.Templates/DataModel.ttinclude +++ /dev/null @@ -1,871 +0,0 @@ -<#@ assembly name="System.Data" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="LinqToDB.SchemaProvider" #> -<#@ import namespace="LinqToDB.Data" #> -<#@ include file="T4Model.ttinclude" #> -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - GenerateTypesFromMetadata(); - beforeGenerateModel(); - }; - } -#><#+ - -string NamespaceName -{ - get { return Model.Namespace.Name; } - set { Model.Namespace.Name = value; } -} - -string DatabaseName = null; -string DataContextName = null; -string BaseDataContextClass = null; -string BaseEntityClass = null; -string OneToManyAssociationType = "IEnumerable<{0}>"; - -bool GenerateDatabaseName = false; -bool GenerateConstructors = true; -string DefaultConfiguration = null; -bool GenerateAssociations = true; -bool GenerateBackReferences = true; -bool GenerateAssociationExtensions = false; -bool ReplaceSimilarTables = true; -bool IncludeDefaultSchema = true; - -Class DataContextObject; - -bool PluralizeClassNames = false; -bool SingularizeClassNames = true; -bool PluralizeDataContextPropertyNames = true; -bool SingularizeDataContextPropertyNames = false; - -bool NormalizeNames = true; - -private Func<string, bool, string> _toValidName; -Func<string, bool, string> ToValidName -{ - get { return _toValidName ?? ToValidNameDefault; } - set { _toValidName = value; } -} - -private Func<string, bool, string> _convertToCompilabl; -Func<string, bool, string> ConvertToCompilable -{ - get { return _convertToCompilabl ?? ConvertToCompilableDefault; } - set { _convertToCompilabl = value; } -} - -private Func<ForeignKey, string> _getAssociationExtensionPluralName; -Func<ForeignKey, string> GetAssociationExtensionPluralName -{ - get { return _getAssociationExtensionPluralName ?? GetAssociationExtensionPluralNameDefault; } - set { _getAssociationExtensionPluralName = value; } -} - -private Func<ForeignKey, string> _getAssociationExtensionSingularName; -Func<ForeignKey, string> GetAssociationExtensionSinglularName -{ - get { return _getAssociationExtensionSingularName ?? GetAssociationExtensionSinglularNameDefault; } - set { _getAssociationExtensionSingularName = value; } -} - -LinqToDB.SchemaProvider.GetSchemaOptions GetSchemaOptions = - new LinqToDB.SchemaProvider.GetSchemaOptions(); - -LinqToDB.SqlProvider.ISqlBuilder SqlBuilder; - -Func<TableSchema,Table> LoadProviderSpecificTable = tableSchema => null; - -static Func<ColumnSchema,string> ConvertColumnMemberType = (c) => c.MemberType; -static Func<TableSchema,ColumnSchema,string> ConvertTableColumnMemberType = (t,c) => ConvertColumnMemberType(c); -static Func<ProcedureSchema,ColumnSchema,string> ConvertProcedureColumnMemberType = (t,c) => ConvertColumnMemberType(c); - -HashSet<string> KeyWords = new HashSet<string> -{ - "abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", - "class", "const", "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", - "event", "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "goto", - "if", "implicit", "in", "int", "interface", "internal", "is", "lock", "long", "new", - "null", "object", "operator", "out", "override", "params", "private", "protected", "public", "readonly", - "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static", "struct", "switch", - "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", - "using", "virtual", "volatile", "void", "while", "namespace", "string" -}; - -void LoadServerMetadata(DataConnection dataConnection) -{ - SqlBuilder = dataConnection.DataProvider.CreateSqlBuilder(); - - var sp = dataConnection.DataProvider.GetSchemaProvider(); - var db = sp.GetSchema(dataConnection, GetSchemaOptions); - - if (DatabaseName == null && GenerateDatabaseName) - DatabaseName = db.Database; - - if (DataContextName == null) - DataContextObject.Name = DataContextName = ToValidName(db.Database, true) + "DB"; - - DataContextObject.Comment.Add("/ <summary>"); - DataContextObject.Comment.Add("/ Database : " + db.Database); - DataContextObject.Comment.Add("/ Data Source : " + db.DataSource); - DataContextObject.Comment.Add("/ Server Version : " + db.ServerVersion); - DataContextObject.Comment.Add("/ </summary>"); - - var tables = db.Tables - .Where(t => !t.IsProviderSpecific) - .Select(t => new - { - t, - key = t.IsDefaultSchema ? t.TableName : t.SchemaName + "." + t.TableName, - table = new Table - { - TableSchema = t, - IsDefaultSchema = t.IsDefaultSchema, - Schema = t.IsDefaultSchema && !IncludeDefaultSchema || string.IsNullOrEmpty(t.SchemaName)? null : t.SchemaName, - BaseClass = BaseEntityClass, - TableName = t.TableName, - TypeName = t.TypeName, - DataContextPropertyName = t.TypeName, - IsView = t.IsView, - IsProviderSpecific = false, - Description = t.Description, - Columns = t.Columns.ToDictionary( - c => c.ColumnName, - c => new Column - { - ColumnName = c.ColumnName, - ColumnType = c.ColumnType, - DataType = "DataType." + c.DataType, - Length = c.Length, - Precision = c.Precision, - Scale = c.Scale, - IsNullable = c.IsNullable, - IsIdentity = c.IsIdentity, - IsPrimaryKey = c.IsPrimaryKey, - PrimaryKeyOrder = c.PrimaryKeyOrder, - MemberName = CheckType(c.SystemType, c.MemberName), - TypeBuilder = () => ConvertTableColumnMemberType(t, c), - SkipOnInsert = c.SkipOnInsert, - SkipOnUpdate = c.SkipOnUpdate, - Description = c.Description, - }) - } - }) - .ToList(); - - if (PluralizeClassNames || SingularizeClassNames) - { - var foundNames = new HashSet<string>(tables.Select(t => t.table.Schema + '.' + t.table.TypeName)); - - foreach (var t in tables) - { - var newName = t.table.TypeName; - newName = - PluralizeClassNames ? ToPlural (newName) : - SingularizeClassNames ? ToSingular(newName) : newName; - - if (newName != t.table.TypeName) - { - if (!foundNames.Contains(t.table.Schema + '.' + newName)) - { - t.table.TypeName = newName; - foundNames.Add(t.table.Schema + '.' + newName); - } - } - } - } - - if (PluralizeDataContextPropertyNames || SingularizeDataContextPropertyNames) - { - var foundNames = new HashSet<string>(tables.Select(t => t.table.Schema + '.' + t.table.DataContextPropertyName)); - - foreach (var t in tables) - { - var newName = t.table.DataContextPropertyName; - newName = - PluralizeDataContextPropertyNames ? ToPlural (newName) : - SingularizeDataContextPropertyNames ? ToSingular(newName) : newName; - - if (newName != t.table.TypeName) - { - if (!foundNames.Contains(t.table.Schema + '.' + newName)) - { - t.table.DataContextPropertyName = newName; - foundNames.Add(t.table.Schema + '.' + newName); - } - } - } - } - - tables.AddRange(db.Tables - .Where(t => t.IsProviderSpecific) - .Select(t => new - { - t, - key = t.IsDefaultSchema ? t.TableName : t.SchemaName + "." + t.TableName, - table = LoadProviderSpecificTable(t) - }) - .Where(t => t.table != null)); - - foreach (var t in tables) - Tables.Add(t.key, t.table); - - var keys = - ( - from t in tables - from k in t.t.ForeignKeys - let otherTable = tables.Where(tbl => tbl.t == k.OtherTable).Select(tbl => tbl.table).Single() - select new - { - k, - k.KeyName, - t, - key = new ForeignKey - { - KeyName = k.KeyName, - OtherTable = otherTable, - OtherColumns = k.OtherColumns.Select(c => otherTable.Columns[c.ColumnName]).ToList(), - ThisColumns = k.ThisColumns. Select(c => t.table. Columns[c.ColumnName]).ToList(), - CanBeNull = k.CanBeNull, - MemberName = k.MemberName, - AssociationType = (AssociationType)(int)k.AssociationType, - } - } - ).ToList(); - - foreach (var key in keys) - { - key.t.table.ForeignKeys.Add( - key.k.OtherTable.IsDefaultSchema ? key.KeyName : key.k.OtherTable.SchemaName + "." + key.KeyName, - key.key); - - if (key.k.BackReference != null) - key.key.BackReference = keys.First(k => k.k == key.k.BackReference).key; - - key.key.MemberName = key.key.MemberName.Replace(".", string.Empty); - - key.key.MemberName = key.key.AssociationType == AssociationType.OneToMany ? - ToPlural(key.key.MemberName) : ToSingular(key.key.MemberName); - } - - var procedures = db.Procedures - .Select(p => new - { - p, - key = p.IsDefaultSchema ? p.ProcedureName : p.SchemaName + "." + p.ProcedureName, - proc = new Procedure - { - Schema = (p.IsDefaultSchema && !IncludeDefaultSchema) || string.IsNullOrEmpty(p.SchemaName)? null : p.SchemaName, - ProcedureName = p.ProcedureName, - Name = ToValidName(p.MemberName, true), - IsFunction = p.IsFunction, - IsTableFunction = p.IsTableFunction, - IsAggregateFunction = p.IsAggregateFunction, - IsDefaultSchema = p.IsDefaultSchema, - IsLoaded = p.IsLoaded, - ResultTable = p.ResultTable == null ? null : - new Table - { - TypeName = ToValidName( - PluralizeClassNames ? ToPlural (p.ResultTable.TypeName) : - SingularizeClassNames ? ToSingular(p.ResultTable.TypeName) : p.ResultTable.TypeName, true), - Columns = ToDictionary( - p.ResultTable.Columns, - c => c.ColumnName, - c => new Column - { - ColumnName = c.ColumnName, - ColumnType = c.ColumnType, - IsNullable = c.IsNullable, - IsIdentity = c.IsIdentity, - IsPrimaryKey = c.IsPrimaryKey, - PrimaryKeyOrder = c.PrimaryKeyOrder, - MemberName = CheckColumnName(CheckType(c.SystemType, c.MemberName)), - TypeBuilder = () => ConvertProcedureColumnMemberType(p, c), - SkipOnInsert = c.SkipOnInsert, - SkipOnUpdate = c.SkipOnUpdate, - Description = c.Description, - }, - (c,n) => - { - c.IsDuplicateOrEmpty = true; - return "$" + (c.MemberName = "Column" + n); - }) - }, - ResultException = p.ResultException, - SimilarTables = p.SimilarTables == null ? new List<Table>() : - p.SimilarTables - .Select(t => tables.Single(tbl => tbl.t == t).table) - .ToList(), - ProcParameters = p.Parameters - .Select(pr => new Parameter - { - SchemaName = pr.SchemaName, - SchemaType = pr.SchemaType, - IsIn = pr.IsIn, - IsOut = pr.IsOut, - IsResult = pr.IsResult, - Size = pr.Size, - ParameterName = CheckParameterName(CheckType(pr.SystemType, pr.ParameterName)), - ParameterType = pr.ParameterType, - SystemType = pr.SystemType, - DataType = pr.DataType.ToString(), - }) - .ToList(), - } - }) - .ToList(); - - foreach (var p in procedures) - { - if (ReplaceSimilarTables) - if (p.proc.SimilarTables.Count() == 1 || p.proc.SimilarTables.Count(t => !t.IsView) == 1) - p.proc.ResultTable = p.proc.SimilarTables.Count() == 1 ? - p.proc.SimilarTables[0] : - p.proc.SimilarTables.First(t => !t.IsView); - - Procedures[p.key] = p.proc; - } -} - -Dictionary<string,TR> ToDictionary<T,TR>(IEnumerable<T> source, Func<T,string> keyGetter, Func<T,TR> objGetter, Func<TR,int,string> getKeyName) -{ - var dic = new Dictionary<string,TR>(); - var current = 1; - - foreach (var item in source) - { - var key = keyGetter(item); - var obj = objGetter(item); - - if (string.IsNullOrEmpty(key) || dic.ContainsKey(key)) - key = getKeyName(obj, current); - - dic.Add(key, obj); - - current++; - } - - return dic; -} - -string CheckType(Type type, string typeName) -{ - if (!Model.Usings.Contains(type.Namespace)) - Model.Usings.Add(type.Namespace); - return typeName; -} - -string CheckColumnName(string memberName) -{ - if (string.IsNullOrEmpty(memberName)) - memberName = "Empty"; - else - { - memberName = memberName - .Replace("%", "Percent") - .Replace(">", "Greater") - .Replace("<", "Lower") - .Replace("+", "Plus") - .Replace('(', '_') - .Replace(')', '_') - .Replace('-', '_') - .Replace('|', '_') - .Replace(',', '_') - .Replace('"', '_') - .Replace("'", "_") - .Replace(".", "_") - .Replace("\u00A3", "Pound"); - - if (KeyWords.Contains(memberName)) - memberName = "@" + memberName; - } - return memberName; -} - -string CheckParameterName(string parameterName) -{ - var invalidParameterNames = new List<string> - { - "@DataType" - }; - - var result = parameterName; - while (invalidParameterNames.Contains(result)) - { - result = result + "_"; - } - return result; -} - -Action AfterLoadMetadata = () => {}; - -void LoadMetadata(DataConnection dataConnection) -{ - if (DataContextObject == null) - { - DataContextObject = new Class(DataContextName) { BaseClass = BaseDataContextClass, }; - - Model.Types.Add(DataContextObject); - } - - LoadServerMetadata(dataConnection); - - if (Tables.Values.SelectMany(_ => _.ForeignKeys.Values).Any(_ => _.AssociationType == AssociationType.OneToMany)) - Model.Usings.Add("System.Collections.Generic"); - - foreach (var t in Tables.Values) - { - if (KeyWords.Contains(t.TypeName)) - t.TypeName = "@" + t.TypeName; - - if (KeyWords.Contains(t.DataContextPropertyName)) - t.DataContextPropertyName = "@" + t.DataContextPropertyName; - - t.TypeName = ConvertToCompilable(t.TypeName, true); - t.DataContextPropertyName = ConvertToCompilable(t.DataContextPropertyName, true); - - foreach (var col in t.Columns.Values) - { - if (KeyWords.Contains(col.MemberName)) - col.MemberName = "@" + col.MemberName; - - col.MemberName = ConvertToCompilable(col.MemberName, true); - - if (col.MemberName == t.TypeName) - col.MemberName += "_Column"; - } - - foreach (var fk in t.ForeignKeys.Values) - { - if (KeyWords.Contains(fk.MemberName)) - fk.MemberName = "@" + fk.MemberName; - - fk.MemberName = ConvertToCompilable(fk.MemberName, true); - - if (fk.MemberName == t.TypeName) - fk.MemberName += "_FK"; - } - } - - foreach (var t in Tables.Values) - { - var hasDuplicates = t.Columns.Values - .Select(c => c.MemberName) - .Concat(t.ForeignKeys.Values.Select(f => f.MemberName)) - .ToLookup(n => n) - .Any(g => g.Count() > 1); - - if (hasDuplicates) - { - foreach (var fk in t.ForeignKeys.Values) - { - var mayDuplicate = t.Columns.Values - .Select(c => c.MemberName) - .Concat(t.ForeignKeys.Values.Where(f => f != fk).Select(f => f.MemberName)); - - fk.MemberName = SuggestNoDuplicate(mayDuplicate, fk.MemberName, "FK"); - } - - foreach (var col in t.Columns.Values) - { - var mayDuplicate = t.Columns.Values - .Where(c => c != col) - .Select(c => c.MemberName) - .Concat(t.ForeignKeys.Values.Select(fk => fk.MemberName)); - - col.MemberName = SuggestNoDuplicate(mayDuplicate, col.MemberName, null); - } - } - } - - foreach (var proc in Procedures.Values) - { - proc.Name = ConvertToCompilable(proc.Name, false); - - if (KeyWords.Contains(proc.Name)) - proc.Name = "@" + proc.Name; - - foreach (var param in proc.ProcParameters) - { - if (KeyWords.Contains(param.ParameterName)) - param.ParameterName = ConvertToCompilable("@" + param.ParameterName, true); - } - } - - AfterLoadMetadata(); -} - -string SuggestNoDuplicate(IEnumerable<string> currentNames, string newName, string prefix) -{ - var names = new HashSet<string>(currentNames); - var result = newName; - if (names.Contains(result)) - { - if (!string.IsNullOrEmpty(prefix)) - result = prefix + result; - if (names.Contains(result)) - { - var counter = 0; - var number = string.Concat(result.Reverse().Take(6).TakeWhile(c => Char.IsDigit(c)).Reverse()); - if (!string.IsNullOrEmpty(number)) - { - if (int.TryParse(number, out counter)) - { - result = result.Remove(result.Length - number.Length); - } - } - - do - { - ++counter; - if (!names.Contains(result + counter)) - { - result = result + counter; - break; - } - } - while(true); - } - } - - return result; -} - -string ConvertToCompilableDefault(string name, bool mayRemoveUnderscore) -{ - var query = - from c in name - select char.IsLetterOrDigit(c) || c == '@' ? c : '_'; - - return ToValidName(new string(query.ToArray()), mayRemoveUnderscore); -} - -Table GetTable(string name) -{ - Table tbl; - - if (Tables.TryGetValue(name, out tbl)) - return tbl; - - WriteLine("#error Table '" + name + "' not found."); - WriteLine("/*"); - WriteLine("\tExisting tables:"); - WriteLine(""); - - foreach (var key in Tables.Keys) - WriteLine("\t" + key); - - WriteLine(" */"); - - throw new ArgumentException("Table '" + name + "' not found."); -} - -Procedure GetProcedure(string name) -{ - Procedure proc; - - if (Procedures.TryGetValue(name, out proc)) - return proc; - - WriteLine("#error Procedure '" + name + "' not found."); - WriteLine(""); - WriteLine("/*"); - WriteLine("\tExisting procedures:"); - WriteLine(""); - - foreach (var key in Procedures.Keys) - WriteLine("\t" + key); - - WriteLine(" */"); - - throw new ArgumentException("Procedure '" + name + "' not found."); -} - -Column GetColumn(string tableName, string columnName) -{ - var tbl = GetTable(tableName); - - Column col; - - if (tbl.Columns.TryGetValue(columnName, out col)) - return col; - - WriteLine("#error Column '" + tableName + "'.'" + columnName + "' not found."); - WriteLine(""); - WriteLine("/*"); - WriteLine("\tExisting '" + tableName + "'columns:"); - WriteLine(""); - - foreach (var key in tbl.Columns.Keys) - WriteLine("\t" + key); - - WriteLine(" */"); - - throw new ArgumentException("Column '" + tableName + "'.'" + columnName + "' not found."); -} - -ForeignKey GetFK(string tableName, string fkName) -{ - return GetForeignKey(tableName, fkName); -} - -ForeignKey GetForeignKey(string tableName, string fkName) -{ - var tbl = GetTable(tableName); - - ForeignKey col; - - if (tbl.ForeignKeys.TryGetValue(fkName, out col)) - return col; - - WriteLine("#error FK '" + tableName + "'.'" + fkName + "' not found."); - WriteLine(""); - WriteLine("/*"); - WriteLine("\tExisting '" + tableName + "'FKs:"); - WriteLine(""); - - foreach (var key in tbl.ForeignKeys.Keys) - WriteLine("\t" + key); - - WriteLine(" */"); - - throw new ArgumentException("FK '" + tableName + "'.'" + fkName + "' not found."); -} - - -public TableContext SetTable(string tableName, - string TypeName = null, - string DataContextPropertyName = null) -{ - var ctx = new TableContext { Transformation = this, TableName = tableName }; - - if (TypeName != null || DataContextPropertyName != null) - { - var t = GetTable(tableName); - - if (TypeName != null) t.TypeName = TypeName; - if (DataContextPropertyName != null) t.DataContextPropertyName = DataContextPropertyName; - } - - return ctx; -} - -public class TableContext -{ - public GeneratedTextTransformation Transformation; - public string TableName; - - public TableContext Column(string columnName, - string MemberName = null, - string Type = null, - bool? IsNullable = null, - string Conditional = null) - { - var c = Transformation.GetColumn(TableName, columnName); - - if (MemberName != null) c.MemberName = MemberName; - if (Type != null) c.TypeBuilder = () => Type; - if (IsNullable != null) c.IsNullable = IsNullable.Value; - if (Conditional != null) c.Conditional = Conditional; - - return this; - } - - public TableContext FK(string fkName, - string MemberName = null, - AssociationType? AssociationType = null, - bool? CanBeNull = null) - { - var c = Transformation.GetFK(TableName, fkName); - - if (MemberName != null) c.MemberName = MemberName; - if (AssociationType != null) c.AssociationType = AssociationType.Value; - if (CanBeNull != null) c.CanBeNull = CanBeNull.Value; - - return this; - } -} - - -Dictionary<string,Table> Tables = new Dictionary<string,Table> (); -Dictionary<string,Procedure> Procedures = new Dictionary<string,Procedure>(); - -public partial class Table : Class -{ - public TableSchema TableSchema { get; set; } - public string Schema { get; set; } - public string TableName { get; set; } - public string DataContextPropertyName { get; set; } - public MemberBase DataContextProperty { get; set; } - public bool IsView { get; set; } - public bool IsProviderSpecific { get; set; } - public bool IsDefaultSchema { get; set; } - public string Description { get; set; } - public string AliasPropertyName { get; set; } - public string AliasTypeName { get; set; } - public string TypePrefix { get; set; } - - public string TypeName - { - get { return Name; } - set { Name = value; } - } - - public Dictionary<string,Column> Columns; - public Dictionary<string,ForeignKey> ForeignKeys = new Dictionary<string,ForeignKey>(); -} - -public partial class Column : Property -{ - public string ColumnName; // Column name in database - public bool IsNullable; - public bool IsIdentity; - public string ColumnType; // Type of the column in database - public string DataType; - public long? Length; - public int? Precision; - public int? Scale; - public DbType DbType; - public string Description; - public bool IsPrimaryKey; - public int PrimaryKeyOrder; - public bool SkipOnUpdate; - public bool SkipOnInsert; - public bool IsDuplicateOrEmpty; - public bool IsDiscriminator; - public string AliasName; - - public string MemberName - { - get { return Name; } - set { Name = value; } - } -} - -public enum AssociationType -{ - Auto, - OneToOne, - OneToMany, - ManyToOne, -} - -public partial class ForeignKey : Property -{ - public string KeyName; - public Table OtherTable; - public List<Column> ThisColumns; - public List<Column> OtherColumns; - public bool CanBeNull; - public ForeignKey BackReference; - - public string MemberName - { - get { return Name; } - set { Name = value; } - } - - private AssociationType _associationType = AssociationType.Auto; - public AssociationType AssociationType - { - get { return _associationType; } - set - { - _associationType = value; - - if (BackReference != null) - { - switch (value) - { - case AssociationType.Auto : BackReference.AssociationType = AssociationType.Auto; break; - case AssociationType.OneToOne : BackReference.AssociationType = AssociationType.OneToOne; break; - case AssociationType.OneToMany : BackReference.AssociationType = AssociationType.ManyToOne; break; - case AssociationType.ManyToOne : BackReference.AssociationType = AssociationType.OneToMany; break; - } - } - } - } -} - -public partial class Procedure : Method -{ - public string Schema { get; set; } - public string ProcedureName { get; set; } - public bool IsFunction { get; set; } - public bool IsTableFunction { get; set; } - public bool IsAggregateFunction { get; set; } - public bool IsDefaultSchema { get; set; } - public bool IsLoaded { get; set; } - - public Table ResultTable { get; set; } - public Exception ResultException { get; set; } - public List<Table> SimilarTables { get; set; } - public List<Parameter> ProcParameters { get; set; } -} - -public class Parameter -{ - public string SchemaName { get; set; } - public string SchemaType { get; set; } - public bool IsIn { get; set; } - public bool IsOut { get; set; } - public bool IsResult { get; set; } - public long? Size { get; set; } - - public string ParameterName { get; set; } - public string ParameterType { get; set; } - public Type SystemType { get; set; } - public string DataType { get; set; } -} - -private int _counter = 0; - -string ToValidNameDefault(string name, bool mayRemoveUnderscore) -{ - if (NormalizeNames && mayRemoveUnderscore && name.Contains("_")) - { - name = SplitAndJoin(name, "", '_'); - } - - if (name.Contains(".")) - { - name = SplitAndJoin(name, "", '.'); - } - - if (name.Length > 0 && char.IsDigit(name[0])) - name = "_" + name; - - if (string.IsNullOrEmpty(name)) - name = "_" + _counter++; - - if (NormalizeNames) - { - name = char.ToUpper(name[0]) + name.Substring(1); - } - - return name; -} - -static string SplitAndJoin(string value, string join, params char[] split) -{ - var ss = value.Split(split, StringSplitOptions.RemoveEmptyEntries) - .Select(s => char.ToUpper(s[0]) + (s.Substring(1).All(char.IsUpper) ? s.Substring(1).ToLower() : s.Substring(1))); - - return string.Join(join, ss.ToArray()); -} - -private string GetAssociationExtensionSinglularNameDefault(ForeignKey key) -{ - return ToSingular(key.Name); -} - -private string GetAssociationExtensionPluralNameDefault(ForeignKey key) -{ - return ToPlural(ToSingular(key.Name)); -} - -#> diff --git a/src/Database.Tests/LinqToDB.Templates/EditableObject.ttinclude b/src/Database.Tests/LinqToDB.Templates/EditableObject.ttinclude deleted file mode 100644 index e9506c2..0000000 --- a/src/Database.Tests/LinqToDB.Templates/EditableObject.ttinclude +++ /dev/null @@ -1,250 +0,0 @@ -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - EditableObjectImpl(); - beforeGenerateModel(); - }; - - SetPropertyValueAction += (obj,prop,val) => - { - if (prop == "IsEditable") - obj.IsEditable = (bool)val; - }; - } -#> -<#+ -void EditableObjectImpl() -{ - foreach (Property prop in GetTreeNodes(Model).OfType<Property>().Where(p => p.IsEditable).ToList()) - { - SetPropertyValue(prop, "IsNotifying", true); - - List<IClassMember> parentMembers; - - MemberGroup gr = null; - - if (prop.Parent is Class) - { - var parent = (Class)prop.Parent; - parentMembers = parent.Members; - } - else - { - var parent = (MemberGroup)prop.Parent; - parentMembers = parent.Members; - - parent.IsCompact = false; - } - - var name = prop.Name.Trim(); - var type = prop.BuildType().Trim(); - - if (gr == null) - { - gr = new MemberGroup - { - Region = name + " : " + type, - Members = { prop }, - IsPropertyGroup = true, - }; - - var index = parentMembers.IndexOf(prop); - - parentMembers.RemoveAt(index); - parentMembers.Insert (index, gr); - } - - var originalField = new Field(() => type, "_original" + name) - { - AccessModifier = AccessModifier.Private, - InsertBlankLineAfter = false, - }; - - gr.Members.Insert(0, originalField); - - var currentField = new Field(() => type, " _current" + name) - { - AccessModifier = AccessModifier.Private, - InsertBlankLineAfter = false, - }; - - if (prop.InitValue != null) - currentField.InitValue = prop.InitValue; - - gr.Members.Insert(0, currentField); - - prop.Name = " " + name; - prop.TypeBuilder = () => " " + type; - prop.IsAuto = false; - - if (prop.HasGetter) prop.GetBodyBuilders.Add(() => new [] { "return " + currentField.Name.Trim() + ";" }); - if (prop.HasSetter) prop.SetBodyBuilders.Add(() => new [] { currentField.Name.Trim() + " = value;" }); - - var ac = new Method (() => "void", "Accept" + name + "Changes", null, () => new[] { string.Format("_original{0} = _current{0};", name) }); - var rc = new Method (() => "void", "Reject" + name + "Changes", null, () => new[] { string.Format("{0} = _original{0};", name) }); - var id = new Property(() => "bool", "Is" + name + "Dirty") - .InitGetter(() => new [] { string.Format(prop.IsDirtyText, "_current" + name, "_original" + name) }); - - gr.Members.Add(new MemberGroup - { - Region = "EditableObject support", - Members = { ac, rc, id }, - }); - - prop.Parent.SetTree(); - } - - foreach (Class cl in GetTreeNodes(Model).OfType<Class>()) - { - var props = GetTreeNodes(cl).OfType<Property>().Where(p => p.IsEditable).ToList(); - - if (props.Count > 0) - { - if (props.Any(p => p.IsEditable)) - { - var ctor = GetTreeNodes(cl) - .OfType<Method>() - .FirstOrDefault(m => m.Name == cl.Name && m.ParameterBuilders.Count == 0); - - if (ctor == null) - { - ctor = new Method(null, cl.Name); - cl.Members.Insert(0, ctor); - } - - ctor.BodyBuilders.Add(() => new [] { "AcceptChanges();" }); - } - - var maxLen = props.Max(p => p.Name.Trim().Length); - - var ac = new Method(() => "void", "AcceptChanges") { IsVirtual = true }; - var rc = new Method(() => "void", "RejectChanges") { IsVirtual = true }; - var id = new Property(() => "bool", "IsDirty") { IsAuto = false, HasSetter = false, IsVirtual = true }; - - ac.BodyBuilders.Add(() => new [] - { - "BeforeAcceptChanges();", - "" - }); - rc.BodyBuilders.Add(() => new [] - { - "BeforeRejectChanges();", - "" - }); - id.GetBodyBuilders.Add(() => new [] { "return" }); - - foreach (var p in props) - { - var name = p.Name.Trim(); - - ac.BodyBuilders.Add(() => new [] { string.Format("Accept{0}Changes();", name) }); - rc.BodyBuilders.Add(() => new [] { string.Format("Reject{0}Changes();", name) }); - id.GetBodyBuilders.Add(() => new [] { string.Format("\tIs{0}Dirty{1} ||", name, LenDiff(maxLen, name)) }); - } - - ac.BodyBuilders.Add(() => new[] - { - "", - "AfterAcceptChanges();" - }); - rc.BodyBuilders.Add(() => new[] - { - "", - "AfterRejectChanges();" - }); - var getBody = id.BuildGetBody().ToArray(); - getBody[getBody.Length - 1] = getBody[getBody.Length - 1].Trim(' ' , '|') + ";"; - id.GetBodyBuilders.Clear(); - id.GetBodyBuilders.Add(() => getBody); - - cl.Members.Add(new MemberGroup - { - Region = "EditableObject support", - Members = - { - new MemberGroup - { - IsCompact = true, - Members = - { - new Method(() => "void", "BeforeAcceptChanges") { AccessModifier = AccessModifier.Partial }, - new Method(() => "void", "AfterAcceptChanges") { AccessModifier = AccessModifier.Partial }, - } - }, - ac, - new MemberGroup - { - IsCompact = true, - Members = - { - new Method(() => "void", "BeforeRejectChanges") { AccessModifier = AccessModifier.Partial }, - new Method(() => "void", "AfterRejectChanges") { AccessModifier = AccessModifier.Partial }, - } - }, - rc, - id - }, - }); - - if (!cl.Interfaces.Contains("IEditableObject")) - { - if (!Model.Usings.Contains("System.ComponentModel")) - Model.Usings.Add("System.ComponentModel"); - - cl.Interfaces.Add("IEditableObject"); - - cl.Members.Add(new MemberGroup - { - Region = "IEditableObject support", - Members = - { - new MemberGroup - { - IsCompact = true, - Members = - { - new Field (() => "bool", "_isEditing") { AccessModifier = AccessModifier.Private }, - new Property(() => "bool", " IsEditing").InitGetter(() => new [] { "_isEditing" }), - } - }, - new MemberGroup - { - IsCompact = true, - Members = - { - new Method(() => "void", "BeginEdit", null, () => new[] { "AcceptChanges();", "_isEditing = true;" }) { IsVirtual = true }, - new Method(() => "void", "CancelEdit", null, () => new[] { "_isEditing = false;", "RejectChanges();", }) { IsVirtual = true }, - new Method(() => "void", "EndEdit", null, () => new[] { "_isEditing = false;", "AcceptChanges();", }) { IsVirtual = true }, - } - }, - } - }); - } - } - - cl.SetTree(); - } -} - -partial class Property -{ - public bool IsEditable; - public string IsDirtyText = "{0} != {1}"; -} - -class EditableProperty : Property -{ - public EditableProperty() - { - IsEditable = true; - } - - public EditableProperty(string type, string name) - : base(() => type, name, null, null) - { - IsEditable = true; - } -} -#> diff --git a/src/Database.Tests/LinqToDB.Templates/Humanizer.ttinclude b/src/Database.Tests/LinqToDB.Templates/Humanizer.ttinclude deleted file mode 100644 index 17be091..0000000 --- a/src/Database.Tests/LinqToDB.Templates/Humanizer.ttinclude +++ /dev/null @@ -1,15 +0,0 @@ -<# -/* -To use this extension you should: -1) Reference Humanizer NuGet package into your project -2) Include Humanizer.ttinclude -3) Reference assembly like <_#@ assembly name="$(SolutionDir)\packages\Humanizer.Core.2.2.0\lib\netstandard1.0\Humanizer.dll" #_> -*/ -#> -<#@ import namespace="Humanizer" #> -<# - NormalizeNames = true; - ToPlural = s => s.Pluralize (inputIsKnownToBeSingular: false); - ToSingular = s => s.Singularize(inputIsKnownToBePlural: false); - ToValidName = (s, r) => s.Pascalize(); -#> diff --git a/src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.SqlTypes.Tools.ttinclude b/src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.SqlTypes.Tools.ttinclude deleted file mode 100644 index 05a8e66..0000000 --- a/src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.SqlTypes.Tools.ttinclude +++ /dev/null @@ -1,3 +0,0 @@ -<#@ assembly name="$(LinqToDBT4SqlServerToolsDirectory)Microsoft.SqlServer.Types.dll" #> -<#@ include file="LinqToDB.Tools.ttinclude" #> -<#@ include file="LinqToDB.SqlServer.SqlTypes.ttinclude" #> diff --git a/src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.Tools.ttinclude b/src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.Tools.ttinclude deleted file mode 100644 index fc678e1..0000000 --- a/src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.Tools.ttinclude +++ /dev/null @@ -1,2 +0,0 @@ -<#@ include file="LinqToDB.Tools.ttinclude" #> -<#@ include file="LinqToDB.SqlServer.ttinclude" #> diff --git a/src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.ttinclude b/src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.ttinclude deleted file mode 100644 index 29047c2..0000000 --- a/src/Database.Tests/LinqToDB.Templates/LinqToDB.SqlServer.ttinclude +++ /dev/null @@ -1,144 +0,0 @@ -<#@ include file="LinqToDB.ttinclude" #> -<# - { - GenerateProcedureDbType = p => p.DataType == "Structured" && p.SchemaType != null; - - var afterGenerateLinqToDBModel = AfterGenerateLinqToDBModel; - AfterGenerateLinqToDBModel = () => - { - afterGenerateLinqToDBModel(); - DoGenerateSqlServerFreeText(); - }; - - var buildColumnComparison = BuildColumnComparison; - BuildColumnComparison = (c, padding1, padding2, last) => - { - if (c.BuildType() == "SqlHierarchyId") - return string.Format("\t(bool)(t.{0}{1} == {0}{3}){2}", c.MemberName, padding1, last ? ");" : " &&", last ? "" : padding2); - else - return buildColumnComparison(c, padding1, padding2, last); - }; - } -#> -<#+ -bool GenerateSqlServerFreeText = true; // Defines whether to generate extensions for Free Text search, or not - -void DoGenerateSqlServerFreeText() -{ - if (!GenerateSqlServerFreeText) - return; - - Model.Usings.Add("System.Collections.Generic"); - Model.Usings.Add("System.Linq.Expressions"); - Model.Usings.Add("System.Reflection"); - Model.Usings.Add("LinqToDB"); - Model.Usings.Add("LinqToDB.DataProvider.SqlServer"); - Model.Usings.Add("LinqToDB.Extensions"); - - DataContextObject.Members.Add( - new MemberGroup - { - Region = "FreeTextTable", - Members = - { - new Class("FreeTextKey", - new MemberGroup - { - IsCompact = true, - Members = - { - new Field(() => "T", "Key"), - new Field(() => "int", "Rank") - } - }) - { - GenericArguments = { "T" }, - IsPartial = false - }, - - new Field(() => "MethodInfo", "_freeTextTableMethod1") - { - AccessModifier = AccessModifier.Private, - IsStatic = true, - InitValue = "typeof(" + DataContextObject.Name + ").GetMethod(\"FreeTextTable\", new Type[] { typeof(string), typeof(string) })" - }, - - new Method(() => "ITable<FreeTextKey<TKey>>", "FreeTextTable", - new Func<string>[] { () => "string field", () => "string text" }, - () => new[] - { - "return this.GetTable<FreeTextKey<TKey>>(", - " this,", - " _freeTextTableMethod1,", - " field,", - " text);", - }) - { - GenericArguments = new List<string>() { "TTable", "TKey" }, - Attributes = { new Attribute("FreeTextTableExpression") } - }, - - new Field(() => "MethodInfo", "_freeTextTableMethod2") - { - AccessModifier = AccessModifier.Private, - IsStatic = true, - InitValue = Environment.NewLine + - " typeof(" + DataContextObject.Name + ").GetMethods()" + Environment.NewLine + - " .Where(m => m.Name == \"FreeTextTable\" && m.IsGenericMethod && m.GetParameters().Length == 2)" + Environment.NewLine + - " .Where(m => m.GetParameters()[0].ParameterType.IsGenericTypeEx() && m.GetParameters()[0].ParameterType.GetGenericTypeDefinition() == typeof(Expression<>))" + Environment.NewLine + - " .Where(m => m.GetParameters()[1].ParameterType == typeof(string))" + Environment.NewLine + - " .Single()" - }, - - new Method(() => "ITable<FreeTextKey<TKey>>", "FreeTextTable", - new Func<string>[] { () => "Expression<Func<TTable,string>> fieldSelector", () => "string text" }, - () => new[] - { - "return this.GetTable<FreeTextKey<TKey>>(", - " this,", - " _freeTextTableMethod2,", - " fieldSelector,", - " text);", - }) - { - GenericArguments = { "TTable", "TKey" }, - Attributes = { new Attribute("FreeTextTableExpression") } - }, - } - } - ); -} - -LinqToDB.Data.DataConnection GetSqlServerConnection(string connectionString) -{ - return LinqToDB.DataProvider.SqlServer.SqlServerTools.CreateDataConnection(connectionString); -} - -LinqToDB.Data.DataConnection GetSqlServerConnection(string server, string database) -{ - return GetSqlServerConnection(string.Format("Data Source={0};Database={1};Integrated Security=SSPI", server, database)); -} - -LinqToDB.Data.DataConnection GetSqlServerConnection(string server, string database, string user, string password) -{ - return GetSqlServerConnection(string.Format("Server={0};Database={1};User Id={2};Password={3};", server, database, user, password)); -} - -void LoadSqlServerMetadata(string connectionString) -{ - using (var dataConnection = GetSqlServerConnection(connectionString)) - LoadMetadata(dataConnection); -} - -void LoadSqlServerMetadata(string server, string database) -{ - using (var dataConnection = GetSqlServerConnection(server, database)) - LoadMetadata(dataConnection); -} - -void LoadSqlServerMetadata(string server, string database, string user, string password) -{ - using (var dataConnection = GetSqlServerConnection(server, database, user, password)) - LoadMetadata(dataConnection); -} -#> diff --git a/src/Database.Tests/LinqToDB.Templates/LinqToDB.Tools.ttinclude b/src/Database.Tests/LinqToDB.Templates/LinqToDB.Tools.ttinclude deleted file mode 100644 index d804bb8..0000000 --- a/src/Database.Tests/LinqToDB.Templates/LinqToDB.Tools.ttinclude +++ /dev/null @@ -1 +0,0 @@ -<#@ assembly name="$(LinqToDBT4ToolsDirectory)linq2db.dll" #> diff --git a/src/Database.Tests/LinqToDB.Templates/LinqToDB.ttinclude b/src/Database.Tests/LinqToDB.Templates/LinqToDB.ttinclude deleted file mode 100644 index 0aa897a..0000000 --- a/src/Database.Tests/LinqToDB.Templates/LinqToDB.ttinclude +++ /dev/null @@ -1,1044 +0,0 @@ -<#@ assembly name="System.Data" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="LinqToDB.Data" #> -<#@ import namespace="System.Text" #> -<#@ include file="DataModel.ttinclude" #> -<# - if (BaseDataContextClass == null) - BaseDataContextClass = "LinqToDB.Data.DataConnection"; -#> -<#+ -Action BeforeGenerateLinqToDBModel = () => {}; -Action AfterGenerateLinqToDBModel = () => {}; - -Func<Table,MemberBase> GenerateProviderSpecificTable = t => null; -Func<Parameter, bool> GenerateProcedureDbType = p => false; - -bool GenerateObsoleteAttributeForAliases = false; -bool GenerateFindExtensions = true; -bool IsCompactColumns = true; -bool IsCompactColumnAliases = true; -bool GenerateDataTypes = false; -bool? GenerateLengthProperty = null; -bool? GeneratePrecisionProperty = null; -bool? GenerateScaleProperty = null; -bool GenerateDbTypes = false; -bool GenerateSchemaAsType = false; -bool GenerateViews = true; -bool GenerateProcedureResultAsList = false; -bool PrefixTableMappingWithSchema = true; -string SchemaNameSuffix = "Schema"; -string SchemaDataContextTypeName = "DataContext"; - -Dictionary<string,string> SchemaNameMapping = new Dictionary<string,string>(); - -Func<string,string,IEnumerable<Method>> GetConstructors = (conf, name) => GetConstructorsImpl(conf, name); - -Func<Column, string, string, bool, string> BuildColumnComparison = (c, padding1, padding2, last) => -{ - return string.Format("\tt.{0}{1} == {0}{3}{2}", c.MemberName, padding1, last ? ");" : " &&", last ? "" : padding2); -}; - -static IEnumerable<Method> GetConstructorsImpl(string defaultConfiguration, string name) -{ - if (defaultConfiguration == null) - yield return new Method((Func<string>)null, name); - else - yield return new Method((Func<string>)null, name) { AfterSignature = { ": base(" + ToStringLiteral(defaultConfiguration) + ")" } }; - yield return new Method((Func<string>)null, name, new Func<string>[] { () => "string configuration" }) { AfterSignature = { ": base(configuration)" } }; -} - -void GenerateTypesFromMetadata() -{ - BeforeGenerateLinqToDBModel(); - - Model.Usings.Add("LinqToDB"); - Model.Usings.Add("LinqToDB.Mapping"); - - if (NamespaceName == null) - NamespaceName = "DataModel"; - - string schemaName; - - var schemas = - ( - from t in Tables.Values - where GenerateSchemaAsType && t.Schema != null && !t.TableSchema.IsDefaultSchema - group t by t.Schema into gr - orderby gr.Key - let typeName = SchemaNameMapping.TryGetValue(gr.Key, out schemaName) ? schemaName : gr.Key - select new - { - Name = gr.Key, - TypeName = typeName + SchemaNameSuffix, - PropertyName = typeName, - Props = new MemberGroup { IsCompact = true }, - Aliases = new MemberGroup { IsCompact = true, Region = "Alias members" }, - TableExtensions = new MemberGroup { Region = "Table Extensions" }, - Type = new Class(typeName + SchemaNameSuffix) { IsStatic = true }, - Tables = gr.ToList(), - DataContext = new Class(SchemaDataContextTypeName), - Procedures = new MemberGroup(), - Functions = new MemberGroup(), - TableFunctions = new MemberGroup { Region = "Table Functions" }, - } - ).ToDictionary(t => t.Name); - - var procSchemas = - ( - from p in Procedures.Values - where GenerateSchemaAsType && p.Schema != null && !p.IsDefaultSchema && !schemas.ContainsKey(p.Schema) - group p by p.Schema into gr - orderby gr.Key - let typeName = SchemaNameMapping.TryGetValue(gr.Key, out schemaName) ? schemaName : gr.Key - select new - { - Name = gr.Key, - TypeName = typeName + SchemaNameSuffix, - PropertyName = typeName, - Props = new MemberGroup { IsCompact = true }, - Aliases = new MemberGroup { IsCompact = true, Region = "Alias members" }, - TableExtensions = new MemberGroup { Region = "Table Extensions" }, - Type = new Class(typeName + SchemaNameSuffix) { IsStatic = true }, - Tables = new List<Table>(), - DataContext = new Class(SchemaDataContextTypeName), - Procedures = new MemberGroup(), - Functions = new MemberGroup(), - TableFunctions = new MemberGroup { Region = "Table Functions" }, - } - ).ToDictionary(s => s.Name); - - foreach(var schema in procSchemas) - schemas.Add(schema.Key, schema.Value); - - var defProps = new MemberGroup { IsCompact = true }; - var defAliases = new MemberGroup { IsCompact = true, Region = "Alias members" }; - var defTableExtensions = new MemberGroup { }; - - if (schemas.Count > 0) - { - var body = new List<Func<IEnumerable<string>>>(); - - var schemaGroup = new MemberGroup { Region = "Schemas" }; - var schemaMembers = new MemberGroup { IsCompact = true }; - - var maxLen1 = schemas.Values.Max(schema => schema.PropertyName.Trim().Length); - var maxLen2 = schemas.Values.Max(schema => schema.TypeName. Trim().Length); - - foreach (var schema in schemas.Values) - { - schemaMembers.Members.Add(new Property(() => schema.TypeName + "." + SchemaDataContextTypeName, schema.PropertyName)); - body.Add(() => new string[] { - schema.PropertyName + LenDiff(maxLen1, schema.PropertyName) + - " = new " + schema.TypeName + "." + LenDiff(maxLen2, schema.TypeName) + - SchemaDataContextTypeName + "(this);"}); - } - - schemaGroup.Members.Add(schemaMembers); - schemaGroup.Members.Add(new Method(() => "void", "InitSchemas", new Func<string>[0], body.ToArray())); - - DataContextObject.Members.Add(schemaGroup); - } - - if (GenerateConstructors) - { - foreach (var c in GetConstructors(DefaultConfiguration, DataContextObject.Name)) - { - if (c.BodyBuilders.Count > 0) - c.BodyBuilders.Add(() => new[] { "" }); - - if (schemas.Count > 0) - c.BodyBuilders.Add(() => new[] { "InitSchemas();" }); - - c.BodyBuilders.Add(() => new [] {"InitDataContext();", "InitMappingSchema();" }); - - DataContextObject.Members.Add(c); - } - } - - DataContextObject.Members.Add(new MemberGroup - { - IsCompact = true, - Members = - { - new Method(() => "void", "InitDataContext" ) { AccessModifier = AccessModifier.Partial }, - new Method(() => "void", "InitMappingSchema") { AccessModifier = AccessModifier.Partial } - } - }); - - if (Tables.Count > 0) - DataContextObject.Members.Insert(0, defProps); - - foreach (var schema in schemas.Values) - { - schema.Type.Members.Add(schema.DataContext); - schema.DataContext.Members.Insert(0, schema.Props); - - schema.DataContext.Members.Add(new Field (() => "IDataContext", "_dataContext") { AccessModifier = AccessModifier.Private, IsReadonly = true }); - schema.DataContext.Members.Add(new Method(() => null, schema.DataContext.Name, new Func<string>[] { () => "IDataContext dataContext" }, () => new[] { "_dataContext = dataContext;" })); - - foreach (var t in schema.Tables) - { - t.TypePrefix = schema.TypeName + "."; - } - } - - var associationExtensions = new MemberGroup() {Region = "Associations"}; - - foreach (var t in Tables.Values.OrderBy(tbl => tbl.IsProviderSpecific).ThenBy(tbl => tbl.TypeName)) - { - Action<Class> addType = tp => Model.Types.Add(tp); - var props = defProps; - var aliases = defAliases; - var tableExtensions = defTableExtensions; - - if (t.IsView && !GenerateViews) { - continue; - } - - var schema = t.Schema != null && schemas.ContainsKey(t.Schema) ? schemas[t.Schema] : null; - - if (schema != null) - { - var si = schemas[t.Schema]; - - addType = tp => si.Type.Members.Add(tp); - props = si.Props; - aliases = si.Aliases; - tableExtensions = si.TableExtensions; - } - - MemberBase dcProp = t.IsProviderSpecific ? - GenerateProviderSpecificTable(t) : - new Property( - () => string.Format("ITable<{0}>", t.TypeName), - t.DataContextPropertyName, - () => new[] { string.Format((schema == null ? "this" : "_dataContext") + ".GetTable<{0}>()", t.TypeName) }, - null); - - if (dcProp == null) continue; - - t.DataContextProperty = dcProp; - - props.Members.Add(dcProp); - - Property aProp = null; - - if (t.AliasPropertyName != null && t.AliasPropertyName != t.DataContextPropertyName) - { - aProp = new Property( - () => string.Format("ITable<{0}>", t.TypeName), - t.AliasPropertyName, - () => new[] { t.DataContextPropertyName }, - null); - - if (GenerateObsoleteAttributeForAliases) - aProp.Attributes.Add(new Attribute("Obsolete", ToStringLiteral("Use " + t.DataContextPropertyName + " instead."))); - - aliases.Members.Add(aProp); - } - - var tableAttrs = new List<string>(); - - if (DatabaseName != null) tableAttrs.Add("Database=" + ToStringLiteral(DatabaseName)); - if (t.Schema != null) tableAttrs.Add("Schema=" + ToStringLiteral(t.Schema)); - - tableAttrs.Add((tableAttrs.Count == 0 ? "" : "Name=") + ToStringLiteral(t.TableName)); - - if (t.IsView) - tableAttrs.Add("IsView=true"); - - t.Attributes.Add(new Attribute("Table", tableAttrs.ToArray()) { IsSeparated = true } ); - - var comments = new List<string>(); - - if (!string.IsNullOrWhiteSpace(t.Description)) - { - comments.Add("/ <summary>"); - foreach (var line in t.Description.Split('\n')) - comments.Add("/ " + line.TrimEnd()); - comments.Add("/ </summary>"); - } - - if (comments.Count > 0) - { - t. Comment.AddRange(comments); - dcProp.Comment.AddRange(comments); - - if (aProp != null) - aProp.Comment.AddRange(comments); - } - - var columns = new MemberGroup { IsCompact = IsCompactColumns }; - var columnAliases = new MemberGroup { IsCompact = IsCompactColumnAliases, Region = "Alias members" }; - var nPKs = t.Columns.Values.Count(c => c.IsPrimaryKey); - var allNullable = t.Columns.Values.All (c => c.IsNullable || c.IsIdentity); - var nameMaxLen = t.Columns.Values.Max (c => (int?)(c.MemberName == c.ColumnName - ? 0 - : ToStringLiteral(c.ColumnName).Length)) ?? 0; - var dbTypeMaxLen = t.Columns.Values.Max (c => (int?)(c.ColumnType.Length)) ?? 0; - var dataTypeMaxLen = t.Columns.Values.Where(c => c.DataType != null).Max (c => (int?)(c.DataType.Length)) ?? 0; - var dataTypePrefix = t.Columns.Values.Any (c => c.MemberName == "DataType") ? "LinqToDB." : ""; - - foreach (var c in t.Columns.Values) - { - // Column. - // - var ca = new Attribute("Column"); - var canBeReplaced = true; - - if (c.MemberName != c.ColumnName) - { - var columnNameInAttr = ToStringLiteral(c.ColumnName); - - var space = new string(' ', nameMaxLen - columnNameInAttr.Length); - - ca.Parameters.Add(columnNameInAttr + space); - canBeReplaced = false; - } - else if (nameMaxLen > 0) - { - ca.Parameters.Add(new string(' ', nameMaxLen)); - canBeReplaced = false; - } - - if (GenerateDbTypes) - { - var space = new string(' ', dbTypeMaxLen - c.ColumnType.Length); - - ca.Parameters.Add("DbType=" + ToStringLiteral(c.ColumnType) + space); - canBeReplaced = false; - } - - if (GenerateDataTypes) - { - var space = new string(' ', dataTypeMaxLen - c.DataType.Length); - ca.Parameters.Add("DataType=" + dataTypePrefix + c.DataType + space); - canBeReplaced = false; - } - - if (GenerateDataTypes && !GenerateLengthProperty.HasValue || GenerateLengthProperty == true) - { - if (c.Length != null) ca.Parameters.Add("Length=" + (c.Length == int.MaxValue ? "int.MaxValue" : c.Length.ToString())); - canBeReplaced = false; - } - - if (GenerateDataTypes && !GeneratePrecisionProperty.HasValue || GeneratePrecisionProperty == true) - { - if (c.Precision != null) ca.Parameters.Add("Precision=" + c.Precision); - canBeReplaced = false; - } - - if (GenerateDataTypes && !GenerateScaleProperty.HasValue || GenerateScaleProperty == true) - { - if (c.Scale != null) ca.Parameters.Add("Scale=" + c.Scale); - canBeReplaced = false; - } - - if (c.SkipOnInsert && !c.IsIdentity) - { - ca.Parameters.Add("SkipOnInsert=true"); - canBeReplaced = false; - } - - if (c.SkipOnUpdate && !c.IsIdentity) - { - ca.Parameters.Add("SkipOnUpdate=true"); - canBeReplaced = false; - } - - if (c.IsDiscriminator) - { - ca.Parameters.Add("IsDiscriminator=true"); - canBeReplaced = false; - } - - c.Attributes.Add(ca); - - // PK. - // - if (c.IsPrimaryKey) - { - var pka = new Attribute("PrimaryKey"); - - if (nPKs > 1) - pka.Parameters.Add(c.PrimaryKeyOrder.ToString()); - - if (canBeReplaced) - c.Attributes[0] = pka; - else - c.Attributes.Add(pka); - - canBeReplaced = false; - } - - // Identity. - // - if (c.IsIdentity) - { - var ida = new Attribute("Identity"); - - if (canBeReplaced) - c.Attributes[0] = ida; - else - c.Attributes.Add(ida); - - canBeReplaced = false; - } - - // Nullable. - // - if (c.IsNullable) - c.Attributes.Add(new Attribute((allNullable ? "" : " ") + "Nullable")); - else if (!c.IsIdentity) - c.Attributes.Add(new Attribute("NotNull")); - - var columnComments = new List<string>(); - - if (!string.IsNullOrWhiteSpace(c.Description)) - { - columnComments.Add("/ <summary>"); - foreach (var line in c.Description.Split('\n')) - columnComments.Add("/ " + line.TrimEnd()); - columnComments.Add("/ </summary>"); - } - - if (columnComments.Count > 0) - c.Comment.AddRange(columnComments); - - // End line comment. - // - c.EndLineComment = c.ColumnType; - - SetPropertyValue(c, "IsNotifying", true); - SetPropertyValue(c, "IsEditable", true); - - columns.Members.Add(c); - - // Alias. - // - if (c.AliasName != null && c.AliasName != c.MemberName) - { - var caProp = new Property( - c.TypeBuilder, - c.AliasName, - () => new[] { c.MemberName }, - () => new[] { c.MemberName + " = value;"}); - - caProp.Comment.AddRange(columnComments); - - if (GenerateObsoleteAttributeForAliases) - caProp.Attributes.Add(new Attribute("Obsolete", ToStringLiteral("Use " + c.MemberName + " instead."))); - - caProp.Attributes.Add(new Attribute("ColumnAlias" , ToStringLiteral(c.MemberName))); - - columnAliases.Members.Add(caProp); - } - } - - t.Members.Add(columns); - - if (columnAliases.Members.Count > 0) - t.Members.Add(columnAliases); - - if (GenerateAssociations || GenerateAssociationExtensions) - { - var keys = t.ForeignKeys.Values.ToList(); - - if (!GenerateBackReferences) - keys = keys.Where(k => k.BackReference != null).ToList(); - - if (keys.Count > 0) - { - var associations = new MemberGroup { Region = "Associations" }; - var extensionAssociations = new MemberGroup { Region = t.Name + " Associations"}; - - foreach (var key in keys.OrderBy(k => k.MemberName)) - { - key.Comment.Add("/ <summary>"); - key.Comment.Add("/ " + key.KeyName); - key.Comment.Add("/ </summary>"); - - if (key.AssociationType == AssociationType.OneToMany) - key.TypeBuilder = () => string.Format(OneToManyAssociationType, key.OtherTable.TypePrefix + key.OtherTable.TypeName); - else - key.TypeBuilder = () => key.OtherTable.TypePrefix + key.OtherTable.TypeName; - - var aa = new Attribute("Association"); - - aa.Parameters.Add("ThisKey=" + ToStringLiteral(string.Join(", ", (from c in key.ThisColumns select c.MemberName).ToArray()))); - aa.Parameters.Add("OtherKey=" + ToStringLiteral(string.Join(", ", (from c in key.OtherColumns select c.MemberName).ToArray()))); - aa.Parameters.Add("CanBeNull=" + (key.CanBeNull ? "true" : "false")); - - switch (key.AssociationType) - { - case AssociationType.OneToOne : aa.Parameters.Add("Relationship=Relationship.OneToOne"); break; - case AssociationType.OneToMany : aa.Parameters.Add("Relationship=Relationship.OneToMany"); break; - case AssociationType.ManyToOne : aa.Parameters.Add("Relationship=Relationship.ManyToOne"); break; - } - - if (key.BackReference != null) - { - if (!string.IsNullOrEmpty(key.KeyName)) - aa.Parameters.Add("KeyName=" + ToStringLiteral(key.KeyName)); - if (GenerateBackReferences && !string.IsNullOrEmpty(key.BackReference.MemberName)) - aa.Parameters.Add("BackReferenceName=" + ToStringLiteral(key.BackReference.MemberName)); - } - else - { - aa.Parameters.Add("IsBackReference=true"); - } - - key.Attributes.Add(aa); - - SetPropertyValue(key, "IsNotifying", true); - SetPropertyValue(key, "IsEditable", true); - - associations.Members.Add(key); - - var extension = new Method(() => string.Format("IQueryable<{0}>", key.OtherTable.TypePrefix + key.OtherTable.TypeName), GetAssociationExtensionPluralName(key)); - extension.Name = GetAssociationExtensionPluralName(key); - - extension.ParameterBuilders.Add(() => string.Format("this {0}{1} obj", t.TypePrefix, t.TypeName)); - - extension.ParameterBuilders.Add(() => "IDataContext db"); - extension.Attributes.Add(aa); - extension.IsStatic = true; - - extension.Comment.Add("/ <summary>"); - extension.Comment.Add("/ " + key.KeyName); - extension.Comment.Add("/ </summary>"); - - Func<string> builder = () => - { - var sb = new StringBuilder(); - sb - .Append("return db.GetTable<") - .Append(key.OtherTable.TypePrefix + key.OtherTable.TypeName) - .Append(">().Where(c => "); - for (var i = 0; i < key.OtherColumns.Count; i++) - { - sb.Append("c.") - .Append(key.OtherColumns[i].MemberName) - .Append(" == obj.") - .Append(key.ThisColumns[i].MemberName) - .Append(" && "); - } - sb.Length -= 4; - sb.Append(");"); - - return sb.ToString(); - }; - - extension.BodyBuilders.Add(() => new[] { builder() }); - - extensionAssociations.Members.Add(extension); - - if (key.AssociationType != AssociationType.OneToMany) - { - var single = new Method(() => t.TypePrefix + t.TypeName, GetAssociationExtensionSinglularName(key)); - - single.ParameterBuilders.Add(() => string.Format("this {0}{1} obj", key.OtherTable.TypePrefix, key.OtherTable.TypeName)); - - single.ParameterBuilders.Add(() => "IDataContext db"); - single.Attributes.Add(aa); - single.IsStatic = true; - - single.Comment.Add("/ <summary>"); - single.Comment.Add("/ " + key.KeyName); - single.Comment.Add("/ </summary>"); - - Func<string> builderSingle = () => - { - var sb = new StringBuilder(); - sb - .Append("return db.GetTable<") - .Append(t.TypePrefix + t.TypeName) - .Append(">().Where(c => "); - for (var i = 0; i < key.OtherColumns.Count; i++) - { - sb.Append("c.") - .Append(key.ThisColumns[i].MemberName) - .Append(" == obj.") - .Append(key.OtherColumns[i].MemberName) - .Append(" && "); - } - sb.Length -= 4; - sb.Append(");"); - - return sb.ToString(); - }; - - single.BodyBuilders.Add(() => - { - var sb = new StringBuilder(builderSingle()); - sb.Length -= 1; - - if (key.CanBeNull) - sb.Append(".FirstOrDefault();"); - else - sb.Append(".First();"); - - return new [] { sb.ToString() }; - }); - - extensionAssociations.Members.Add(single); - } - } - - if (GenerateAssociations) - t.Members.Add(associations); - if (GenerateAssociationExtensions) - associationExtensions.Members.Add(extensionAssociations); - } - } - - if (GenerateFindExtensions && nPKs > 0) - { - var PKs = t.Columns.Values.Where(c => c.IsPrimaryKey).ToList(); - var maxNameLen1 = PKs.Max(c => (int?)c.MemberName.Length) ?? 0; - var maxNameLen2 = PKs.Take(nPKs - 1).Max(c => (int?)c.MemberName.Length) ?? 0; - - tableExtensions.Members.Add( - new Method( - () => t.TypeName, - "Find", - new Func<string>[] { () => (string.Format("this ITable<{0}> table", t.TypeName)) } - .Union(PKs.Select(c => (Func<string>)(() => c.BuildType() + " " + c.MemberName))), - () => new[] { "return table.FirstOrDefault(t =>" } - .Union(PKs.SelectMany((c,i) => - { - var ss = new List<string>(); - - if (c.Conditional != null) - ss.Add("#if " + c.Conditional); - - ss.Add(BuildColumnComparison(c, LenDiff(maxNameLen1, c.MemberName), LenDiff(maxNameLen2, c.MemberName), i == nPKs - 1)); - - if (c.Conditional != null) - { - if (ss[1].EndsWith(");")) - { - ss[1] = ss[1].Substring(0, ss[1].Length - 2); - ss.Add("#endif"); - ss.Add("\t\t);"); - } - else - { - ss.Add("#endif"); - } - } - - return ss; - }))) - { - IsStatic = true - }); - } - - addType(t); - - if (!string.IsNullOrWhiteSpace(t.AliasTypeName)) - { - var aClass = new Class(t.AliasTypeName) - { - BaseClass = t.TypeName - }; - - if (comments.Count > 0) - aClass.Comment.AddRange(comments); - - if (GenerateObsoleteAttributeForAliases) - aClass.Attributes.Add(new Attribute("Obsolete", ToStringLiteral("Use " + t.TypeName + " instead."))); - - Model.Types.Add(aClass); - } - } - - if (associationExtensions.Members.Count > 0) - defTableExtensions.Members.Add(associationExtensions); - - if (defAliases.Members.Count > 0) - DataContextObject.Members.Add(defAliases); - - foreach (var schema in schemas.Values) - if (schema.Aliases.Members.Count > 0) - schema.Type.Members.Add(defAliases); - - if (Procedures.Count > 0) - { - Model.Usings.Add("System.Collections.Generic"); - Model.Usings.Add("System.Data"); - Model.Usings.Add("LinqToDB.Data"); - Model.Usings.Add("LinqToDB.Common"); - - if (Procedures.Values.Any(p => p.IsTableFunction)) - Model.Usings.Add("System.Reflection"); - - if (Procedures.Values.Any(p => p.IsAggregateFunction)) - Model.Usings.Add("System.Linq.Expressions"); - - var procs = new MemberGroup(); - var funcs = new MemberGroup(); - var tabfs = new MemberGroup { Region = "Table Functions" }; - - foreach (var p in Procedures.Values.Where( - proc => proc.IsLoaded || proc.IsFunction && !proc.IsTableFunction || - proc.IsTableFunction && proc.ResultException != null - )) - { - Action<MemberGroup> addProcs = tp => procs.Members.Add(tp); - Action<MemberGroup> addFuncs = tp => funcs.Members.Add(tp); - Action<MemberGroup> addTabfs = tp => tabfs.Members.Add(tp); - - var thisDataContext = "this"; - - var schema = p.Schema != null && schemas.ContainsKey(p.Schema) ? schemas[p.Schema] : null; - - if (schema != null) - { - var si = schemas[p.Schema]; - - addProcs = tp => si.Procedures. Members.Add(tp); - addFuncs = tp => si.Functions. Members.Add(tp); - addTabfs = tp => si.TableFunctions.Members.Add(tp); - thisDataContext = "_dataContext"; - } - - var proc = new MemberGroup { Region = p.Name }; - - if (!p.IsFunction) addProcs(proc); - else if (p.IsTableFunction) addTabfs(proc); - else addFuncs(proc); - - if (p.ResultException != null) - { - proc.Errors.Add(p.ResultException.Message); - continue; - } - - proc.Members.Add(p); - - if (p.IsTableFunction) - { - var tableAttrs = new List<string>(); - - if (DatabaseName != null) tableAttrs.Add("Database=" + ToStringLiteral(DatabaseName)); - if (p.Schema != null) tableAttrs.Add("Schema=" + ToStringLiteral(p.Schema)); - - tableAttrs.Add("Name=" + ToStringLiteral(p.ProcedureName)); - - p.Attributes.Add(new Attribute("Sql.TableFunction", tableAttrs.ToArray())); - - p.TypeBuilder = () => "ITable<" + p.ResultTable.TypeName + ">"; - } - else if (p.IsAggregateFunction) - { - p.IsStatic = true; - p.TypeBuilder = () => p.ProcParameters.Single(pr => pr.IsResult).ParameterType; - var paramCount = p.ProcParameters.Count(pr => !pr.IsResult); - p.Attributes.Add(new Attribute("Sql.Function", "Name=" + ToStringLiteral((p.Schema != null ? p.Schema + "." : null) + p.ProcedureName), "ServerSideOnly=true, IsAggregate = true" + (paramCount > 0 ? (", ArgIndices = new[] { " + string.Join(", ", Enumerable.Range(0, p.ProcParameters.Count(pr => !pr.IsResult))) + " }") : null))); - - if (p.IsDefaultSchema || !GenerateSchemaAsType) - p.ParameterBuilders.Add(() => "this IEnumerable<TSource> src"); - else // otherwise function will be generated in nested class, which doesn't support extension methods - p.ParameterBuilders.Add(() => "IEnumerable<TSource> src"); - - foreach (var inp in p.ProcParameters.Where(pr => !pr.IsResult)) - p.ParameterBuilders.Add(() => $"Expression<Func<TSource, {inp.ParameterType}>> " + inp.ParameterName); - - p.Name += "<TSource>"; - } - else if (p.IsFunction) - { - p.IsStatic = true; - p.TypeBuilder = () => p.ProcParameters.Single(pr => pr.IsResult).ParameterType; - p.Attributes.Add(new Attribute("Sql.Function", "Name=" + ToStringLiteral((p.Schema != null ? p.Schema + "." : null) + p.ProcedureName), "ServerSideOnly=true")); - } - else - { - p.IsStatic = true; - p.TypeBuilder = () => p.ResultTable == null - ? "int" - : GenerateProcedureResultAsList - ? "List<" + p.ResultTable.TypeName + ">" - : "IEnumerable<" + p.ResultTable.TypeName + ">"; - - if (p.IsDefaultSchema || !GenerateSchemaAsType) - p.ParameterBuilders.Add(() => "this DataConnection dataConnection"); - else - p.ParameterBuilders.Add(() => "DataConnection dataConnection"); - } - - if (!p.IsAggregateFunction) - foreach (var pr in p.ProcParameters.Where(par => !par.IsResult)) - p.ParameterBuilders.Add(() => string.Format("{0}{1} {2}", - pr.IsOut ? pr.IsIn ? "ref " : "out " : "", pr.ParameterType, pr.ParameterName)); - - if (p.IsTableFunction) - { - p.BodyBuilders.Add(() => new[] - { - string.Format("return " + thisDataContext + ".GetTable<{0}>(this, (MethodInfo)MethodBase.GetCurrentMethod()", p.ResultTable.TypeName) - + (p.ProcParameters.Count == 0 ? ");" : ",") - }); - - for (var idx = 0; idx < p.ProcParameters.Count; idx++) - { - var i = idx; - p.BodyBuilders.Add(() => new []{ "\t" + p.ProcParameters[i].ParameterName + (i + 1 == p.ProcParameters.Count ? ");" : ",") }); - } - } - else if (p.IsFunction) - { - p.BodyBuilders.Add(() => new [] { "throw new InvalidOperationException();" }); - } - else - { - var spName = - SqlBuilder.BuildTableName( - new System.Text.StringBuilder(), - (string)SqlBuilder.Convert(DatabaseName, LinqToDB.SqlProvider.ConvertType.NameToDatabase), - (string)SqlBuilder.Convert(p.Schema, LinqToDB.SqlProvider.ConvertType.NameToSchema), - (string)SqlBuilder.Convert(p.ProcedureName, LinqToDB.SqlProvider.ConvertType.NameToQueryTable) - ).ToString(); - - spName = ToStringLiteral(spName); - - var inputParameters = p.ProcParameters.Where(pp => pp.IsIn). ToList(); - var outputParameters = p.ProcParameters.Where(pp => pp.IsOut). ToList(); - var inOrOutputParameters = p.ProcParameters.Where(pp => pp.IsIn || pp.IsOut).ToList(); - - spName += inOrOutputParameters.Count == 0 - ? (p.ResultTable == null || !GenerateProcedureResultAsList ? ");" : ").ToList();") - : ","; - - var retName = "ret"; - var retNo = 0; - - while (p.ProcParameters.Any(pp => pp.ParameterName == retName)) - retName = "ret" + ++retNo; - - var hasOut = outputParameters.Any(pr => pr.IsOut); - var prefix = hasOut ? "var " + retName + " = " : "return "; - - if (p.ResultTable == null) - p.BodyBuilders.Add(() => new [] { prefix + "dataConnection.ExecuteProc(" + spName }); - else - { - if (p.ResultTable.Columns.Values.Any(c => c.IsDuplicateOrEmpty)) - { - p.BodyBuilders.Add(() => new [] - { - "var ms = dataConnection.MappingSchema;", - "", - prefix + "dataConnection.QueryProc(dataReader =>", - "\tnew " + p.ResultTable.TypeName, - "\t{" - }); - - var n = 0; - var maxNameLen = p.ResultTable.Columns.Values.Max(c => (int?)c.MemberName .Length) ?? 0; - var maxTypeLen = p.ResultTable.Columns.Values.Max(c => (int?)c.BuildType().Length) ?? 0; - - foreach (var c in p.ResultTable.Columns.Values) - { - p.BodyBuilders.Add(() => new [] {string.Format("\t\t{0}{1} = Converter.ChangeTypeTo<{2}>{3}(dataReader.GetValue({4}), ms),", - c.MemberName, LenDiff(maxNameLen, c.MemberName), c.BuildType(), LenDiff(maxTypeLen, c.BuildType()), n++) }); - } - - p.BodyBuilders.Add(() => new [] {"\t},", "\t" + spName }); - } - else - { - p.BodyBuilders.Add(() => new [] { prefix + "dataConnection.QueryProc<" + p.ResultTable.TypeName + ">(" + spName }); - } - } - - var maxLenSchema = inputParameters.Max(pr => (int?)pr.SchemaName. Length) ?? 0; - var maxLenParam = inputParameters.Max(pr => (int?)pr.ParameterName.Length) ?? 0; - var maxLenType = inputParameters.Max(pr => (int?)("DataType." + pr.DataType).Length) ?? 0; - - for (var idx = 0; idx < inOrOutputParameters.Count; idx++) - { - var i = idx; - var pr = inOrOutputParameters[i]; - - p.BodyBuilders.Add(() => - { - var str = string.Format( - !pr.IsIn && pr.IsOut - ? "\tnew DataParameter({0}, null, {3}{4})" - : "\tnew DataParameter({0}, {1}{2}, {3}{4})" + (GenerateProcedureDbType(pr) ? "{{ DbType = {5} }}" : null), - ToStringLiteral(pr.SchemaName), - LenDiff(maxLenSchema, pr.SchemaName), - pr.ParameterName, - LenDiff(maxLenParam, pr.ParameterName), - "DataType." + pr.DataType, - ToStringLiteral(pr.SchemaType)); - - if (pr.IsOut) - { - str += LenDiff(maxLenType, "DataType." + pr.DataType); - str += " { Direction = " + (pr.IsIn ? "ParameterDirection.InputOutput" : "ParameterDirection.Output"); - - if (pr.Size != null && pr.Size.Value != 0) - str += ", Size = " + pr.Size.Value; - - str += " }"; - } - - // we need to call ToList(), because otherwise output parameters will not be updated - // with values. See https://msdn.microsoft.com/en-us/library/ms971497#gazoutas_topic6 - str += i + 1 == inOrOutputParameters.Count - ? ((GenerateProcedureResultAsList || outputParameters.Count > 0) && p.ResultTable != null ? ").ToList();" : ");") - : ","; - - return new [] { str }; - }); - } - - if (hasOut) - { - maxLenSchema = outputParameters.Max(pr => (int?)pr.SchemaName. Length) ?? 0; - maxLenParam = outputParameters.Max(pr => (int?)pr.ParameterName.Length) ?? 0; - maxLenType = outputParameters.Max(pr => (int?)pr.ParameterType.Length) ?? 0; - - p.BodyBuilders.Add(() => new [] { string.Empty }); - - foreach (var pr in p.ProcParameters.Where(_ => _.IsOut)) - { - p.BodyBuilders.Add(() => new [] { string.Format("{0} {1}= Converter.ChangeTypeTo<{2}>{3}(((IDbDataParameter)dataConnection.Command.Parameters[{4}]).{5}Value);", - pr.ParameterName, - LenDiff(maxLenParam, pr.ParameterName), - pr.ParameterType, - LenDiff(maxLenType, pr.ParameterType), - ToStringLiteral(pr.SchemaName), - LenDiff(maxLenSchema, pr.SchemaName)) }); - } - - p.BodyBuilders.Add(() => new [] {"", "return " + retName + ";" }); - } - } - - if (p.ResultTable != null && p.ResultTable.DataContextPropertyName == null) - { - var columns = new MemberGroup { IsCompact = true }; - - foreach (var c in p.ResultTable.Columns.Values) - { - if (c.MemberName != c.ColumnName) - c.Attributes.Add(new Attribute("Column") { Parameters = { ToStringLiteral(c.ColumnName) } }); - columns.Members.Add(c); - } - - p.ResultTable.Members.Add(columns); - proc.Members.Add(p.ResultTable); - } - } - - if (procs.Members.Count > 0) - Model.Types.Add(new Class(DataContextObject.Name + "StoredProcedures", procs) { IsStatic = true }); - - if (funcs.Members.Count > 0) - Model.Types.Add(new Class("SqlFunctions", funcs) { IsStatic = true }); - - if (tabfs.Members.Count > 0) - DataContextObject.Members.Add(tabfs); - - MakeTypeMembersNamesUnique(DataContextObject, "InitDataContext", "InitMappingSchema"); - MakeMembersNamesUnique(Model.Types, "Table"); - foreach (var type in Model.Types.OfType<Class>()) - MakeTypeMembersNamesUnique(type, exceptMethods: new [] { "Find", "InitDataContext", "InitMappingSchema" }); - - foreach (var schema in schemas.Values) - { - if (schema.Procedures.Members.Count > 0) - schema.Type.Members.Add(new Class(DataContextObject.Name + "StoredProcedures", schema.Procedures) { IsStatic = true }); - - if (schema.Functions.Members.Count > 0) - schema.Type.Members.Add(new Class("SqlFunctions", schema.Functions) { IsStatic = true }); - - if (schema.TableFunctions.Members.Count > 0) - schema.DataContext.Members.Add(schema.TableFunctions); - - MakeTypeMembersNamesUnique(schema.DataContext, "InitDataContext", "InitMappingSchema"); - foreach (var type in schema.Type.Members.OfType<Class>()) - MakeTypeMembersNamesUnique(type); - } - } - - if (defTableExtensions.Members.Count > 0) - { - Model.Usings.Add("System.Linq"); - var tableExtensions = new Class("TableExtensions", defTableExtensions) { IsStatic = true }; - Model.Types.Add(tableExtensions); - MakeTypeMembersNamesUnique(tableExtensions, exceptMethods: new [] { "Find" }); - } - - foreach (var schema in schemas.Values) - { - Model.Types.Add(schema.Type); - - if (schema.TableExtensions.Members.Count > 0) - { - Model.Usings.Add("System.Linq"); - schema.Type.Members.Add(schema.TableExtensions); - } - } - - Tables. Clear(); - Procedures.Clear(); - - Model.SetTree(); - - AfterGenerateLinqToDBModel(); -} - -void MakeTypeMembersNamesUnique(Class type, string defaultName = "Member", params string[] exceptMethods) -{ - var reservedNames = new [] { type.Name }; - if (exceptMethods != null && exceptMethods.Length > 0) - reservedNames = reservedNames.Concat(exceptMethods).ToArray(); - - MakeMembersNamesUnique(GetAllClassMembers(type.Members, exceptMethods), defaultName, reservedNames); -} - -void MakeMembersNamesUnique(IEnumerable<IClassMember> members, string defaultName, params string[] reservedNames) -{ - LinqToDB.Common.Utils.MakeUniqueNames( - members, - reservedNames, - m => m is Table tbl ? (tbl.Schema != null && !tbl.IsDefaultSchema && PrefixTableMappingWithSchema ? tbl.Schema + "_" : null) + tbl.Name : (m is TypeBase t ? t.Name : ((MemberBase)m).Name), - (m, newName) => - { - if (m is TypeBase t) - t.Name = newName; - else - ((MemberBase)m).Name = newName; - }, - defaultName); -} - -IEnumerable<IClassMember> GetAllClassMembers(IEnumerable<IClassMember> members, params string[] exceptMethods) -{ - foreach (var member in members) - { - if (member is MemberGroup mg) - foreach (var m in GetAllClassMembers(mg.Members, exceptMethods)) - yield return m; - // constructors don't have own type/flag - else if (member is Method method && (method.BuildType() == null || (exceptMethods != null && exceptMethods.Contains(method.Name)))) - continue; - else - yield return member; - } -} - -// left for backward compatibility -string NormalizeStringName(string name) -{ - return ToStringLiteral(name); -} - -#> diff --git a/src/Database.Tests/LinqToDB.Templates/MultipleFiles.ttinclude b/src/Database.Tests/LinqToDB.Templates/MultipleFiles.ttinclude deleted file mode 100644 index 4b43ba0..0000000 --- a/src/Database.Tests/LinqToDB.Templates/MultipleFiles.ttinclude +++ /dev/null @@ -1,70 +0,0 @@ -<#@ assembly name="System.Core" #> -<#@ assembly name="EnvDTE" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="EnvDTE" #> -<#+ -DTE _dte; -DTE DTE => _dte ?? (_dte = (DTE)((IServiceProvider)Host).GetService(typeof(DTE))); - -ProjectItem _templateProjectItem; -ProjectItem TemplateProjectItem => _templateProjectItem ?? (_templateProjectItem = DTE.Solution.FindProjectItem(Host.TemplateFile)); - -readonly Dictionary<string,int> _fileNames = new Dictionary<string,int>(); - -Func<string,string,bool> CompareContent = (s1,s2) => s1 == s2; - -void SaveOutput(string fileName, int fileType = 1) -{ - var dir = Path.GetDirectoryName(Host.TemplateFile); - var output = Path.Combine(dir, fileName); - var newContent = GenerationEnvironment.ToString(); - var oldContent = File.Exists(output) ? File.ReadAllText(output) : ""; - - if (!CompareContent(newContent, oldContent)) - { - if (DTE.SourceControl != null && DTE.SourceControl.IsItemUnderSCC(output) && !DTE.SourceControl.IsItemCheckedOut(output)) - DTE.SourceControl.CheckOutItem(output); - - File.WriteAllText(output, newContent); - } - - GenerationEnvironment.Length = 0; - - _fileNames.Add(output, fileType); -} - -void SyncProject() -{ - var keepFileNames = _fileNames.ToDictionary(f => f.Key); - var projectFiles = new Dictionary<string,ProjectItem>(); - var templateFileName = TemplateProjectItem.FileNames[0]; - var originalFilePrefix = Path.GetFileNameWithoutExtension(templateFileName) + "."; - - foreach (ProjectItem projectItem in TemplateProjectItem.ProjectItems) - { - projectFiles.Add(projectItem.FileNames[0], projectItem); - } - - foreach (var pair in projectFiles) - { - if (!keepFileNames.ContainsKey(pair.Key)) - if (!(Path.GetFileNameWithoutExtension(pair.Key) + ".").StartsWith(originalFilePrefix)) - //if (pair.Key != templateFileName) - pair.Value.Delete(); - } - - // Add missing files to the project. - // - foreach (var fileName in keepFileNames) - { - if (!projectFiles.ContainsKey(fileName.Value.Key)) - if (File.Exists(fileName.Value.Key)) - { - var newItem = TemplateProjectItem.ProjectItems.AddFromFile(fileName.Value.Key); - newItem.Properties.Item("BuildAction").Value = fileName.Value.Value; - } - } -} -#> diff --git a/src/Database.Tests/LinqToDB.Templates/NotifyDataErrorInfo.ttinclude b/src/Database.Tests/LinqToDB.Templates/NotifyDataErrorInfo.ttinclude deleted file mode 100644 index 06e72af..0000000 --- a/src/Database.Tests/LinqToDB.Templates/NotifyDataErrorInfo.ttinclude +++ /dev/null @@ -1,133 +0,0 @@ -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - beforeGenerateModel(); - NotifyDataErrorInfoImpl(); - }; - } -#> -<#+ -void NotifyDataErrorInfoImpl() -{ - foreach (var prop in GetTreeNodes(Model).OfType<Property>().Where(p => p.CustomValidation).ToList()) - { - ITree p = prop.Parent; - - while (!(p is Class) && p != null) - p = p.Parent; - - if (p != null) - { - var cl = (Class)p; - - if (!cl.Interfaces.Contains("INotifyDataErrorInfo")) - { - if (!Model.Usings.Contains("System.ComponentModel")) Model.Usings.Add("System.ComponentModel"); - if (!Model.Usings.Contains("System.Collections")) Model.Usings.Add("System.Collections"); - if (!Model.Usings.Contains("System.Linq")) Model.Usings.Add("System.Linq"); - - cl.Interfaces.Add("INotifyDataErrorInfo"); - - cl.Members.Add(new MemberGroup - { - Region = "INotifyDataErrorInfo support", - Members = - { - new Event(() => "EventHandler<DataErrorsChangedEventArgs>", "ErrorsChanged") - { - IsVirtual = true, - Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } - }, - new Field(() => "Dictionary<string,List<string>>", "_validationErrors") - { - InitValue = "new Dictionary<string,List<string>>()", - AccessModifier = AccessModifier.Private, - IsReadonly = true, - Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } - }, - new Method(() => "void", "AddError", - new Func<string>[] - { - () => "string propertyName", - () => "string error" - }, - () => new[] - { - "List<string> errors;", - "", - "if (!_validationErrors.TryGetValue(propertyName, out errors))", - "{", - "\t_validationErrors[propertyName] = new List<string> { error };", - "}", - "else if (!errors.Contains(error))", - "{", - "\terrors.Add(error);", - "}", - "else", - "\treturn;", - "", - "OnErrorsChanged(propertyName);", - }) - { - AccessModifier = AccessModifier.Public - }, - new Method(() => "void", "RemoveError", - new Func<string>[] - { - () => "string propertyName", - }, - () => new[] - { - "List<string> errors;", - "", - "if (_validationErrors.TryGetValue(propertyName, out errors) && errors.Count > 0)", - "{", - "\t_validationErrors.Clear();", - "\tOnErrorsChanged(propertyName);", - "}", - }) - { - AccessModifier = AccessModifier.Public - }, - new Method(() => "void", "OnErrorsChanged", - new Func<string>[] - { - () => "string propertyName", - }, - () => new[] - { - "if (ErrorsChanged != null)", - "{", - "\tif (System.Windows.Deployment.Current.Dispatcher.CheckAccess())", - "\t\tErrorsChanged(this, new DataErrorsChangedEventArgs(propertyName));", - "\telse", - "\t\tSystem.Windows.Deployment.Current.Dispatcher.BeginInvoke(", - "\t\t\t() => ErrorsChanged(this, new DataErrorsChangedEventArgs(propertyName)));", - "}", - }) - { - AccessModifier = AccessModifier.Protected - }, - new Method(() => "IEnumerable", "GetErrors", - new Func<string>[] - { - () => "string propertyName", - }, - () => new[] - { - "List<string> errors;", - "return propertyName != null && _validationErrors.TryGetValue(propertyName, out errors) ? errors : null;", - }) - { - AccessModifier = AccessModifier.Public - }, - new Property(() => "bool", "HasErrors").InitGetter(() => new [] { "_validationErrors.Values.Any(e => e.Count > 0)" }) - } - }); - } - } - } -} -#> diff --git a/src/Database.Tests/LinqToDB.Templates/NotifyPropertyChanged.ttinclude b/src/Database.Tests/LinqToDB.Templates/NotifyPropertyChanged.ttinclude deleted file mode 100644 index 49234e7..0000000 --- a/src/Database.Tests/LinqToDB.Templates/NotifyPropertyChanged.ttinclude +++ /dev/null @@ -1,382 +0,0 @@ -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - beforeGenerateModel(); - NotifyPropertyChangedImpl(); - }; - - SetPropertyValueAction += (obj,prop,val) => - { - if (prop == "IsNotifying") - obj.IsNotifying = (bool)val; - }; - } -#><#+ -public bool ImplementNotifyPropertyChanging; -public bool SkipNotifyPropertyChangedImplementation = false; - -void NotifyPropertyChangedImpl() -{ - foreach (Property prop in GetTreeNodes(Model).OfType<Property>().Where(p => p.IsNotifying).ToList()) - { - List<IClassMember> parentMembers; - - MemberGroup gr = null; - - if (prop.Parent is Class) - { - var parent = (Class)prop.Parent; - parentMembers = parent.Members; - } - else - { - var parent = (MemberGroup)prop.Parent; - - parent.IsCompact = false; - - parentMembers = parent.Members; - - if (parent.IsPropertyGroup) - gr = parent; - } - - var name = prop.Name.Trim(); - var type = prop.BuildType().Trim(); - - if (gr == null) - { - gr = new MemberGroup - { - Region = name + " : " + type, - Members = { prop }, - IsPropertyGroup = true, - }; - - var index = parentMembers.IndexOf(prop); - - parentMembers.RemoveAt(index); - parentMembers.Insert (index, gr); - } - - if (prop.IsAuto) - { - var field = new Field(() => type, "_" + ToCamelCase(name)) - { - AccessModifier = AccessModifier.Private, - InsertBlankLineAfter = false, - }; - - if (prop.InitValue != null) - field.InitValue = prop.InitValue; - - gr.Members.Insert(0, field); - - prop.Name = " " + name; - prop.TypeBuilder = () => " " + type; - prop.IsAuto = false; - - if (prop.HasGetter) prop.GetBodyBuilders.Add(() => new [] { "return " + field.Name + ";" }); - if (prop.HasSetter) prop.SetBodyBuilders.Add(() => new [] { field.Name + " = value;" }); - } - - var methods = new MemberGroup - { - Region = "INotifyPropertyChanged support", - Members = - { - new Field(() => "const string", "NameOf" + name) - { - InitValue = ToStringLiteral(name), - AccessModifier = AccessModifier.Public, - }, - new Field(() => "PropertyChangedEventArgs", "_" + ToCamelCase(name) + "ChangedEventArgs") - { - InitValue = "new PropertyChangedEventArgs(NameOf" + name + ")", - AccessModifier = AccessModifier.Private, - IsStatic = true, - IsReadonly = true, - }, - new Method(() => "void", "On" + name + "Changed", null, - () => new[] { "OnPropertyChanged(_" + ToCamelCase(name) + "ChangedEventArgs);" }) - { - AccessModifier = AccessModifier.Private - } - } - }; - - gr.Members.Add(methods); - - if (prop.Dependents.Count == 0) - prop.Dependents.Add(name); - - if (ImplementNotifyPropertyChanging) - { - gr.Members.Add(new MemberGroup - { - Region = "INotifyPropertyChanging support", - Members = - { - new Field(() => "PropertyChangingEventArgs", "_" + ToCamelCase(name) + "ChangingEventArgs") - { - InitValue = "new PropertyChangingEventArgs(NameOf" + name + ")", - AccessModifier = AccessModifier.Private, - IsStatic = true, - IsReadonly = true, - }, - new Method(() => "void", "On" + name + "Changing", null, - () => new[] { "OnPropertyChanging(_" + ToCamelCase(name) + "ChangingEventArgs);" }) - { - AccessModifier = AccessModifier.Private - } - } - }); - } - - if (prop.HasSetter) - { - var setBody = prop.BuildSetBody().Select(s => "\t" + s).ToArray(); - prop.SetBodyBuilders.Clear(); - prop.SetBodyBuilders.Add(() => setBody); - - string getValue; - - var getBody = prop.BuildGetBody().ToArray(); - if (getBody.Length == 1 && getBody[0].StartsWith("return")) - { - getValue = getBody[0].Substring("return".Length).Trim(' ', '\t', ';'); - } - else - { - getValue = name; - } - - var insSpaces = setBody.Length > 1; - var n = 0; - - prop.SetBodyBuilders.Insert(n++, () => new [] {"if (" + getValue + " != value)", "{" }); - - if (ImplementNotifyPropertyChanging) - { - foreach (var dp in prop.Dependents) - prop.SetBodyBuilders.Insert(n++, () => new [] { "\tOn" + dp + "Changing();" }); - prop.SetBodyBuilders.Insert(n++, () => new [] { "" }); - } - - prop.SetBodyBuilders.Insert(n++, () => new [] { "\tBefore" + name + "Changed(value);" }); - - if (insSpaces) - { - prop.SetBodyBuilders.Insert(3, () => new [] { "" }); - prop.SetBodyBuilders.Add(() => new [] { "" }); - } - - prop.SetBodyBuilders.Add(() => new [] { "\tAfter" + name + "Changed();" }); - prop.SetBodyBuilders.Add(() => new [] { "" }); - - foreach (var dp in prop.Dependents) - prop.SetBodyBuilders.Add(() => new [] { "\tOn" + dp + "Changed();" }); - - prop.SetBodyBuilders.Add(() => new [] { "}" }); - - methods.Members.Insert(0, new MemberGroup - { - IsCompact = true, - Members = - { - new Method(() => "void", "Before" + name + "Changed", new Func<string>[] { () => type + " newValue" }) { AccessModifier = AccessModifier.Partial }, - new Method(() => "void", "After" + name + "Changed") { AccessModifier = AccessModifier.Partial }, - } - }); - } - - prop.Parent.SetTree(); - - ITree p = prop.Parent; - - while (!(p is Class) && p != null) - p = p.Parent; - - if (p != null) - { - var cl = (Class)p; - - if (!SkipNotifyPropertyChangedImplementation && !cl.Interfaces.Contains("INotifyPropertyChanged")) - { - if (!Model.Usings.Contains("System.ComponentModel")) - Model.Usings.Add("System.ComponentModel"); - - cl.Interfaces.Add("INotifyPropertyChanged"); - - cl.Members.Add(new MemberGroup - { - Region = "INotifyPropertyChanged support", - Members = - { - new Event(() => "PropertyChangedEventHandler", "PropertyChanged") - { - IsVirtual = true, - Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } - }, - new Method(() => "void", "OnPropertyChanged", new Func<string>[] { () => "string propertyName" }, () => OnPropertyChangedBody) - { - AccessModifier = AccessModifier.Protected - }, - new Method(() => "void", "OnPropertyChanged", new Func<string>[] { () => "PropertyChangedEventArgs arg" }, () => OnPropertyChangedArgBody) - { - AccessModifier = AccessModifier.Protected - }, - } - }); - } - - if (ImplementNotifyPropertyChanging && !cl.Interfaces.Contains("INotifyPropertyChanging")) - { - if (!Model.Usings.Contains("System.ComponentModel")) - Model.Usings.Add("System.ComponentModel"); - - cl.Interfaces.Add("INotifyPropertyChanging"); - - cl.Members.Add(new MemberGroup - { - Region = "INotifyPropertyChanging support", - Members = - { - new Event(() => "PropertyChangingEventHandler", "PropertyChanging") - { - IsVirtual = true, - Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } - }, - new Method(() => "void", "OnPropertyChanging", new Func<string>[] { () => "string propertyName" }, () => OnPropertyChangingBody) - { - AccessModifier = AccessModifier.Protected - }, - new Method(() => "void", "OnPropertyChanging", new Func<string>[] { () => "PropertyChangingEventArgs arg" }, () => OnPropertyChangingArgBody) - { - AccessModifier = AccessModifier.Protected - }, - } - }); - } - } - } -} - -public string[] OnPropertyChangedBody = new[] -{ - "var propertyChanged = PropertyChanged;", - "", - "if (propertyChanged != null)", - "{", - "#if SILVERLIGHT", - "\tif (System.Windows.Deployment.Current.Dispatcher.CheckAccess())", - "\t\tpropertyChanged(this, new PropertyChangedEventArgs(propertyName));", - "\telse", - "\t\tSystem.Windows.Deployment.Current.Dispatcher.BeginInvoke(", - "\t\t\t() =>", - "\t\t\t{", - "\t\t\t\tvar pc = PropertyChanged;", - "\t\t\t\tif (pc != null)", - "\t\t\t\t\tpc(this, new PropertyChangedEventArgs(propertyName));", - "\t\t\t});", - "#else", - "\tpropertyChanged(this, new PropertyChangedEventArgs(propertyName));", - "#endif", - "}", -}; - -public string[] OnPropertyChangedArgBody = new[] -{ - "var propertyChanged = PropertyChanged;", - "", - "if (propertyChanged != null)", - "{", - "#if SILVERLIGHT", - "\tif (System.Windows.Deployment.Current.Dispatcher.CheckAccess())", - "\t\tpropertyChanged(this, arg);", - "\telse", - "\t\tSystem.Windows.Deployment.Current.Dispatcher.BeginInvoke(", - "\t\t\t() =>", - "\t\t\t{", - "\t\t\t\tvar pc = PropertyChanged;", - "\t\t\t\tif (pc != null)", - "\t\t\t\t\tpc(this, arg);", - "\t\t\t});", - "#else", - "\tpropertyChanged(this, arg);", - "#endif", - "}", -}; - -public string[] OnPropertyChangingBody = new[] -{ - "var propertyChanging = PropertyChanging;", - "", - "if (propertyChanging != null)", - "{", - "#if SILVERLIGHT", - "\tif (System.Windows.Deployment.Current.Dispatcher.CheckAccess())", - "\t\tpropertyChanging(this, new PropertyChangingEventArgs(propertyName));", - "\telse", - "\t\tSystem.Windows.Deployment.Current.Dispatcher.BeginInvoke(", - "\t\t\t() =>", - "\t\t\t{", - "\t\t\t\tvar pc = PropertyChanging;", - "\t\t\t\tif (pc != null)", - "\t\t\t\t\tpc(this, new PropertyChangingEventArgs(propertyName));", - "\t\t\t});", - "#else", - "\tpropertyChanging(this, new PropertyChangingEventArgs(propertyName));", - "#endif", - "}", -}; - -public string[] OnPropertyChangingArgBody = new[] -{ - "var propertyChanging = PropertyChanging;", - "", - "if (propertyChanging != null)", - "{", - "#if SILVERLIGHT", - "\tif (System.Windows.Deployment.Current.Dispatcher.CheckAccess())", - "\t\tpropertyChanging(this, arg);", - "\telse", - "\t\tSystem.Windows.Deployment.Current.Dispatcher.BeginInvoke(", - "\t\t\t() =>", - "\t\t\t{", - "\t\t\t\tvar pc = PropertyChanging;", - "\t\t\t\tif (pc != null)", - "\t\t\t\t\tpc(this, arg);", - "\t\t\t});", - "#else", - "\tpropertyChanging(this, arg);", - "#endif", - "}", -}; - -partial class Property -{ - public bool IsNotifying; - public List<string> Dependents = new List<string>(); -} - -class NotifyingProperty : Property -{ - public NotifyingProperty() - { - IsNotifying = true; - } - - public NotifyingProperty(string type, string name, params string[] dependents) - : base(() => type, name, null, null) - { - IsNotifying = true; - - if (dependents.Length == 0) - Dependents.Add(name); - else - Dependents.AddRange(dependents); - } -} -#> diff --git a/src/Database.Tests/LinqToDB.Templates/ObsoleteAttributes.ttinclude b/src/Database.Tests/LinqToDB.Templates/ObsoleteAttributes.ttinclude deleted file mode 100644 index b95b0d8..0000000 --- a/src/Database.Tests/LinqToDB.Templates/ObsoleteAttributes.ttinclude +++ /dev/null @@ -1,100 +0,0 @@ -<# - { - var beforeGenerateLinqToDBModel = BeforeGenerateLinqToDBModel; - var afterGenerateLinqToDBModel = AfterGenerateLinqToDBModel; - - var obsoleteTables = new List<Tuple<string,string,string>>(); - - BeforeGenerateLinqToDBModel = () => - { - beforeGenerateLinqToDBModel(); - - foreach (var table in Tables.Values) - { - var idx = table.Description.IndexOf("[Obsolete"); - - if (idx >= 0) - { - var idx2 = table.Description.IndexOf(']', idx); - - if (idx2 > idx) - { - var text = table.Description.Substring(idx + 1, idx2 - idx - 1); - var attr = new Attribute(text); - var info = Tuple.Create(table.Schema, table.Name, text); - - if (obsoleteTables.All(a => a != info)) - obsoleteTables.Add(info); - table.Attributes.Add(attr); - table.Description = table.Description.Substring(0, idx) + table.Description.Substring(idx2 + 1); - } - } - - foreach (var c in table.Columns.Values) - { - idx = c.Description.IndexOf("[Obsolete"); - - if (idx >= 0) - { - var idx2 = c.Description.IndexOf(']', idx); - - if (idx2 > idx) - { - var attr = new Attribute(c.Description.Substring(idx + 1, idx2 - idx - 1)); - - c.Attributes.Add(attr); - c.Description = c.Description.Substring(0, idx) + c.Description.Substring(idx2 + 1); - } - } - } - } - }; - - AfterGenerateLinqToDBModel = () => - { - foreach (var tableInfo in obsoleteTables) - { - var schema = tableInfo.Item1; - var name = tableInfo.Item2; - var text = tableInfo.Item3; - var obsoleteAttr = new Attribute(text); - - foreach (var cm in GetTreeNodes(Model) - .OfType<MemberBase>() - .Where(t => t.BuildType() != null) - .Where(t => t.BuildType() == name || t.BuildType().Contains("<" + name + ">"))) - { - // check schema - - if (cm.Parent != null && cm.Parent.Parent != null) - { - var parent = cm.Parent.Parent; - - if (parent is Table) - { - var table = (Table)parent; - - if (schema == table.Schema) - if (cm.Attributes.All(a => a.Name != text)) - cm.Attributes.Add(obsoleteAttr); - } - else if (parent is Class) - { - var cls = (Class)parent; - - bool parentClassIncludesSchemaName = cls.Name.Equals(schema + "Schema", StringComparison.InvariantCultureIgnoreCase); - bool classIsForDefaultSchema = cls.Name == DataContextName; - bool isExtensionMethod = cls.Parent is Namespace || cls.Name == "TableExtensions"; - - if (classIsForDefaultSchema || parentClassIncludesSchemaName || isExtensionMethod) - if (cm.Attributes.All(a => a.Name != text)) - cm.Attributes.Add(obsoleteAttr); - } - } - } - } - - afterGenerateLinqToDBModel(); - }; - } -#> diff --git a/src/Database.Tests/LinqToDB.Templates/PluralizationService.ttinclude b/src/Database.Tests/LinqToDB.Templates/PluralizationService.ttinclude deleted file mode 100644 index 2bed1d6..0000000 --- a/src/Database.Tests/LinqToDB.Templates/PluralizationService.ttinclude +++ /dev/null @@ -1,185 +0,0 @@ -<#@ assembly name="System.Data.Entity.Design" #> -<#@ import namespace="System.Data.Entity.Design.PluralizationServices" #> -<# - { - ToPlural = Pluralization.ToPlural; - ToSingular = Pluralization.ToSingular; - } -#> -<#+ -static class Pluralization -{ - public static string CultureInfo = "en"; - - static PluralizationService _service; - - public static Dictionary<string,string> Dictionary = new Dictionary<string,string> - { - { "access", "accesses" }, { "afterlife", "afterlives" }, { "alga", "algae" }, - { "alumna", "alumnae" }, { "alumnus", "alumni" }, { "analysis", "analyses" }, - { "antenna", "antennae" }, { "appendix", "appendices" }, { "axis", "axes" }, - { "bacillus", "bacilli" }, { "basis", "bases" }, { "Bedouin", "Bedouin" }, - { "cactus", "cacti" }, { "calf", "calves" }, { "cherub", "cherubim" }, - { "child", "children" }, { "cod", "cod" }, { "cookie", "cookies" }, - { "criterion", "criteria" }, { "curriculum", "curricula" }, { "data", "data" }, - { "deer", "deer" }, { "diagnosis", "diagnoses" }, { "die", "dice" }, - { "dormouse", "dormice" }, { "elf", "elves" }, { "elk", "elk" }, - { "erratum", "errata" }, { "esophagus", "esophagi" }, { "fauna", "faunae" }, - { "fish", "fish" }, { "flora", "florae" }, { "focus", "foci" }, - { "foot", "feet" }, { "formula", "formulae" }, { "fundus", "fundi" }, - { "fungus", "fungi" }, { "genie", "genii" }, { "genus", "genera" }, - { "goose", "geese" }, { "grouse", "grouse" }, { "hake", "hake" }, - { "half", "halves" }, { "headquarters", "headquarters" }, { "hippo", "hippos" }, - { "hippopotamus", "hippopotami" }, { "hoof", "hooves" }, { "housewife", "housewives" }, - { "hypothesis", "hypotheses" }, { "index", "indices" }, { "info", "info" }, - { "jackknife", "jackknives" }, - { "knife", "knives" }, { "labium", "labia" }, { "larva", "larvae" }, - { "leaf", "leaves" }, { "life", "lives" }, { "loaf", "loaves" }, - { "louse", "lice" }, { "magus", "magi" }, { "man", "men" }, - { "memorandum", "memoranda" }, { "midwife", "midwives" }, { "millennium", "millennia" }, - { "moose", "moose" }, { "mouse", "mice" }, { "nebula", "nebulae" }, - { "neurosis", "neuroses" }, { "nova", "novas" }, { "nucleus", "nuclei" }, - { "oesophagus", "oesophagi" }, { "offspring", "offspring" }, { "ovum", "ova" }, - { "ox", "oxen" }, { "papyrus", "papyri" }, { "passerby", "passersby" }, - { "penknife", "penknives" }, { "person", "people" }, { "phenomenon", "phenomena" }, - { "placenta", "placentae" }, { "pocketknife", "pocketknives" }, { "process", "processes" }, - { "pupa", "pupae" }, { "radius", "radii" }, { "reindeer", "reindeer" }, - { "retina", "retinae" }, { "rhinoceros", "rhinoceros" }, { "roe", "roe" }, - { "salmon", "salmon" }, { "scarf", "scarves" }, { "self", "selves" }, - { "seraph", "seraphim" }, { "series", "series" }, { "sheaf", "sheaves" }, - { "sheep", "sheep" }, { "shelf", "shelves" }, { "species", "species" }, - { "spectrum", "spectra" }, { "status", "status" }, { "stimulus", "stimuli" }, - { "stratum", "strata" }, { "supernova", "supernovas" }, { "swine", "swine" }, - { "terminus", "termini" }, { "thesaurus", "thesauri" }, { "thesis", "theses" }, - { "thief", "thieves" }, { "trout", "trout" }, { "vulva", "vulvae" }, - { "wife", "wives" }, { "wildebeest", "wildebeest" }, { "wolf", "wolves" }, - { "woman", "women" }, { "yen", "yen" }, - }; - - static string GetLastWord(string str) - { - if (string.IsNullOrWhiteSpace(str)) - return string.Empty; - - var i = str.Length - 1; - var isLower = char.IsLower(str[i]); - - while (i > 0 && char.IsLetter(str[i - 1]) && char.IsLower(str[i - 1]) == isLower) - i--; - - return str.Substring(isLower && i > 0 && char.IsLetter(str[i - 1]) ? i - 1 : i); - } - - public static string ToPlural(string str) - { - if (_service == null) - _service = PluralizationService.CreateService(System.Globalization.CultureInfo.GetCultureInfo(CultureInfo)); - - var word = GetLastWord(str); - - string newWord; - - if (!Dictionary.TryGetValue(word.ToLower(), out newWord)) - newWord = _service.IsPlural(word) ? word : _service.Pluralize(word); - - if (string.Compare(word, newWord, true) != 0) - { - if (char.IsUpper(word[0])) - newWord = char.ToUpper(newWord[0]) + newWord.Substring(1, newWord.Length - 1).ToLower(); - - return word == str ? newWord : str.Substring(0, str.Length - word.Length) + newWord; - } - - return str; - } - - public static string ToSingular(string str) - { - if (_service == null) - _service = PluralizationService.CreateService(System.Globalization.CultureInfo.GetCultureInfo(CultureInfo)); - - var word = GetLastWord(str); - - var newWord = - Dictionary - .Where(dic => string.Compare(dic.Value, word, true) == 0) - .Select(dic => dic.Key) - .FirstOrDefault() - ?? - (_service.IsSingular(word) ? word : _service.Singularize(word)); - - if (string.Compare(word, newWord, true) != 0) - { - if (char.IsUpper(word[0])) - newWord = char.ToUpper(newWord[0]) + newWord.Substring(1, newWord.Length - 1); - - return word == str ? newWord : str.Substring(0, str.Length - word.Length) + newWord; - } - - return str; - } - - static string GetLastWordVersion1(string str) - { - if (string.IsNullOrWhiteSpace(str)) - return string.Empty; - - var i = str.Length - 1; - var isLower = char.IsLower(str[i]); - - while (i > 0 && char.IsLower(str[i-1]) == isLower) - i--; - - return str.Substring(isLower && i > 0 ? i - 1 : i); - } - - public static string ToPluralVersion1(string str) - { - if (_service == null) - _service = PluralizationService.CreateService(System.Globalization.CultureInfo.GetCultureInfo(CultureInfo)); - - var word = GetLastWordVersion1(str); - - string newWord; - - if (!Dictionary.TryGetValue(word.ToLower(), out newWord)) - newWord = _service.IsPlural(word) ? word : _service.Pluralize(word); - - if (string.Compare(word, newWord, true) != 0) - { - if (char.IsUpper(word[0])) - newWord = char.ToUpper(newWord[0]) + newWord.Substring(1, newWord.Length - 1); - - return word == str ? newWord : str.Substring(0, str.Length - word.Length) + newWord; - } - - return str; - } - - public static string ToSingularVersion1(string str) - { - if (_service == null) - _service = PluralizationService.CreateService(System.Globalization.CultureInfo.GetCultureInfo(CultureInfo)); - - var word = GetLastWordVersion1(str); - - var newWord = - Dictionary - .Where(dic => string.Compare(dic.Value, word, true) == 0) - .Select(dic => dic.Key) - .FirstOrDefault() - ?? - (_service.IsSingular(word) ? word : _service.Singularize(word)); - - if (string.Compare(word, newWord, true) != 0) - { - if (char.IsUpper(word[0])) - newWord = char.ToUpper(newWord[0]) + newWord.Substring(1, newWord.Length - 1); - - return word == str ? newWord : str.Substring(0, str.Length - word.Length) + newWord; - } - - return str; - } -} -#> diff --git a/src/Database.Tests/LinqToDB.Templates/T4Model.ttinclude b/src/Database.Tests/LinqToDB.Templates/T4Model.ttinclude deleted file mode 100644 index d164aae..0000000 --- a/src/Database.Tests/LinqToDB.Templates/T4Model.ttinclude +++ /dev/null @@ -1,1564 +0,0 @@ -<#@ assembly name="System.Core" #> -<#@ import namespace="System" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#+ -static Action<GeneratedTextTransformation,string> WriteComment = (tt,s) => tt.WriteLine("//{0}", s); - -Action BeforeGenerateModel = () => {}; - -bool GenerateProcedureErrors = true; - -void GenerateModel() -{ - Model.SetTree(); - - if (GenerationEnvironment.Length > 0 && GenerationEnvironment.ToString().Trim().Length == 0) - GenerationEnvironment.Length = 0; - - WriteComment(this, "---------------------------------------------------------------------------------------------------"); - WriteComment(this, " <auto-generated>"); - WriteComment(this, " This code was generated by T4Model template for T4 (https://github.com/linq2db/linq2db)."); - WriteComment(this, " Changes to this file may cause incorrect behavior and will be lost if the code is regenerated."); - WriteComment(this, " </auto-generated>"); - WriteComment(this, "---------------------------------------------------------------------------------------------------"); - - WriteLine(""); - WriteLine("#pragma warning disable 1591"); - WriteLine(""); - - BeforeGenerateModel(); - - Model.Render(this); - - WriteLine(""); - WriteLine("#pragma warning restore 1591"); - -} - -void Trim() -{ - var arr = new[] { '\r', '\n', ' ' }; - while (GenerationEnvironment.Length > 0 && arr.Contains(GenerationEnvironment[GenerationEnvironment.Length - 1])) - GenerationEnvironment.Length--; - - WriteLine(""); -} - -static Action<GeneratedTextTransformation,string> WriteUsing = (tt,s) => tt.WriteLine("using {0};", s); - -void RenderUsings(List<string> usings) -{ - var q = - from ns in usings.Distinct() - group ns by ns.Split('.')[0]; - - var groups = - (from ns in q where ns.Key == "System" select ns).Concat - (from ns in q where ns.Key != "System" orderby ns.Key select ns); - - foreach (var gr in groups) - { - foreach (var ns in from s in gr orderby s select s) - WriteUsing(this, ns); - - WriteLine(""); - } - - Trim(); -} - -// Base data types. -// -public interface ITree -{ - ITree Parent { get; set; } - IEnumerable<ITree> GetNodes(); - void SetTree(); -} - -ModelSource Model = new ModelSource(); - -public partial class ModelSource : ITree -{ - public int CurrentNamespace = 0; - - public List<string> Usings = new List<String> { "System" }; - public List<Namespace> Namespaces = new List<Namespace> { new Namespace() }; - - public Namespace Namespace { get { return Namespaces[CurrentNamespace]; } } - public List<TypeBase> Types { get { return Namespaces[CurrentNamespace].Types; } } - - public virtual void Render(GeneratedTextTransformation tt) - { - tt.RenderUsings(Usings); - tt.WriteLine(""); - - foreach (var nm in Namespaces) - { - nm.Render(tt); - tt.WriteLine(""); - } - - tt.Trim(); - } - - public ITree Parent { get; set; } - public IEnumerable<ITree> GetNodes() { return Namespaces; } - - public void SetTree() - { - foreach (var ch in GetNodes()) - { - ch.Parent = this; - ch.SetTree(); - } - } -} - -static Action<GeneratedTextTransformation,string> WriteBeginNamespace = (tt,s) => { tt.WriteLine("namespace {0}", s); tt.WriteLine("{"); }; -static Action<GeneratedTextTransformation> WriteEndNamespace = tt => tt.WriteLine("}"); - -public partial class Namespace : ITree -{ - public string Name; - public List<TypeBase> Types = new List<TypeBase>(); - public List<string> Usings = new List<string>(); - - public virtual void Render(GeneratedTextTransformation tt) - { - if (!string.IsNullOrEmpty(Name)) - { - WriteBeginNamespace(tt, Name); - tt.PushIndent("\t"); - } - - tt.RenderUsings(Usings); - - foreach (var t in Types) - { - t.Render(tt); - tt.WriteLine(""); - } - - tt.Trim(); - - if (!string.IsNullOrEmpty(Name)) - { - tt.PopIndent(); - WriteEndNamespace(tt); - } - } - - public ITree Parent { get; set; } - public IEnumerable<ITree> GetNodes() { return Types; } - - public void SetTree() - { - foreach (var ch in GetNodes()) - { - ch.Parent = this; - ch.SetTree(); - } - } -} - -public interface IClassMember : ITree -{ -} - -public enum AccessModifier -{ - Public, - Protected, - Internal, - Private, - Partial -} - -public abstract partial class TypeBase : IClassMember -{ - public AccessModifier AccessModifier = AccessModifier.Public; - public string Name; - public bool IsPartial = true; - public List<string> Comment = new List<string>(); - public List<Attribute> Attributes = new List<Attribute>(); - public string Conditional; - - public abstract void Render(GeneratedTextTransformation tt); - - protected virtual void BeginConditional(GeneratedTextTransformation tt) - { - if (Conditional != null) - { - tt.RemoveSpace(); - tt.WriteLine("#if " + Conditional); - tt.WriteLine(""); - } - } - - protected virtual void EndConditional(GeneratedTextTransformation tt) - { - if (Conditional != null) - { - tt.RemoveSpace(); - tt.WriteLine(""); - tt.RemoveSpace(); - tt.WriteLine("#endif"); - } - } - - public ITree Parent { get; set; } - public abstract IEnumerable<ITree> GetNodes(); - public abstract void SetTree (); -} - -static Action<GeneratedTextTransformation,Class> WriteBeginClass = (tt,cl) => -{ - tt.Write(cl.AccessModifier.ToString().ToLower() + " "); - if (cl.IsStatic) tt.Write("static "); - if (cl.IsPartial) tt.Write("partial ", cl.Name); - tt.Write("class {0}{1}", cl.Name, cl.GenericArguments.Count > 0 ? $"<{string.Join(", ", cl.GenericArguments)}>" : string.Empty); - - if (!string.IsNullOrEmpty(cl.BaseClass) || cl.Interfaces.Count > 0) - { - var arr = new[] { cl.BaseClass }.Concat(cl.Interfaces) - .Where(n => n != null) - .ToArray(); - - tt.Write(" : "); - tt.Write(string.Join(", ", arr)); - } - - tt.WriteLine(""); - tt.WriteLine("{"); -}; - -static Action<GeneratedTextTransformation> WriteEndClass = tt => tt.WriteLine("}"); - -public partial class Class : TypeBase -{ - public string BaseClass; - public List<string> GenericArguments = new List<string>(); - public bool IsStatic = false; - public List<string> Interfaces = new List<string>(); - public List<IClassMember> Members = new List<IClassMember>(); - - public Class() - { - } - - public Class(string name, params IClassMember[] members) - { - Name = name; - Members.AddRange(members); - } - - public override void Render(GeneratedTextTransformation tt) - { - BeginConditional(tt); - - foreach (var c in Comment) - tt.WriteLine("//" + c); - - if (Attributes.Count > 0) - { - var aa = Attributes.Where(a => !a.IsSeparated).ToList(); - - if (aa.Count > 0) - { - tt.Write("["); - - for (var i = 0; i < aa.Count; i++) - { - if (i > 0) SkipSpacesAndInsert(tt, ", "); - aa[i].Render(tt); - } - - tt.WriteLine("]"); - } - - aa = Attributes.Where(a => a.IsSeparated).ToList(); - - foreach (var a in aa) - { - tt.Write("["); - a.Render(tt); - tt.WriteLine("]"); - } - } - - WriteBeginClass(tt, this); - tt.PushIndent("\t"); - - foreach (var cm in Members) - { - if (cm is MemberBase) - { - var m = (MemberBase)cm; - - if (!(m is MemberGroup)) - m.BeginConditional(tt, false); - - foreach (var c in m.Comment) - WriteComment(tt, c); - - if (m.Attributes.Count > 0) - { - var q = - from a in m.Attributes - group a by a.Conditional ?? ""; - - foreach (var g in q) - { - if (g.Key.Length > 0) - { - tt.RemoveSpace(); - tt.WriteLine("#if " + g.Key); - } - - var attrs = g.ToList(); - - tt.Write("["); - - for (var i = 0; i < attrs.Count; i++) - { - if (i > 0) SkipSpacesAndInsert(tt, ", "); - attrs[i].Render(tt); - } - - tt.WriteLine("]"); - - if (g.Key.Length > 0) - { - tt.RemoveSpace(); - tt.WriteLine("#endif"); - } - } - } - - m.Render(tt, false); - if (m.InsertBlankLineAfter) - tt.WriteLine(""); - - if (!(m is MemberGroup)) - m.EndConditional(tt, false); - } - else if (cm is TypeBase) - { - var t = (TypeBase)cm; - - t.Render(tt); - tt.WriteLine(""); - } - } - - tt.Trim(); - - tt.PopIndent(); - WriteEndClass(tt); - - EndConditional(tt); - } - - public override IEnumerable<ITree> GetNodes() - { - return Members; - } - - public override void SetTree() - { - foreach (var ch in GetNodes()) - { - ch.Parent = this; - ch.SetTree(); - } - } -} - -public abstract partial class MemberBase : IClassMember -{ - public string ID; - public AccessModifier AccessModifier = AccessModifier.Public; - public string Name; - public Func<string> TypeBuilder; - public List<string> Comment = new List<string>(); - public string EndLineComment; - public List<Attribute> Attributes = new List<Attribute>(); - public bool InsertBlankLineAfter = true; - public string Conditional; - - public int AccessModifierLen; - public int ModifierLen; - public int TypeLen; - public int NameLen; - public int ParamLen; - public int BodyLen; - - public string Type - { - get { return TypeBuilder?.Invoke(); } - set { TypeBuilder = () => value; } - } - - public string BuildType() { return TypeBuilder?.Invoke(); } - - public virtual int CalcModifierLen() { return 0; } - public abstract int CalcBodyLen (); - public virtual int CalcParamLen () { return 0; } - public abstract void Render (GeneratedTextTransformation tt, bool isCompact); - - public virtual void BeginConditional(GeneratedTextTransformation tt, bool isCompact) - { - if (Conditional != null) - { - tt.RemoveSpace(); - tt.WriteLine("#if " + Conditional); - if (!isCompact) - tt.WriteLine(""); - } - } - - public virtual void EndConditional(GeneratedTextTransformation tt, bool isCompact) - { - if (Conditional != null) - { - tt.RemoveSpace(); - tt.WriteLine("#endif"); - if (!isCompact) - tt.WriteLine(""); - } - } - - public ITree Parent { get; set; } - public virtual IEnumerable<ITree> GetNodes() { return Enumerable.Empty<ITree>(); } - public virtual void SetTree () {} -} - -static Action<GeneratedTextTransformation,string> BeginRegion = (tt,s) => { tt.WriteLine("#region {0}", s); }; -static Action<GeneratedTextTransformation> EndRegion = (tt) => { tt.WriteLine("#endregion"); }; - -public partial class MemberGroup : MemberBase -{ - public string Region; - public bool IsCompact; - public bool IsPropertyGroup; - public List<IClassMember> Members = new List<IClassMember>(); - public List<string> Errors = new List<string>(); - - public override int CalcBodyLen() { return 0; } - - public override void Render(GeneratedTextTransformation tt, bool isCompact) - { - if (!string.IsNullOrEmpty(Region)) - { - BeginRegion(tt, Region); - tt.WriteLine(""); - } - - BeginConditional(tt, isCompact); - - if (Errors.Count > 0 && tt.GenerateProcedureErrors) - { - tt.RemoveSpace(); - WriteComment(tt, " Use 'GenerateProcedureErrors=false' to disable errors."); - foreach (var error in Errors) - { - tt.Error(error); - - foreach (var e in error.Split('\n')) - { - tt.RemoveSpace(); - tt.WriteLine("#error " + e.Trim('\r')); - } - } - - tt.WriteLine(""); - } - - if (IsCompact) - { - var allMembers = GetTreeNodes(this).OfType<MemberBase>().Where(m => !(m is MemberGroup)).ToList(); - - if (allMembers.Count > 0) - { - int max = allMembers.Max(m => m.AccessModifier.ToString().Length); - foreach (var m in allMembers) - m.AccessModifierLen = max; - - max = allMembers.Max(m => m.CalcModifierLen()); - foreach (var m in allMembers) - m.ModifierLen = max; - - max = allMembers.Max(m => (m.BuildType() ?? "").Length); - foreach (var m in allMembers) - m.TypeLen = max; - - var notHasGetter = allMembers.OfType<Property>().Any(m => m.IsAuto && !m.HasGetter); - var notHasSetter = allMembers.OfType<Property>().Any(m => m.IsAuto && !m.HasSetter); - - foreach (var p in allMembers.OfType<Property>()) - { - if (notHasGetter) p.GetterLen = 13; - if (notHasSetter) p.SetterLen = 13; - } - - max = allMembers.Max(m => m.Name.Length); - foreach (var m in allMembers) - m.NameLen = max; - - max = allMembers.Max(m => m.CalcParamLen()); - foreach (var m in allMembers) - m.ParamLen = max; - - max = allMembers.Max(m => m.CalcBodyLen()); - foreach (var m in allMembers) - m.BodyLen = max; - - var members = - ( - from m in allMembers - select new - { - m, - attrs = - ( - from a in m.Attributes - group a by a.Name into gr - select gr.Select((a,i) => new { a, name = a.Name + "." + i }).ToList() into s - from a in s - select a - ).ToList() - } - ).ToList(); - - var attrWeight = - ( - from m in members - from a in m.attrs - group a by a.name into gr - select new { gr.Key, Count = gr.Count() } - ).ToDictionary(a => a.Key, a => a.Count); - - var q = - from m in members - where m.attrs.Count > 0 - select new { m, w = m.attrs.Sum(aa => attrWeight[aa.name]) } into m - orderby m.w descending - select m.m; - - var attrs = new List<string>(); - - foreach (var m in q) - { - var list = m.attrs.Select(a => a.name).ToList(); - - if (attrs.Count == 0) - attrs.AddRange(list); - else - { - for (var i = 0; i < list.Count; i++) - { - var nm = list[i]; - - if (!attrs.Contains(nm)) - { - for (var j = i + 1; j < list.Count; j++) - { - var idx = attrs.IndexOf(list[j]); - - if (idx >= 0) - { - attrs.Insert(idx, nm); - break; - } - } - } - - if (!attrs.Contains(nm)) - attrs.Add(nm); - } - } - } - - var mms = members.Select(m => - { - var arr = new Attribute[attrs.Count]; - - foreach (var a in m.attrs) - arr[attrs.IndexOf(a.name)] = a.a; - - return new { m.m, attrs = arr.ToList() }; - }).ToList(); - - var idxs = Enumerable.Range(0, attrs.Count).Select(_ => new List<int>()).ToList(); - - for (var i = 0; i < mms.Count; i++) - for (var j = 0; j < mms[i].attrs.Count; j++) - if (mms[i].attrs[j] != null) - idxs[j].Add(i); - - var toRemove = new List<int>(); - - for (int i = 1; i < idxs.Count; i++) - { - for (int j = 0; j < i; j++) - { - if (idxs[j] == null) - continue; - - if (idxs[i].Intersect(idxs[j]).Count() == 0) - { - foreach (var m in mms) - { - if (m.attrs[i] != null) - { - m.attrs[j] = m.attrs[i]; - m.attrs[i] = null; - } - } - - idxs[j].AddRange(idxs[i]); - idxs[i] = null; - toRemove.Add(i); - break; - } - } - - } - - foreach (var n in toRemove.OrderByDescending(i => i)) - foreach (var m in mms) - m.attrs.RemoveAt(n); - - var lens = new int[attrs.Count - toRemove.Count]; - - foreach (var m in mms) - { - for (var i = 0; i < m.attrs.Count; i++) - { - var a = m.attrs[i]; - - if (a != null) - { - var len = a.Name.Length; - - if (a.Parameters.Count >= 0) - len += a.Parameters.Sum(p => 2 + p.Length); - - lens[i] = Math.Max(lens[i], len); - } - } - } - - foreach (var m in allMembers) - { - if (!(m is MemberGroup)) - m.BeginConditional(tt, IsCompact); - - foreach (var c in m.Comment) - WriteComment(tt, c); - - if (attrs.Count > 0) - { - var ma = mms.First(mr => mr.m == m); - - if (m.Attributes.Count > 0) - { - tt.Write("["); - - for (var i = 0; i < ma.attrs.Count; i++) - { - var a = ma.attrs[i]; - - if (a == null) - { - tt.WriteSpaces(lens[i]); - if (i + 1 < ma.attrs.Count) - tt.Write(" "); - } - else - { - var len = tt.GenerationEnvironment.Length; - a.Render(tt); - len = (tt.GenerationEnvironment.Length - len); - - var commaAdded = false; - - for (var j = i + 1; j < ma.attrs.Count; j++) - { - if (ma.attrs[j] != null) - { - SkipSpacesAndInsert(tt, ", "); - commaAdded = true; - break; - } - } - - if (i + 1 < ma.attrs.Count && !commaAdded) - tt.Write(" "); - - tt.WriteSpaces(lens[i] - len); - } - } - - tt.Write("] "); - } - else - { - tt.WriteSpaces(lens.Sum() + ma.attrs.Count * 2 + 1); - } - } - - m.Render(tt, true); - - if (!IsCompact) - tt.WriteLine(""); - - if (!(m is MemberGroup)) - m.EndConditional(tt, IsCompact); - } - } - } - else - { - foreach (var cm in Members) - { - if (cm is MemberBase) - { - var m = (MemberBase)cm; - - if (!(m is MemberGroup)) - m.BeginConditional(tt, IsCompact); - - foreach (var c in m.Comment) - WriteComment(tt, c); - - if (m.Attributes.Count > 0) - { - var q = - from a in m.Attributes - group a by a.Conditional ?? ""; - - foreach (var g in q) - { - if (g.Key.Length > 0) - { - tt.RemoveSpace(); - tt.WriteLine("#if " + g.Key); - } - - var attrs = g.ToList(); - - var aa = attrs.Where(a => !a.IsSeparated).ToList(); - - if (aa.Count > 0) - { - tt.Write("["); - - for (var i = 0; i < aa.Count; i++) - { - if (i > 0) tt.Write(", "); - aa[i].Render(tt); - } - - tt.WriteLine("]"); - } - - aa = attrs.Where(a => a.IsSeparated).ToList(); - - foreach (var a in aa) - { - tt.Write("["); - a.Render(tt); - tt.WriteLine("]"); - } - - if (g.Key.Length > 0) - { - tt.RemoveSpace(); - tt.WriteLine("#endif"); - } - } - } - - m.Render(tt, false); - - if (m.InsertBlankLineAfter) - tt.WriteLine(""); - - if (!(m is MemberGroup)) - m.EndConditional(tt, IsCompact); - } - else if (cm is TypeBase) - { - var t = (TypeBase)cm; - - t.Render(tt); - tt.WriteLine(""); - } - } - } - - tt.Trim(); - - EndConditional(tt, isCompact); - - if (!string.IsNullOrEmpty(Region)) - { - tt.WriteLine(""); - EndRegion(tt); - } - } - - public override IEnumerable<ITree> GetNodes() { return Members; } - - public override void SetTree() - { - foreach (var ch in GetNodes()) - { - ch.Parent = this; - ch.SetTree(); - } - } -} - -static Action<GeneratedTextTransformation,Field> WriteField = (tt,f) => -{ - var am = f.AccessModifier.ToString().ToLower(); - var mdf = - (f.IsStatic ? " static" : "") + - (f.IsReadonly ? " readonly" : "") ; - - tt.Write("{0}{1}{2}{3} {4}{5} {6}", - am, LenDiff(f.AccessModifierLen, am), - mdf, LenDiff(f.ModifierLen, mdf), - f.BuildType(), LenDiff(f.TypeLen, f.BuildType()), - f.Name); - - if (f.InitValue != null) - { - tt.Write(" = {0}", f.InitValue); - } - - tt.Write(";"); - - if (!string.IsNullOrEmpty(f.EndLineComment)) - { - tt.WriteSpaces(f.NameLen - f.Name.Length + f.BodyLen + f.ParamLen - 1); - tt.Write(" "); - WriteComment(tt, " " + f.EndLineComment); - } - else - tt.WriteLine(""); -}; - -public partial class Field : MemberBase -{ - public bool IsStatic; - public bool IsReadonly; - public string InitValue; - - public Field() - { - } - - public Field(Func<string> typeBuilder, string name) - { - TypeBuilder = typeBuilder; - Name = name; - } - - public override int CalcModifierLen() - { - return - (IsStatic ? " static". Length : 0) + - (IsReadonly ? " readonly".Length : 0) ; - } - - public override int CalcBodyLen() { return InitValue == null ? 1 : 4 + InitValue.Length; } - - public override void Render(GeneratedTextTransformation tt, bool isCompact) - { - WriteField(tt, this); - } -} - -static Action<GeneratedTextTransformation,Event> WriteEvent = (tt,m) => -{ - var am = m.AccessModifier.ToString().ToLower(); - var mdf = - (m.IsStatic ? " static" : "") + - (m.IsVirtual ? " virtual" : "") + - " event"; - - tt.Write("{0}{1}{2}{3} {4}{5} {6};", - am, LenDiff(m.AccessModifierLen, am), - mdf, LenDiff(m.ModifierLen, mdf), - m.BuildType(), LenDiff(m.TypeLen, m.BuildType()), - m.Name); - - if (!string.IsNullOrEmpty(m.EndLineComment)) - { - tt.WriteSpaces(m.NameLen - m.Name.Length + m.BodyLen + m.ParamLen - 1); - tt.Write(" "); - WriteComment(tt, " " + m.EndLineComment); - } - else - tt.WriteLine(""); -}; - -public partial class Event : MemberBase -{ - public bool IsStatic; - public bool IsVirtual; - - public Event() - { - } - - public Event(Func<string> typeBuilder, string name) - { - TypeBuilder = typeBuilder; - Name = name; - } - - public override int CalcModifierLen() - { - return - (IsStatic ? " static". Length : 0) + - (IsVirtual ? " virtual".Length : 0) + - " event".Length; - } - - public override int CalcBodyLen() { return 1; } - - public override void Render(GeneratedTextTransformation tt, bool isCompact) - { - WriteEvent(tt, this); - } -} - -static Action<GeneratedTextTransformation,Property,bool> WriteProperty = (tt,p,compact) => -{ - var am = p.AccessModifier.ToString().ToLower(); -// var mdf = p.IsVirtual ? " virtual" : ""; - var mdf = p.IsAbstract ? " abstract" : p.IsVirtual ? " virtual" : p.IsOverride ? " override" : p.IsStatic ? " static" : ""; - - tt.Write("{0}{1}{2}{3} {4}{5} {6}", - am, LenDiff(p.AccessModifierLen, am), - mdf, LenDiff(p.ModifierLen, mdf), - p.BuildType(), LenDiff(p.TypeLen, p.BuildType()), - p.Name); - - Action writeComment = () => - { - if (!string.IsNullOrEmpty(p.EndLineComment)) - { - tt.Write(" "); - WriteComment(tt, " " + p.EndLineComment); - } - else - tt.WriteLine(""); - }; - - if (p.IsAuto) - { - tt.Write(LenDiff(p.NameLen + p.ParamLen, p.Name)); - - var len = tt.GenerationEnvironment.Length; - - tt.Write(" { "); - - if (!p.HasGetter) - tt.Write("private "); - else if (p.GetterLen == 13) - tt.Write(" "); - tt.Write("get; "); - - if (!p.HasSetter) - tt.Write("private "); - else if (p.SetterLen == 13) - tt.Write(" "); - tt.Write("set; "); - - tt.Write("}"); - - if (!string.IsNullOrEmpty(p.EndLineComment)) - tt.WriteSpaces(p.BodyLen - (tt.GenerationEnvironment.Length - len)); - writeComment(); - } - else - { - if (compact) - { - tt.Write(LenDiff(p.NameLen + p.ParamLen, p.Name)); - - var len = tt.GenerationEnvironment.Length; - - tt.Write(" { "); - - if (p.HasGetter) - { - tt.Write("get { "); - foreach (var t in p.BuildGetBody()) - tt.Write("{0} ", t); - tt.Write("} "); - } - - if (p.HasSetter) - { - tt.Write("set { "); - foreach (var t in p.BuildSetBody()) - tt.Write("{0} ", t); - tt.Write("} "); - } - - tt.Write("}"); - - if (!string.IsNullOrEmpty(p.EndLineComment)) - tt.WriteSpaces(p.BodyLen - (tt.GenerationEnvironment.Length - len)); - writeComment(); - } - else - { - writeComment(); - - tt.WriteLine("{"); - tt.PushIndent("\t"); - - if (p.HasGetter) - { - var getBody = p.BuildGetBody().ToArray(); - if (getBody.Length == 1) - { - tt.WriteLine("get {{ {0} }}", getBody[0]); - } - else - { - tt.WriteLine("get"); - tt.WriteLine("{"); - tt.PushIndent("\t"); - - foreach (var t in getBody) - tt.WriteLine(t); - - tt.PopIndent(); - tt.WriteLine("}"); - } - } - - if (p.HasSetter) - { - var setBody = p.BuildSetBody().ToArray(); - if (setBody.Length == 1) - { - tt.WriteLine("set {{ {0} }}", setBody[0]); - } - else - { - tt.WriteLine("set"); - tt.WriteLine("{"); - tt.PushIndent("\t"); - - foreach (var t in setBody) - tt.WriteLine(t); - - tt.PopIndent(); - tt.WriteLine("}"); - } - } - - tt.PopIndent(); - tt.WriteLine("}"); - } - } -}; - -public partial class Property : MemberBase -{ - public bool IsAuto = true; - public string InitValue; - public bool IsVirtual; - public bool IsOverride; - public bool IsAbstract; - public bool IsStatic; - public bool HasGetter = true; - public bool HasSetter = true; - public List<Func<IEnumerable<string>>> GetBodyBuilders = new List<Func<IEnumerable<string>>>(); - public List<Func<IEnumerable<string>>> SetBodyBuilders = new List<Func<IEnumerable<string>>>(); - - public int GetterLen = 5; - public int SetterLen = 5; - - public Property() - { - } - - public Property(Func<string> typeBuilder, string name, Func<IEnumerable<string>> getBodyBuilder = null, Func<IEnumerable<string>> setBodyBuilder = null) - { - TypeBuilder = typeBuilder; - Name = name; - - InitBody(getBodyBuilder, setBodyBuilder); - } - - public override int CalcModifierLen() - { - return IsVirtual ? " virtual".Length : 0; - } - - public override int CalcBodyLen() - { - if (IsAuto) - return 4 + GetterLen + SetterLen; // ' { get; set; }' - - var len = " {".Length; - - if (HasGetter) - { - len += " get {".Length; - foreach (var t in BuildGetBody()) - len += 1 + t.Length; - len += " }".Length; - } - - if (HasSetter) - { - len += " set {".Length; - foreach (var t in BuildSetBody()) - len += 1 + t.Length; - len += " }".Length; - } - - len += " }".Length; - - return len; - } - - public override void Render(GeneratedTextTransformation tt, bool isCompact) - { - if (!IsAuto && HasGetter) - { - var getBody = BuildGetBody().ToArray(); - if (getBody.Length == 1) - { - var t = getBody[0]; - - if (!t.StartsWith("return")) - { - t = "return " + t; - - if (!t.EndsWith(";")) - t += ";"; - - GetBodyBuilders.Clear(); - GetBodyBuilders.Add(() => new [] { t }); - } - } - } - - WriteProperty(tt, this, isCompact); - } - - public Property InitBody(Func<IEnumerable<string>> getBodyBuilder = null, Func<IEnumerable<string>> setBodyBuilder = null) - { - IsAuto = getBodyBuilder == null && setBodyBuilder == null; - - if (getBodyBuilder != null) GetBodyBuilders.Add(getBodyBuilder); - if (setBodyBuilder != null) SetBodyBuilders.Add(setBodyBuilder); - - if (!IsAuto) - { - HasGetter = getBodyBuilder != null; - HasSetter = setBodyBuilder != null; - } - - return this; - } - - public Property InitGetter(Func<IEnumerable<string>> getBodyBuilder) - { - return InitBody(getBodyBuilder, null); - } - - public IEnumerable<string> BuildGetBody() - { - return GetBodyBuilders.SelectMany(builder => builder?.Invoke() ?? Array.Empty<string>()); - } - - public IEnumerable<string> BuildSetBody() - { - return SetBodyBuilders.SelectMany(builder => builder?.Invoke() ?? Array.Empty<string>()); - } -} - -static Action<GeneratedTextTransformation,Method,bool> WriteMethod = (tt,m,compact) => -{ - var am1 = m.AccessModifier.ToString().ToLower(); - var len1 = m.AccessModifierLen; - var am2 = ""; - var len2 = 0; - var mdf = m.IsAbstract ? " abstract" : m.IsVirtual ? " virtual" : m.IsOverride ? " override" : m.IsStatic ? " static" : ""; - var mlen = m.ModifierLen; - - if (am1 == "partial" && mdf.Length > 0) - { - am2 = " " + am1; len2 = len1 + 1; - am1 = ""; len1 = 0; - mdf = mdf.Trim(); - mlen--; - } - - tt.Write("{0}{1}{2}{3}{4}{5}{6}{7}{8} {9}{10}", - am1, LenDiff(len1, am1), - mdf, LenDiff(mlen, mdf), - am2, LenDiff(len2, am2), - m.BuildType() == null ? "" : " ", - m.BuildType(), LenDiff(m.TypeLen, m.BuildType() ?? ""), - m.Name, - m.GenericArguments.Count > 0 ? $"<{string.Join(", ", m.GenericArguments)}>" : string.Empty); - - Action writeComment = () => - { - if (!string.IsNullOrEmpty(m.EndLineComment)) - { - tt.Write(" "); - WriteComment(tt, " " + m.EndLineComment); - } - else - tt.WriteLine(""); - }; - - Action writeParams = () => - { - tt.Write("("); - - for (int i = 0; i < m.ParameterBuilders.Count; i++) - { - if (i > 0) - tt.Write(", "); - tt.Write(m.ParameterBuilders[i]()); - } - - tt.Write(")"); - }; - - if (compact) - { - tt.Write(LenDiff(m.NameLen, m.Name)); - - var len = tt.GenerationEnvironment.Length; - - writeParams(); - - foreach (var s in m.AfterSignature) - { - tt.Write(" "); - tt.Write(s); - } - - len = tt.GenerationEnvironment.Length - len; - - if (m.IsAbstract || m.AccessModifier == AccessModifier.Partial) - { - tt.Write(";"); - len = 0; - } - else - { - tt.WriteSpaces(m.ParamLen - len); - - len = tt.GenerationEnvironment.Length; - - tt.Write(" {"); - - foreach (var t in m.BuildBody()) - tt.Write(" {0}", t); - - tt.Write(" }"); - } - - if (!string.IsNullOrEmpty(m.EndLineComment)) - tt.WriteSpaces(m.BodyLen - (tt.GenerationEnvironment.Length - len)); - writeComment(); - } - else - { - writeParams (); - writeComment(); - - tt.PushIndent("\t"); - foreach (var s in m.AfterSignature) - tt.WriteLine(s); - tt.PopIndent(); - - tt.WriteLine("{"); - tt.PushIndent("\t"); - - foreach (var t in m.BuildBody()) - { - if (t.Length > 1 && t[0] == '#') - { - tt.RemoveSpace(); - } - - tt.WriteLine(t); - } - - tt.PopIndent(); - tt.WriteLine("}"); - } -}; - -public partial class Method : MemberBase -{ - public bool IsAbstract; - public bool IsVirtual; - public bool IsOverride; - public bool IsStatic; - public List<string> GenericArguments = new List<string>(); - public List<string> AfterSignature = new List<string>(); - public List<Func<string>> ParameterBuilders = new List<Func<string>>(); - public List<Func<IEnumerable<string>>> BodyBuilders = new List<Func<IEnumerable<string>>>(); - - public Method() - { - } - - public Method(Func<string> typeBuilder, string name, IEnumerable<Func<string>> parameterBuilders = null, params Func<IEnumerable<string>>[] bodyBuilders) - { - TypeBuilder = typeBuilder; - Name = name; - - if (parameterBuilders != null) ParameterBuilders.AddRange(parameterBuilders); - if (bodyBuilders != null) BodyBuilders.AddRange(bodyBuilders); - } - - public static Method Create(string type, string name, IEnumerable<string> parameters = null, IEnumerable<string> body = null) - { - return new Method( - () => type, - name, - parameters?.Select<string,Func<string>>((string p) => () => p), - body?.Select<string,Func<IEnumerable<string>>>(p => () => new[] { p }).ToArray()); - } - - public IEnumerable<string> BuildBody() - { - return BodyBuilders.SelectMany(builder => builder?.Invoke() ?? Array.Empty<string>()); - } - - public override int CalcModifierLen() - { - return - IsAbstract ? " abstract".Length : - IsVirtual ? " virtual".Length : - IsStatic ? " static".Length : 0; - } - - public override int CalcBodyLen() - { - if (IsAbstract || AccessModifier == AccessModifier.Partial) - return 1; - - var len = " {".Length; - - foreach (var t in BuildBody()) - len += 1 + t.Length; - - len += " }".Length; - - return len; - } - - public override int CalcParamLen() - { - return ParameterBuilders.Sum(p => p().Length + 2); - } - - public override void Render(GeneratedTextTransformation tt, bool isCompact) - { - WriteMethod(tt, this, isCompact); - } -} - -static Action<GeneratedTextTransformation,Attribute> WriteAttribute = (tt,a) => -{ - tt.Write(a.Name); - - if (a.Parameters.Count > 0) - { - tt.Write("("); - - for (var i = 0; i < a.Parameters.Count; i++) - { - if (i > 0) - if (a.Parameters[i - 1].All(c => c == ' ')) - tt.Write(" "); - else - SkipSpacesAndInsert(tt, ", "); - tt.Write(a.Parameters[i]); - } - - SkipSpacesAndInsert(tt, ")"); - } -}; - -public partial class Attribute -{ - public string Name; - public List<string> Parameters = new List<string>(); - public string Conditional; - public bool IsSeparated; - - public Attribute() - { - } - - public Attribute(string name, params string[] ps) - { - Name = name; - Parameters.AddRange(ps); - } - - public virtual void Render(GeneratedTextTransformation tt) - { - WriteAttribute(tt, this); - } -} - -// Helpers. -// - -Func<string,string> ToPlural = s => s + "s"; -Func<string,string> ToSingular = s => s; - -static string LenDiff(int max, string str) -{ - var s = ""; - - while (max-- > str.Length) - s += " "; - - return s; -} - -public void WriteSpaces(int len) -{ - while (len-- > 0) - Write(" "); -} - -void RemoveSpace() -{ - Write(" "); - - while (GenerationEnvironment.Length > 0 && - (GenerationEnvironment[GenerationEnvironment.Length - 1] == ' ' || - GenerationEnvironment[GenerationEnvironment.Length - 1] == '\t')) - GenerationEnvironment.Length--; -} - -public static IEnumerable<ITree> GetTreeNodes(ITree parent) -{ - foreach (var node in parent.GetNodes()) - { - yield return node; - - foreach (var grandNode in GetTreeNodes(node)) - yield return grandNode; - } -} - -public static ITree FindNode(ITree parent, Func<ITree,bool> func) -{ - foreach (var node in parent.GetNodes()) - { - if (func(node)) - return node; - - var n = FindNode(node, func); - - if (n != null) - return n; - } - - return null; -} - -static void SkipSpacesAndInsert(GeneratedTextTransformation tt, string value) -{ - var l = tt.GenerationEnvironment.Length; - - for (; l > 0 && tt.GenerationEnvironment[l - 1] == ' '; l--) - { - } - - tt.GenerationEnvironment.Insert(l, value); -} - - -string ToCamelCase(string name) -{ - var n = 0; - - foreach (var c in name) - { - if (char.IsUpper(c)) - n++; - else - break; - } - - if (n == 0) - return name; - - if (n == name.Length) - return name.ToLower(); - - n = Math.Max(1, n - 1); - - return name.Substring(0, n).ToLower() + name.Substring(n); -} - -event Action<Property,string,object> SetPropertyValueAction; - -void SetPropertyValue(Property propertyObject, string propertyName, object value) -{ - if (SetPropertyValueAction != null) - SetPropertyValueAction(propertyObject, propertyName, value); -} - -static string ToStringLiteral(string value) -{ - if (value == null) - return "null"; - - var sb = new StringBuilder("\""); - - foreach (var chr in value) - { - switch (chr) - { - case '\t': sb.Append("\\t"); break; - case '\n': sb.Append("\\n"); break; - case '\r': sb.Append("\\r"); break; - case '\\': sb.Append("\\\\"); break; - case '"' : sb.Append("\\\""); break; - case '\0': sb.Append("\\0"); break; - case '\u0085': - case '\u2028': - case '\u2029': - sb.Append($"\\u{(ushort)chr:X4}"); break; - default: sb.Append(chr); break; - } - } - - sb.Append('"'); - - return sb.ToString(); -} - -#> diff --git a/src/Database.Tests/LinqToDB.Templates/Validation.ttinclude b/src/Database.Tests/LinqToDB.Templates/Validation.ttinclude deleted file mode 100644 index 45a7e84..0000000 --- a/src/Database.Tests/LinqToDB.Templates/Validation.ttinclude +++ /dev/null @@ -1,189 +0,0 @@ -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - beforeGenerateModel(); - ValidationImpl(); - }; - } -#> -<#+ -void ValidationImpl() -{ - foreach (Class cl in GetTreeNodes(Model).OfType<Class>()) - { - var validationGroup = new MemberGroup - { - Region = "Validation", - }; - - var props = GetTreeNodes(cl).OfType<Property>().Where(p => p.CustomValidation).ToList(); - - if (props.Count > 0) - { - if (!Model.Usings.Contains("System.Collections.Generic")) - Model.Usings.Add("System.Collections.Generic"); - - var isValid = new Method(() => "bool", "IsValid", new Func<string>[] { () => cl.Name + " obj" }) { IsStatic = true }; - var validator = new Class("CustomValidator", isValid) { IsStatic = true, }; - var partialGroup = new MemberGroup { IsCompact = true }; - - validationGroup.Members.Add(new Field(() => "int", "_isValidCounter") { Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } }); - validationGroup.Members.Add(validator); - validationGroup.Members.Add(partialGroup); - - isValid.BodyBuilders.Add(() => new [] - { - "try", - "{", - "\tobj._isValidCounter++;", - "" - }); - - var ret = "\treturn "; - - for (var idx = 0; idx < props.Count; idx++) - { - var i = idx; - var p = props[i]; - - var name = p.Name.Trim(); - var mname = "Validate" + name; - - cl.Attributes.Add( - new Attribute("CustomValidation", - "typeof(" + cl.Name + ".CustomValidator)", - ToStringLiteral(mname)) - { - IsSeparated = true - }); - - isValid.BodyBuilders.Add(() => new [] { - "\tvar flag" + i + " = ValidationResult.Success == " + mname + "(obj, obj." + name + ");" }); - - ret += (i == 0 ? "" : " || ") + "flag" + i; - - var validate = new Method(() => "ValidationResult", mname, - new Func<string>[] { () => cl.Name + " obj", () => p.BuildType().Trim() + " value" }) { IsStatic = true }; - - validate.BodyBuilders.Add(() => new [] - { - "var list = new List<ValidationResult>();", - "", - "Validator.TryValidateProperty(", - "\tvalue,", - "\tnew ValidationContext(obj, null, null) { MemberName = NameOf" + name + " }, list);", - "", - "obj." + mname + "(value, list);", - "", - "if (list.Count > 0)", - "{", - "\tforeach (var result in list)", - "\t\tforeach (var name in result.MemberNames)", - "\t\t\tobj.AddError(name, result.ErrorMessage);", - "", - "\treturn list[0];", - "}", - "", - "obj.RemoveError(NameOf" + name + ");", - "", - "return ValidationResult.Success;" - }); - - validator.Members.Add(validate); - - partialGroup.Members.Add(new Method( - () => "void", - mname, - new Func<string>[] - { - () => p.BuildType().Trim() + " value", - () => "List<ValidationResult> validationResults", - }) - { - AccessModifier = AccessModifier.Partial, - }); - } - - isValid.BodyBuilders.Add(() => new [] - { - "", - ret + ";", - "}", - "finally", - "{", - "\tobj._isValidCounter--;", - "}" - }); - } - - props = GetTreeNodes(cl).OfType<Property>().Where(p => p.ValidateProperty && p.HasSetter).ToList(); - - if (props.Count > 0) - { - foreach (var p in props) - { - var setBody = p.BuildSetBody().ToList(); - if (setBody.Count > 0) - setBody.Insert(0, ""); - - setBody.Insert(0, "if (_validationLockCounter == 0)"); - setBody.Insert(1, "{"); - - if (p.CustomValidation) - { - setBody.Insert(2, "\tvar validationResult = CustomValidator.Validate" + p.Name.Trim() + "(this, value);"); - setBody.Insert(3, "\tif (validationResult != ValidationResult.Success)"); - setBody.Insert(4, "\t\tthrow new ValidationException(validationResult, null, null);"); - setBody.Insert(5, "}"); - } - else - { - setBody.Insert(2, "\tValidator.ValidateProperty("); - setBody.Insert(3, "\t\tvalue,"); - setBody.Insert(4, string.Format("\t\tnew ValidationContext(this, null, null) {{ MemberName = NameOf{0} }});", p.Name.Trim())); - setBody.Insert(5, "}"); - } - - p.SetBodyBuilders.Clear(); - p.SetBodyBuilders.Add(() => setBody.ToArray()); - } - - validationGroup.Members.Add(new Field(() => "int", "_validationLockCounter") - { - AccessModifier = AccessModifier.Private, - InitValue = "0", - Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } - }); - - validationGroup.Members.Add(new Method (() => "void", "LockValidation", null, () => new[] { "_validationLockCounter++;" })); - validationGroup.Members.Add(new Method (() => "void", "UnlockValidation", null, () => new[] { "_validationLockCounter--;" })); - } - - if (validationGroup.Members.Count > 0) - { - if (!Model.Usings.Contains("System.ComponentModel.DataAnnotations")) - Model.Usings.Add("System.ComponentModel.DataAnnotations"); - - cl.Members.Add(validationGroup); - cl.SetTree(); - } - } -} - -partial class Property -{ - public bool CustomValidation; - public bool ValidateProperty; - - public bool Validate - { - set - { - CustomValidation = value; - ValidateProperty = value; - } - } -} -#> diff --git a/src/Database.Tests/ModelTests.cs b/src/Database.Tests/ModelTests.cs index ff87062..cb9dbea 100644 --- a/src/Database.Tests/ModelTests.cs +++ b/src/Database.Tests/ModelTests.cs @@ -1,4 +1,7 @@ -using LinqToDB; +using Coscine.Configuration; +using Coscine.Database.Settings; +using LinqToDB; +using LinqToDB.Data; using NUnit.Framework; using System.Linq; @@ -7,35 +10,27 @@ namespace Coscine.Database.Tests [TestFixture] public class ModelTests { - private Migration.Migrator _migrator; - private string _providerName; - private string _connectionString; - - [OneTimeSetUp] + //[OneTimeSetUp] public void Init() { var targetAssembly = typeof(ModelTests).Assembly; - _migrator = new Migration.Migrator(targetAssembly); - _providerName = "SqlServer.2008"; - _connectionString = _migrator.GetDbConnectionString(); + DataConnection.DefaultSettings = new CoscineSettings(new ConsulConfiguration()); } - [SetUpAttribute] + //[SetUpAttribute] public void SetUp() { - _migrator.MigrateUp(); } - [TearDown] + //[TearDown] public void TearDown() { - _migrator.RollBack(2); } - [Test] + //[Test] public void TestRead() { - using (var db = new TestCoscineDb(_providerName, _connectionString)) + using (var db = new TestCoscineDb()) { var q = from p in db.TestUsers @@ -46,10 +41,10 @@ namespace Coscine.Database.Tests } } - [Test] + //[Test] public void TestInsert() { - using (var db = new TestCoscineDb(_providerName, _connectionString)) + using (var db = new TestCoscineDb()) { db.TestProjects .Value(p => p.ProjectName, "project4") @@ -63,10 +58,10 @@ namespace Coscine.Database.Tests } } - [Test] + //[Test] public void TestDelete() { - using (var db = new TestCoscineDb(_providerName, _connectionString)) + using (var db = new TestCoscineDb()) { db.TestUsers .Where(p => p.UserId == 3) @@ -81,10 +76,10 @@ namespace Coscine.Database.Tests } } - [Test] + //[Test] public void TestJoin() { - using (var db = new TestCoscineDb(_providerName, _connectionString)) + using (var db = new TestCoscineDb()) { var q = from u in db.TestUsers diff --git a/src/Database.Tests/Properties/AssemblyInfo.cs b/src/Database.Tests/Properties/AssemblyInfo.cs index 27aed86..d65d74b 100644 --- a/src/Database.Tests/Properties/AssemblyInfo.cs +++ b/src/Database.Tests/Properties/AssemblyInfo.cs @@ -9,8 +9,8 @@ using System.Reflection; [assembly: AssemblyDescription("Database.Tests is a part of the CoScInE group.")] [assembly: AssemblyCompany("IT Center, RWTH Aachen University")] [assembly: AssemblyProduct("Database.Tests")] -[assembly: AssemblyVersion("1.15.0")] -[assembly: AssemblyFileVersion("1.15.0")] -[assembly: AssemblyInformationalVersion("1.15.0-topic-632-projec0003")] +[assembly: AssemblyVersion("1.16.0")] +[assembly: AssemblyFileVersion("1.16.0")] +[assembly: AssemblyInformationalVersion("1.16.0-topic-670-apiref0017")] [assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")] diff --git a/src/Database.Tests/TestCoscineDB.cs b/src/Database.Tests/TestCoscineDB.cs index 7009be9..c3a955d 100644 --- a/src/Database.Tests/TestCoscineDB.cs +++ b/src/Database.Tests/TestCoscineDB.cs @@ -1,16 +1,10 @@ -using Coscine.Database.Model; -using LinqToDB; +using LinqToDB; using LinqToDB.Mapping; namespace Coscine.Database.Tests { - public class TestCoscineDb : CoscineDB + public class TestCoscineDb : LinqToDB.Data.DataConnection { - public TestCoscineDb(string providerName, string connectionString) : base(providerName, connectionString) - { - - } - public ITable<TestProject> TestProjects { get => GetTable<TestProject>(); } public ITable<TestUser> TestUsers { get => GetTable<TestUser>(); } } diff --git a/src/Database.Tests/packages.config b/src/Database.Tests/packages.config index 3a7c6c7..a1a5b58 100644 --- a/src/Database.Tests/packages.config +++ b/src/Database.Tests/packages.config @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> + <package id="Consul" version="0.7.2.6" targetFramework="net461" /> + <package id="Coscine.Configuration" version="1.4.0" targetFramework="net461" /> <package id="FluentMigrator" version="3.1.3" targetFramework="net461" /> <package id="FluentMigrator.Abstractions" version="3.1.3" targetFramework="net461" /> <package id="linq2db" version="2.6.4" targetFramework="net461" /> diff --git a/src/Database.sln b/src/Database.sln index b48ad80..61b45f0 100644 --- a/src/Database.sln +++ b/src/Database.sln @@ -4,14 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 16.0.29009.5 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Database", "Database\Database.csproj", "{A7369EA1-F9AB-49D2-BDB1-C3FACD37BBD0}" - ProjectSection(ProjectDependencies) = postProject - {A48A255E-D08A-4336-B481-266DEBFABDE9} = {A48A255E-D08A-4336-B481-266DEBFABDE9} - EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Database.Tests", "Database.Tests\Database.Tests.csproj", "{2A5D0EC8-E487-4B43-A311-05852464ED01}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Migrator", "Migrator\Migrator.csproj", "{A48A255E-D08A-4336-B481-266DEBFABDE9}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -26,10 +21,6 @@ Global {2A5D0EC8-E487-4B43-A311-05852464ED01}.Debug|Any CPU.Build.0 = Debug|Any CPU {2A5D0EC8-E487-4B43-A311-05852464ED01}.Release|Any CPU.ActiveCfg = Release|Any CPU {2A5D0EC8-E487-4B43-A311-05852464ED01}.Release|Any CPU.Build.0 = Release|Any CPU - {A48A255E-D08A-4336-B481-266DEBFABDE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A48A255E-D08A-4336-B481-266DEBFABDE9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A48A255E-D08A-4336-B481-266DEBFABDE9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A48A255E-D08A-4336-B481-266DEBFABDE9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Database/App.config b/src/Database/App.config new file mode 100644 index 0000000..7e1d79c --- /dev/null +++ b/src/Database/App.config @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> + <parameters> + <parameter value="mssqllocaldb" /> + </parameters> + </defaultConnectionFactory> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> +</configuration> \ No newline at end of file diff --git a/src/Database/DataModel/CsDatabase.tt b/src/Database/DataModel/CsDatabase.tt index 9b187eb..27cc397 100644 --- a/src/Database/DataModel/CsDatabase.tt +++ b/src/Database/DataModel/CsDatabase.tt @@ -1,11 +1,10 @@ -#region DupFinder Exclusion -<#@ template language="C#" debug="True" hostSpecific="False" #> +<#@ template language="C#" debug="True" hostSpecific="False" #> <#@ output extension=".generated.cs" #> <#@ include file="$(ProjectDir)LinqToDB.Templates\LinqToDB.SqlServer.Tools.ttinclude" #> <#@ include file="$(ProjectDir)LinqToDB.Templates\PluralizationService.ttinclude" #> <#@ include file="$(ProjectDir)DatabaseConnection.t4" #> -<# NamespaceName = "Coscine.Database.Model"; #> +<# NamespaceName = "Coscine.Database.DataModel"; #> <# DatabaseConnection dbKeys = new DatabaseConnection(); @@ -13,8 +12,4 @@ DataContextName ="CoscineDB"; LoadSqlServerMetadata(keys[0], keys[1], keys[2], keys[3]); GenerateModel(); -#> - -<#@ include file="../DataModelConstructor.t4"#> - -#endregion \ No newline at end of file +#> \ No newline at end of file diff --git a/src/Database/Database.csproj b/src/Database/Database.csproj index 4f03723..0995d77 100644 --- a/src/Database/Database.csproj +++ b/src/Database/Database.csproj @@ -46,12 +46,26 @@ <Reference Include="Coscine.Configuration, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL"> <HintPath>..\packages\Coscine.Configuration.1.4.0\lib\net461\Coscine.Configuration.dll</HintPath> </Reference> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> <Reference Include="linq2db, Version=2.6.4.0, Culture=neutral, PublicKeyToken=e41013125f9e410a, processorArchitecture=MSIL"> <HintPath>..\packages\linq2db.2.6.4\lib\net46\linq2db.dll</HintPath> </Reference> + <Reference Include="LinqKit, Version=1.1.17.0, Culture=neutral, PublicKeyToken=bc217f8844052a91, processorArchitecture=MSIL"> + <HintPath>..\packages\LinqKit.1.1.17\lib\net45\LinqKit.dll</HintPath> + </Reference> + <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> + </Reference> <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Core" /> <Reference Include="System.Net.Http.WebRequest" /> + <Reference Include="System.Web" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="Microsoft.CSharp" /> @@ -61,6 +75,26 @@ </ItemGroup> <Import Project="CustomT4.targets" /> <ItemGroup> + <Compile Include="Models\ExternalAuthenticatorModel.cs" /> + <Compile Include="Models\ExternalIdModel.cs" /> + <Compile Include="ReturnObjects\DisciplineObject.cs" /> + <Compile Include="ReturnObjects\GitlabResourceTypeObject.cs" /> + <Compile Include="ReturnObjects\InstituteObject.cs" /> + <Compile Include="ReturnObjects\IReturnObject.cs" /> + <Compile Include="ReturnObjects\LicenseObject.cs" /> + <Compile Include="ReturnObjects\ProjectObject.cs" /> + <Compile Include="ReturnObjects\ProjectRoleObject.cs" /> + <Compile Include="ReturnObjects\RDSResourceTypeObject.cs" /> + <Compile Include="ReturnObjects\ResourceObject.cs" /> + <Compile Include="ReturnObjects\ResourceTypeObject.cs" /> + <Compile Include="ReturnObjects\ResourceTypeOptionObject.cs" /> + <Compile Include="ReturnObjects\RoleObject.cs" /> + <Compile Include="ReturnObjects\S3ResourceTypeObject.cs" /> + <Compile Include="ReturnObjects\UserObject.cs" /> + <Compile Include="ReturnObjects\VisibilityObject.cs" /> + <Compile Include="ReturnObjects\WaterbutlerFolder.cs" /> + <Compile Include="Util\UserRoles.cs" /> + <None Include="App.config" /> <None Include="Coscine.Database.Key.snk" /> <None Include="CustomT4.targets" /> <None Include="DatabaseConnection.t4"> @@ -69,11 +103,34 @@ <None Include="DataModelConstructor.t4"> <LastGenOutput>DataModelConstructor1.generated.cs</LastGenOutput> </None> + <Compile Include="Settings\ConnectionStringSettings.cs" /> + <Compile Include="Settings\CoscineSettings.cs" /> + <Compile Include="Util\DatabaseConnection.cs" /> <Compile Include="DataModel\CsDatabase.generated.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> <DependentUpon>CsDatabase.tt</DependentUpon> </Compile> + <Compile Include="Models\DatabaseModel.cs" /> + <Compile Include="Models\DisciplineModel.cs" /> + <Compile Include="Models\GitlabResourceTypeModel.cs" /> + <Compile Include="Models\InstituteModel.cs" /> + <Compile Include="Models\LicenseModel.cs" /> + <Compile Include="Models\MetadataModel.cs" /> + <Compile Include="Models\ProjectDisciplineModel.cs" /> + <Compile Include="Models\ProjectInstituteModel.cs" /> + <Compile Include="Models\ProjectModel.cs" /> + <Compile Include="Models\ProjectResourceModel.cs" /> + <Compile Include="Models\ProjectRoleModel.cs" /> + <Compile Include="Models\RDSResourceTypeModel.cs" /> + <Compile Include="Models\ResourceDisciplineModel.cs" /> + <Compile Include="Models\ResourceModel.cs" /> + <Compile Include="Models\ResourceTypeModel.cs" /> + <Compile Include="Models\RoleModel.cs" /> + <Compile Include="Models\S3ResourceTypeModel.cs" /> + <Compile Include="Models\SubProjectModel.cs" /> + <Compile Include="Models\UserModel.cs" /> + <Compile Include="Models\VisibilityModel.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> @@ -131,6 +188,7 @@ <None Include="LinqToDB.Templates\Validation.ttinclude" /> <None Include="packages.config" /> </ItemGroup> + <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <PropertyGroup> <!-- Get the Visual Studio version: --> diff --git a/src/Database/Database.nuspec b/src/Database/Database.nuspec index 07684ca..ab78dbb 100644 --- a/src/Database/Database.nuspec +++ b/src/Database/Database.nuspec @@ -8,7 +8,7 @@ <owners>rwth-aachen</owners> <license type="expression">MIT</license> <projectUrl>https://git.rwth-aachen.de/coscine/cs/database</projectUrl> - <requireLicenseAcceptance>true</requireLicenseAcceptance> + <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>$description$</description> <copyright>$copyright$</copyright> </metadata> diff --git a/src/Database/Models/DatabaseModel.cs b/src/Database/Models/DatabaseModel.cs new file mode 100644 index 0000000..c8f853a --- /dev/null +++ b/src/Database/Models/DatabaseModel.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using LinqKit; +using LinqToDB; +using Coscine.Database.Util; +using Coscine.Database.DataModel; + +namespace Coscine.Database.Models +{ + public abstract class DatabaseModel<T> + { + public abstract Expression<Func<T, Guid>> GetIdFromObject(); + + public abstract void SetObjectId(T databaseObject, Guid id); + + public abstract ITable<T> GetITableFromDatabase(CoscineDB db); + + + // GetById utilizes the Expression functionality since Linq2Sql does not support method calls + // This is therefore a workaround for getting the Id parameter + public virtual T GetById(Guid id) + { + Expression<Func<T, Guid>> expression = GetIdFromObject(); + return DatabaseConnection.ConnectToDatabase((db) => + { + return + (from tableEntry in GetITableFromDatabase(db).AsExpandable() + where expression.Invoke(tableEntry) == id + select tableEntry).First(); + }); + } + + public virtual T GetWhere(Expression<Func<T, bool>> whereClause) + { + return DatabaseConnection.ConnectToDatabase((db) => + { + return + (from tableEntry in GetITableFromDatabase(db).AsExpandable() + where whereClause.Invoke(tableEntry) + select tableEntry).First(); + }); + } + + public virtual IEnumerable<T> GetAll() + { + return DatabaseConnection.ConnectToDatabase((db) => + { + return + (from tableEntry in GetITableFromDatabase(db) + select tableEntry).ToList(); + }); + } + + public virtual IEnumerable<T> GetAllWhere(Expression<Func<T, bool>> whereClause) + { + return DatabaseConnection.ConnectToDatabase((db) => + { + return + (from tableEntry in GetITableFromDatabase(db).AsExpandable() + where whereClause.Invoke(tableEntry) + select tableEntry).ToList(); + }); + } + + public virtual int Update(T databaseObject) + { + return DatabaseConnection.ConnectToDatabase((db) => + { + return db.Update(databaseObject); + }); + } + + public virtual int Insert(T databaseObject) + { + if (GetIdFromObject().Invoke(databaseObject) == new Guid("00000000-0000-0000-0000-000000000000")) + { + SetObjectId(databaseObject, Guid.NewGuid()); + } + + return DatabaseConnection.ConnectToDatabase((db) => + { + return db.Insert(databaseObject); + }); + } + + public virtual int Delete(T databaseObject) + { + return DatabaseConnection.ConnectToDatabase((db) => + { + return db.Delete(databaseObject); + }); + } + + } +} diff --git a/src/Database/Models/DisciplineModel.cs b/src/Database/Models/DisciplineModel.cs new file mode 100644 index 0000000..fc149ac --- /dev/null +++ b/src/Database/Models/DisciplineModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class DisciplineModel : DatabaseModel<Discipline> + { + public override Expression<Func<Discipline, Guid>> GetIdFromObject() + { + return (discipline) => discipline.Id; + } + + public override ITable<Discipline> GetITableFromDatabase(CoscineDB db) + { + return db.Disciplines; + } + + public override void SetObjectId(Discipline databaseObject, Guid id) + { + databaseObject.Id = id; + } + } +} diff --git a/src/Database/Models/ExternalAuthenticatorModel.cs b/src/Database/Models/ExternalAuthenticatorModel.cs new file mode 100644 index 0000000..956b3f9 --- /dev/null +++ b/src/Database/Models/ExternalAuthenticatorModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class ExternalAuthenticatorModel : DatabaseModel<ExternalAuthenticator> + { + public override Expression<Func<ExternalAuthenticator, Guid>> GetIdFromObject() + { + return (value) => value.Id; + } + + public override ITable<ExternalAuthenticator> GetITableFromDatabase(CoscineDB db) + { + return db.ExternalAuthenticators; + } + + public override void SetObjectId(ExternalAuthenticator databaseObject, Guid id) + { + databaseObject.Id = id; + } + } +} diff --git a/src/Database/Models/ExternalIdModel.cs b/src/Database/Models/ExternalIdModel.cs new file mode 100644 index 0000000..403bf96 --- /dev/null +++ b/src/Database/Models/ExternalIdModel.cs @@ -0,0 +1,29 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; + +namespace Coscine.Database.Models +{ + public class ExternalIdModel : DatabaseModel<ExternalId> + { + public override Expression<Func<ExternalId, Guid>> GetIdFromObject() + { + return (value) => value.RelationId; + } + + public override ITable<ExternalId> GetITableFromDatabase(CoscineDB db) + { + return db.ExternalIds; + } + + public override void SetObjectId(ExternalId databaseObject, Guid id) + { + databaseObject.RelationId = id; + } + } +} diff --git a/src/Database/Models/GitlabResourceTypeModel.cs b/src/Database/Models/GitlabResourceTypeModel.cs new file mode 100644 index 0000000..e77fabd --- /dev/null +++ b/src/Database/Models/GitlabResourceTypeModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class GitlabResourceTypeModel : DatabaseModel<GitlabResourceType> + { + public override Expression<Func<GitlabResourceType, Guid>> GetIdFromObject() + { + return (gitlabResourceType) => gitlabResourceType.Id; + } + + public override ITable<GitlabResourceType> GetITableFromDatabase(CoscineDB db) + { + return db.GitlabResourceTypes; + } + + public override void SetObjectId(GitlabResourceType databaseObject, Guid id) + { + databaseObject.Id = id; + } + } +} diff --git a/src/Database/Models/InstituteModel.cs b/src/Database/Models/InstituteModel.cs new file mode 100644 index 0000000..3216522 --- /dev/null +++ b/src/Database/Models/InstituteModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class InstituteModel : DatabaseModel<Institute> + { + public override Expression<Func<Institute, Guid>> GetIdFromObject() + { + return (institute) => institute.Id; + } + + public override ITable<Institute> GetITableFromDatabase(CoscineDB db) + { + return db.Institutes; + } + + public override void SetObjectId(Institute databaseObject, Guid id) + { + databaseObject.Id = id; + } + } +} diff --git a/src/Database/Models/LicenseModel.cs b/src/Database/Models/LicenseModel.cs new file mode 100644 index 0000000..87866ed --- /dev/null +++ b/src/Database/Models/LicenseModel.cs @@ -0,0 +1,23 @@ +using Coscine.Database.DataModel; +using System; + +namespace Coscine.Database.Models +{ + public class LicenseModel : DatabaseModel<License> + { + public override System.Linq.Expressions.Expression<Func<License, Guid>> GetIdFromObject() + { + return (license) => license.Id; + } + + public override LinqToDB.ITable<License> GetITableFromDatabase(CoscineDB db) + { + return db.Licenses; + } + + public override void SetObjectId(License databaseObject, Guid id) + { + databaseObject.Id = id; + } + } +} diff --git a/src/Database/Models/MetadataModel.cs b/src/Database/Models/MetadataModel.cs new file mode 100644 index 0000000..e2c13ae --- /dev/null +++ b/src/Database/Models/MetadataModel.cs @@ -0,0 +1,60 @@ +using Coscine.Database.ReturnObjects; +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Web; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class MetadataModel : DatabaseModel<Resource> + { + + public override Expression<Func<Resource, Guid>> GetIdFromObject() + { + throw new NotImplementedException(); + } + + public override void SetObjectId(Resource databaseObject, Guid id) + { + throw new NotImplementedException(); + } + + public override ITable<Resource> GetITableFromDatabase(CoscineDB db) + { + throw new NotImplementedException(); + } + + public Resource StoreFromObject(ResourceObject resourceObject) + { + Resource resource = new Resource() + { + DisplayName = resourceObject.DisplayName, + ResourceName = resourceObject.ResourceName, + Keywords = resourceObject.Keywords, + UsageRights = resourceObject.UsageRights, + TypeId = resourceObject.Type.Id, + Type = new ResourceTypeModel().GetById(resourceObject.Type.Id), + VisibilityId = resourceObject.Visibility.Id, + LicenseId = resourceObject.License.Id + }; + + + return resource; + } + + public string GenerateId(string resourceId, string filename, string version) + { + // Double UrlEncode since converting it to Uri executes one UrlDecode and Virtuoso + // graph names don't support special characters + var encodedFileName = HttpUtility.UrlEncode(HttpUtility.UrlEncode(filename)); + return $"https://purl.org/coscine/md/{resourceId}/{encodedFileName}/{version}/"; + } + + public Uri CreateUri(string graphName) + { + return new Uri(graphName); + } + } + +} diff --git a/src/Database/Models/ProjectDisciplineModel.cs b/src/Database/Models/ProjectDisciplineModel.cs new file mode 100644 index 0000000..19ffb21 --- /dev/null +++ b/src/Database/Models/ProjectDisciplineModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class ProjectDisciplineModel : DatabaseModel<ProjectDiscipline> + { + public override Expression<Func<ProjectDiscipline, Guid>> GetIdFromObject() + { + return (projectDiscipline) => projectDiscipline.RelationId; + } + + public override ITable<ProjectDiscipline> GetITableFromDatabase(CoscineDB db) + { + return db.ProjectDisciplines; + } + + public override void SetObjectId(ProjectDiscipline databaseObject, Guid id) + { + databaseObject.RelationId = id; + } + } +} diff --git a/src/Database/Models/ProjectInstituteModel.cs b/src/Database/Models/ProjectInstituteModel.cs new file mode 100644 index 0000000..176b4a8 --- /dev/null +++ b/src/Database/Models/ProjectInstituteModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class ProjectInstituteModel : DatabaseModel<ProjectInstitute> + { + public override Expression<Func<ProjectInstitute, Guid>> GetIdFromObject() + { + return (projectInstitute) => projectInstitute.RelationId; + } + + public override ITable<ProjectInstitute> GetITableFromDatabase(CoscineDB db) + { + return db.ProjectInstitutes; + } + + public override void SetObjectId(ProjectInstitute databaseObject, Guid id) + { + databaseObject.RelationId = id; + } + } +} diff --git a/src/Database/Models/ProjectModel.cs b/src/Database/Models/ProjectModel.cs new file mode 100644 index 0000000..eaf6cc7 --- /dev/null +++ b/src/Database/Models/ProjectModel.cs @@ -0,0 +1,390 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using Coscine.Database.ReturnObjects; +using Coscine.Database.DataModel; +using LinqToDB; +using Coscine.Database.Util; +using LinqKit; + +namespace Coscine.Database.Models +{ + public class ProjectModel : DatabaseModel<Project> + { + public bool IsDeleted(Guid id) + { + return DatabaseConnection.ConnectToDatabase((db) => + { + return + (from tableEntry in GetITableFromDatabase(db).AsExpandable() + where tableEntry.Id == id + && tableEntry.Deleted == true + select tableEntry).Count() == 1; + }); + } + + public override Project GetById(Guid id) + { + var expression = GetIdFromObject(); + return DatabaseConnection.ConnectToDatabase((db) => + { + return + (from tableEntry in GetITableFromDatabase(db).AsExpandable() + where expression.Invoke(tableEntry) == id + && tableEntry.Deleted == false + select tableEntry).First(); + }); + } + + public Project GetByIdIncludingDeleted(Guid id) + { + var expression = GetIdFromObject(); + return DatabaseConnection.ConnectToDatabase((db) => + { + return + (from tableEntry in GetITableFromDatabase(db).AsExpandable() + where expression.Invoke(tableEntry) == id + select tableEntry).First(); + }); + } + + public override Project GetWhere(Expression<Func<Project, bool>> whereClause) + { + return DatabaseConnection.ConnectToDatabase((db) => + { + return + (from tableEntry in GetITableFromDatabase(db).AsExpandable() + where whereClause.Invoke(tableEntry) + && tableEntry.Deleted == false + select tableEntry).First(); + }); + } + + public override IEnumerable<Project> GetAll() + { + return DatabaseConnection.ConnectToDatabase((db) => + { + return + (from tableEntry in GetITableFromDatabase(db) + where tableEntry.Deleted == false + select tableEntry).ToList(); + }); + } + + public override IEnumerable<Project> GetAllWhere(Expression<Func<Project, bool>> whereClause) + { + return DatabaseConnection.ConnectToDatabase((db) => + { + return + (from tableEntry in GetITableFromDatabase(db).AsExpandable() + where whereClause.Invoke(tableEntry) + && tableEntry.Deleted == false + select tableEntry).ToList(); + }); + } + + public override int Update(Project databaseObject) + { + if (databaseObject.Deleted != false) + { + return DatabaseConnection.ConnectToDatabase((db) => + { + return db.Update(databaseObject); + }); + } + else + { + return 0; + } + } + + public override int Delete(Project databaseObject) + { + databaseObject.Deleted = true; + return DatabaseConnection.ConnectToDatabase((db) => + { + return db.Update(databaseObject); + }); + } + + public int HardDelete(Project databaseObject) + { + return DatabaseConnection.ConnectToDatabase((db) => + { + return db.Delete(databaseObject); + }); + } + + public Project StoreFromObject(ProjectObject projectObject, User user) + { + if (projectObject.Disciplines.Count() == 0 || projectObject.Institutes.Count() == 0) + { + throw new ArgumentException("Discipline and Institute are necessary!"); + } + + Project project = new Project() + { + Description = projectObject.Description, + DisplayName = projectObject.DisplayName, + StartDate = projectObject.StartDate, + EndDate = projectObject.EndDate, + Keywords = projectObject.Keywords, + + ProjectName = projectObject.ProjectName, + PrincipleInvestigators = projectObject.PrincipleInvestigators, + GrantId = projectObject.GrantId, + + VisibilityId = projectObject.Visibility.Id, + }; + Insert(project); + try + { + SetDisciplines(project, projectObject.Disciplines); + SetInstitutes(project, projectObject.Institutes); + } + catch (Exception e) + { + HardDelete(project); + throw e; + } + SetOwner(project, user); + return project; + } + + private void SetDisciplines(Project project, IEnumerable<DisciplineObject> disciplines) + { + ProjectDisciplineModel projectDisciplineModel = new ProjectDisciplineModel(); + foreach (var oldDiscipline in projectDisciplineModel.GetAllWhere((projectDiscipline) => projectDiscipline.ProjectId == project.Id)) + { + projectDisciplineModel.Delete(oldDiscipline); + } + foreach (var discipline in disciplines) + { + projectDisciplineModel.Insert(new ProjectDiscipline() + { + ProjectId = project.Id, + DisciplineId = discipline.Id + }); + } + } + + private void SetInstitutes(Project project, IEnumerable<InstituteObject> institutes) + { + ProjectInstituteModel projectInstituteModel = new ProjectInstituteModel(); + foreach (var oldInstitute in projectInstituteModel.GetAllWhere((projectInstitute) => projectInstitute.ProjectId == project.Id)) + { + projectInstituteModel.Delete(oldInstitute); + } + foreach (var institute in institutes) + { + projectInstituteModel.Insert(new ProjectInstitute() + { + ProjectId = project.Id, + InstituteId = institute.Id + }); + } + } + + public ProjectRole SetOwner(Project project, User user) + { + ProjectRoleModel projectRoleModel = new ProjectRoleModel(); + + ProjectRole projectRole = new ProjectRole() + { + RelationId = Guid.NewGuid(), + ProjectId = project.Id, + UserId = user.Id, + RoleId = new RoleModel().GetWhere((x) => x.DisplayName == "Owner").Id + }; + projectRoleModel.Insert(projectRole); + + return projectRole; + } + + public bool HasAccess(User user, Guid projectId, params string[] allowedAccess) + { + return HasAccess(user, GetById(projectId), allowedAccess); + } + + public bool HasAccess(User user, Project project, params string[] allowedAccess) + { + ProjectRoleModel projectRoleModel = new ProjectRoleModel(); + allowedAccess = allowedAccess.Select(x => x.ToLower().Trim()).ToArray(); + + IEnumerable<ProjectRole> projectRoles = projectRoleModel.GetAllWhere( + (projectRoleRelation) => projectRoleRelation.ProjectId == project.Id && + projectRoleRelation.UserId == user.Id && + allowedAccess.Contains(projectRoleRelation.Role.DisplayName.ToLower())); + return projectRoles.Count() > 0; + } + + public IEnumerable<Project> GetWithAccess(User user, params string[] allowedAccess) + { + ProjectRoleModel projectRoleModel = new ProjectRoleModel(); + ProjectModel projectModel = new ProjectModel(); + + allowedAccess = allowedAccess.Select(x => x.ToLower().Trim()).ToArray(); + var allUserProjectRoles = projectRoleModel.GetAllWhere((projectRoleRelation) => projectRoleRelation.UserId == user.Id && + allowedAccess.Contains(projectRoleRelation.Role.DisplayName.ToLower())); + var allowedProjectIds = allUserProjectRoles.Select((projectRole) => projectRole.ProjectId); + var allowedProjects = projectModel.GetAllWhere((project) => allowedProjectIds.Contains(project.Id) + && ((!project.SubProjectsSubProjectIdIds.Any()) // get top level projects not having any parent projects + || !(from subProject in project.SubProjectsSubProjectIdIds // check if the direct parent project is accessible to the current user + where (from parentProjectRole in subProject.Project.ProjectRolesProjectIdIds + where parentProjectRole.UserId == user.Id + && allowedAccess.Contains(parentProjectRole.Role.DisplayName.ToLower()) + select parentProjectRole).Any() + select subProject).Any()) + ); + + return allowedProjects.ToList(); + } + + public void AddResource(Project project, Resource resource) + { + ProjectResourceModel projectResourceModel = new ProjectResourceModel(); + if (projectResourceModel.GetAllWhere((projectResource) => projectResource.ResourceId == resource.Id && projectResource.ProjectId == project.Id).Any()) + { + throw new InvalidOperationException("Resource is already assigned to project!"); + } + ProjectResource newProjectResource = new ProjectResource + { + ProjectId = project.Id, + ResourceId = resource.Id + }; + projectResourceModel.Insert(newProjectResource); + } + + public int UpdateByObject(Project project, ProjectObject projectObject) + { + if (projectObject.Disciplines.Count() == 0 || projectObject.Institutes.Count() == 0) + { + throw new ArgumentException("Discipline and Institute are necessary!"); + } + + project.Description = projectObject.Description; + project.DisplayName = projectObject.DisplayName; + project.StartDate = projectObject.StartDate; + project.EndDate = projectObject.EndDate; + project.Keywords = projectObject.Keywords; + + project.ProjectName = projectObject.ProjectName; + project.PrincipleInvestigators = projectObject.PrincipleInvestigators; + project.GrantId = projectObject.GrantId; + + SetDisciplines(project, projectObject.Disciplines); + SetInstitutes(project, projectObject.Institutes); + project.VisibilityId = projectObject.Visibility.Id; + + return Update(project); + } + + public ProjectObject CreateReturnObjectFromDatabaseObject(Project project) + { + return CreateReturnObjectFromDatabaseObject(project, new Guid()); + } + + public ProjectObject CreateReturnObjectFromDatabaseObject(Project project, Guid parentId) + { + IEnumerable<DisciplineObject> disciplines = new List<DisciplineObject>(); + if (project.ProjectDisciplineProjectIdIds == null) + { + DisciplineModel disciplineModel = new DisciplineModel(); + disciplines = disciplineModel.GetAllWhere((discipline) => (from relation in discipline.ProjectDisciplineDisciplineIdIds where relation.ProjectId == project.Id select relation).Any()) + .Select((discipline) => new DisciplineObject(discipline.Id, discipline.Url, discipline.DisplayNameDe, discipline.DisplayNameEn)); + } + else + { + disciplines = project.ProjectDisciplineProjectIdIds.Select((discipline) => new DisciplineObject(discipline.Discipline.Id, discipline.Discipline.Url, discipline.Discipline.DisplayNameDe, discipline.Discipline.DisplayNameEn)); + } + IEnumerable<InstituteObject> institutes = new List<InstituteObject>(); + if (project.ProjectInstituteProjectIdIds == null) + { + InstituteModel instituteModel = new InstituteModel(); + institutes = instituteModel.GetAllWhere((institute) => (from relation in institute.ProjectInstituteInstituteIdIds where relation.ProjectId == project.Id select relation).Any()) + .Select((institute) => new InstituteObject(institute.Id, institute.IKZ, institute.DisplayName)); + } + else + { + institutes = project.ProjectInstituteProjectIdIds.Select((institute) => new InstituteObject(institute.Institute.Id, institute.Institute.IKZ, institute.Institute.DisplayName)); + } + if (project.Visibility == null && project.VisibilityId.HasValue) + { + VisibilityModel visibilityModel = new VisibilityModel(); + project.Visibility = visibilityModel.GetById(project.VisibilityId.Value); + } + + return new ProjectObject(project.Id, project.Description, project.DisplayName, project.StartDate, project.EndDate, project.Keywords, + project.ProjectName, project.PrincipleInvestigators, project.GrantId, + disciplines, + institutes, + project.Visibility == null ? null : new VisibilityObject(project.Visibility.Id, project.Visibility.DisplayName), + parentId); + } + + public List<Project> ListToRootProject(Project project, User user) + { + List<Project> projectList = new List<Project> + { + project + }; + + ProjectRoleModel projectRoleModel = new ProjectRoleModel(); + + var currentProject = project; + IEnumerable<Project> list; + bool continueLoop = true; + do + { + list = GetAllWhere((dbProject) => (from subProject in dbProject.SubProjectsProjectIdIds + where subProject.SubProjectId == currentProject.Id + && subProject.Project.Deleted == false + select subProject).Any()); + + if (list.Count() > 0) + { + currentProject = list.First(); + bool authorized = true; + if (user != null) + { + authorized = projectRoleModel.GetAllWhere((dbProjectRole) => + dbProjectRole.UserId == user.Id + && dbProjectRole.ProjectId == currentProject.Id).Any(); + } + if (projectList.Contains(currentProject) || !authorized) + { + continueLoop = false; + } + else + { + projectList.Add(currentProject); + } + } + else + { + continueLoop = false; + } + } while (continueLoop); + + return projectList; + } + + + public override Expression<Func<Project, Guid>> GetIdFromObject() + { + return databaseObject => databaseObject.Id; + } + + public override ITable<Project> GetITableFromDatabase(CoscineDB db) + { + return db.Projects; + } + + public override void SetObjectId(Project databaseObject, Guid id) + { + databaseObject.Id = id; + } + + } +} diff --git a/src/Database/Models/ProjectResourceModel.cs b/src/Database/Models/ProjectResourceModel.cs new file mode 100644 index 0000000..610b7fc --- /dev/null +++ b/src/Database/Models/ProjectResourceModel.cs @@ -0,0 +1,25 @@ +using System; +using System.Linq.Expressions; +using Coscine.Database.DataModel; +using LinqToDB; + +namespace Coscine.Database.Models +{ + public class ProjectResourceModel : DatabaseModel<ProjectResource> + { + public override Expression<Func<ProjectResource, Guid>> GetIdFromObject() + { + return (projectResource) => projectResource.RelationId; + } + + public override ITable<ProjectResource> GetITableFromDatabase(CoscineDB db) + { + return db.ProjectResources; + } + + public override void SetObjectId(ProjectResource databaseObject, Guid id) + { + databaseObject.RelationId = id; + } + } +} \ No newline at end of file diff --git a/src/Database/Models/ProjectRoleModel.cs b/src/Database/Models/ProjectRoleModel.cs new file mode 100644 index 0000000..0b353ac --- /dev/null +++ b/src/Database/Models/ProjectRoleModel.cs @@ -0,0 +1,68 @@ +using Coscine.Database.ReturnObjects; +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq; +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); + + if (existingRoles.Count() > 0) + { + foreach(var role in existingRoles) + { + CheckIfLastOwnerWillBeRemoved(role.RoleId, projectRoleObject.ProjectId); + Delete(role); + } + } + ProjectRole projectRole = new ProjectRole() + { + ProjectId = projectRoleObject.ProjectId, + UserId = projectRoleObject.User.Id, + RoleId = projectRoleObject.Role.Id + }; + Insert(projectRole); + return projectRole; + } + + public void CheckIfLastOwnerWillBeRemoved(Guid roleId, Guid projectId) + { + RoleModel roleModel = new RoleModel(); + var ownerRole = roleModel.GetOwnerRole(); + + if (roleId == ownerRole.Id) + { + var moreThanOneOwnerExists = GetAllWhere((projectRole) => + projectRole.ProjectId == projectId + && projectRole.RoleId == ownerRole.Id + ).Count() > 1; + if (!moreThanOneOwnerExists) + { + throw new Exception("The last owner cannot be removed!"); + } + } + } + + public override Expression<Func<ProjectRole, Guid>> GetIdFromObject() + { + return databaseObject => databaseObject.RelationId; + } + + public override ITable<ProjectRole> GetITableFromDatabase(CoscineDB db) + { + return db.ProjectRoles; + } + + public override void SetObjectId(ProjectRole databaseObject, Guid id) + { + databaseObject.RelationId = id; + } + } +} diff --git a/src/Database/Models/RDSResourceTypeModel.cs b/src/Database/Models/RDSResourceTypeModel.cs new file mode 100644 index 0000000..b9b5e0f --- /dev/null +++ b/src/Database/Models/RDSResourceTypeModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class RDSResourceTypeModel : DatabaseModel<RDSResourceType> + { + public override Expression<Func<RDSResourceType, Guid>> GetIdFromObject() + { + return (rdsResourceType) => rdsResourceType.Id; + } + + public override ITable<RDSResourceType> GetITableFromDatabase(CoscineDB db) + { + return db.RDSResourceTypes; + } + + public override void SetObjectId(RDSResourceType databaseObject, Guid id) + { + databaseObject.Id = id; + } + } +} diff --git a/src/Database/Models/ResourceDisciplineModel.cs b/src/Database/Models/ResourceDisciplineModel.cs new file mode 100644 index 0000000..c31c45b --- /dev/null +++ b/src/Database/Models/ResourceDisciplineModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class ResourceDisciplineModel : DatabaseModel<ResourceDiscipline> + { + public override Expression<Func<ResourceDiscipline, Guid>> GetIdFromObject() + { + return (resourceDiscipline) => resourceDiscipline.RelationId; + } + + public override ITable<ResourceDiscipline> GetITableFromDatabase(CoscineDB db) + { + return db.ResourceDisciplines; + } + + public override void SetObjectId(ResourceDiscipline databaseObject, Guid id) + { + databaseObject.RelationId = id; + } + } +} diff --git a/src/Database/Models/ResourceModel.cs b/src/Database/Models/ResourceModel.cs new file mode 100644 index 0000000..819351a --- /dev/null +++ b/src/Database/Models/ResourceModel.cs @@ -0,0 +1,346 @@ +using Coscine.Database.ReturnObjects; +using Coscine.Configuration; +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using Newtonsoft.Json.Linq; +using Coscine.Database.Util; + +namespace Coscine.Database.Models +{ + public class ResourceModel : DatabaseModel<Resource> + { + private readonly IConfiguration _configuration = new ConsulConfiguration(); + + public Resource StoreFromObject(ResourceObject resourceObject) + { + if (resourceObject.Disciplines.Count() == 0 || resourceObject.ResourceTypeOption == null) + { + throw new ArgumentException("Discipline and ResourceTypeOption are necessary!"); + } + + Resource resource = new Resource() + { + DisplayName = resourceObject.DisplayName, + ResourceName = resourceObject.ResourceName, + Description = resourceObject.Description, + Keywords = resourceObject.Keywords, + UsageRights = resourceObject.UsageRights, + TypeId = resourceObject.Type.Id, + Type = new ResourceTypeModel().GetById(resourceObject.Type.Id), + VisibilityId = resourceObject.Visibility.Id, + ApplicationProfile = resourceObject.ApplicationProfile, + FixedValues = resourceObject.FixedValues != null ? resourceObject.FixedValues.ToString() :"{}", + Creator = resourceObject.Creator + }; + if(resourceObject.License != null) + { + resource.LicenseId = resourceObject.License.Id; + } + Insert(resource); + + try + { + SetDisciplines(resource, resourceObject.Disciplines); + SetResourceTypeObject(resource, resourceObject.ResourceTypeOption); + } + catch (Exception e) + { + Delete(resource); + throw e; + } + + return resource; + } + + public int DeleteResource(Resource resource) + { + ProjectResourceModel projectResourceModel = new ProjectResourceModel(); + foreach (var projectResource in projectResourceModel.GetAllWhere((projectResource) => projectResource.ResourceId == resource.Id)) + { + projectResourceModel.Delete(projectResource); + } + + ResourceDisciplineModel resourceDisciplineModel = new ResourceDisciplineModel(); + foreach (var resourceDiscipline in resourceDisciplineModel.GetAllWhere((resourceDicipline) => resourceDicipline.ResourceId == resource.Id)) + { + resourceDisciplineModel.Delete(resourceDiscipline); + } + + DeleteResourceTypeObject(resource); + + return Delete(resource); + } + + private void SetResourceTypeObject(Resource resource, JObject resourceTypeOption) + { + if (resource.Type.DisplayName == "rds") + { + RDSResourceTypeObject rdsResourceTypeObject = resourceTypeOption.ToObject<RDSResourceTypeObject>(); + RDSResourceTypeModel rdsResourceTypeModel = new RDSResourceTypeModel(); + if (resource.ResourceTypeOptionId != null) + { + RDSResourceType rdsResourceType = rdsResourceTypeModel.GetById(resource.ResourceTypeOptionId.Value); + rdsResourceTypeModel.Update(rdsResourceType); + } + else + { + RDSResourceType rdsResourceType = new RDSResourceType() + { + BucketName = GetRDSBucketName(), + Size = rdsResourceTypeObject.Size, + }; + rdsResourceTypeModel.Insert(rdsResourceType); + resource.ResourceTypeOptionId = rdsResourceType.Id; + Update(resource); + } + } + else if (resource.Type.DisplayName == "s3") + { + S3ResourceTypeObject s3ResourceTypeObject = resourceTypeOption.ToObject<S3ResourceTypeObject>(); + S3ResourceTypeModel s3ResourceTypeModel = new S3ResourceTypeModel(); + if (resource.ResourceTypeOptionId != null) + { + S3ResourceType s3ResourceType = s3ResourceTypeModel.GetById(resource.ResourceTypeOptionId.Value); + + s3ResourceType.BucketName = s3ResourceTypeObject.BucketName; + s3ResourceType.AccessKey = s3ResourceTypeObject.AccessKey ?? s3ResourceType.AccessKey; + s3ResourceType.SecretKey = s3ResourceTypeObject.SecretKey ?? s3ResourceType.SecretKey; + + s3ResourceTypeModel.Update(s3ResourceType); + } + else + { + S3ResourceType s3ResourceType = new S3ResourceType() + { + BucketName = s3ResourceTypeObject.BucketName, + AccessKey = s3ResourceTypeObject.AccessKey, + SecretKey = s3ResourceTypeObject.SecretKey + }; + s3ResourceTypeModel.Insert(s3ResourceType); + resource.ResourceTypeOptionId = s3ResourceType.Id; + Update(resource); + } + } + else if (resource.Type.DisplayName == "gitlab") + { + GitlabResourceTypeObject gitlabResourceTypeObject = resourceTypeOption.ToObject<GitlabResourceTypeObject>(); + GitlabResourceTypeModel gitlabResourceTypeModel = new GitlabResourceTypeModel(); + if (resource.ResourceTypeOptionId != null) + { + GitlabResourceType gitlabResourceType = gitlabResourceTypeModel.GetById(resource.ResourceTypeOptionId.Value); + + gitlabResourceType.RepositoryNumber = gitlabResourceTypeObject.RepositoryNumber; + gitlabResourceType.RepositoryUrl = gitlabResourceTypeObject.RepositoryUrl; + gitlabResourceType.Token = gitlabResourceTypeObject.Token ?? gitlabResourceType.Token; + + gitlabResourceTypeModel.Update(gitlabResourceType); + } + else + { + GitlabResourceType gitlabResourceType = new GitlabResourceType() + { + RepositoryNumber = gitlabResourceTypeObject.RepositoryNumber, + RepositoryUrl = gitlabResourceTypeObject.RepositoryUrl, + Token = gitlabResourceTypeObject.Token + }; + gitlabResourceTypeModel.Insert(gitlabResourceType); + resource.ResourceTypeOptionId = gitlabResourceType.Id; + Update(resource); + } + } + else + { + throw new ArgumentException("Not supported resource type!"); + } + } + + private string GetRDSBucketName() + { + var prefix = _configuration.GetStringAndWait("coscine/global/buckets/prefix"); + var number = Int32.Parse(_configuration.GetStringAndWait("coscine/global/buckets/currentid")); + var maxNumber = Int32.Parse(_configuration.GetStringAndWait("coscine/global/buckets/highestid")); + var newNumber = number % maxNumber == 0 ? 1 : number + 1; + _configuration.Put("coscine/global/buckets/currentid", "" + newNumber); + + return String.Format("{0}{1,3:000}", prefix, number); + } + + private void SetDisciplines(Resource resource, IEnumerable<DisciplineObject> disciplines) + { + ResourceDisciplineModel resourceDisciplineModel = new ResourceDisciplineModel(); + foreach (var oldDiscipline in resourceDisciplineModel.GetAllWhere((resourceDiscipline) => resourceDiscipline.ResourceId == resource.Id)) + { + resourceDisciplineModel.Delete(oldDiscipline); + } + foreach (var discipline in disciplines) + { + ResourceDiscipline resourceDiscipline = new ResourceDiscipline() + { + DisciplineId = discipline.Id, + ResourceId = resource.Id + }; + resourceDisciplineModel.Insert(resourceDiscipline); + } + } + + public bool HasAccess(User user, Resource resource, params string[] allowedAccess) + { + IEnumerable<string> allowedAccessLabels = allowedAccess.Select(x => x.ToLower().Trim()).ToList(); + return DatabaseConnection.ConnectToDatabase((db) => (from relation in db.ProjectRoles + where relation.Project.ProjectResourceProjectIdIds != null && relation.Project.ProjectResourceProjectIdIds + .Any((projectResource) => projectResource.Resource.Id == resource.Id) + && relation.User.Id == user.Id + && allowedAccessLabels.Contains(relation.Role.DisplayName.ToLower()) + select relation).Any()); + } + + public int UpdateByObject(Resource resource, ResourceObject resourceObject) + { + if (resourceObject.Disciplines.Count() == 0 || resourceObject.ResourceTypeOption == null) + { + throw new ArgumentException("Discipline and ResourceTypeOption are necessary!"); + } + + if (resource.TypeId != resourceObject.Type.Id) + { + DeleteResourceTypeObject(resource); + } + + resource.DisplayName = resourceObject.DisplayName; + resource.ResourceName = resourceObject.ResourceName; + resource.Description = resourceObject.Description; + resource.Keywords = resourceObject.Keywords; + resource.UsageRights = resourceObject.UsageRights; + resource.TypeId = resourceObject.Type.Id; + resource.Type = new ResourceTypeModel().GetById(resourceObject.Type.Id); + resource.VisibilityId = resourceObject.Visibility.Id; + if(resourceObject.License != null) + { + resource.LicenseId = resourceObject.License.Id; + } + + // the application profile can not be altered after creation + // resource.ApplicationProfile = resourceObject.ApplicationProfile; + + resource.FixedValues = resourceObject.FixedValues != null ? resourceObject.FixedValues.ToString() : "{}"; + + // the resource creator can not be altered after creation + // resource.Creator = resourceObject.Creator; + + SetDisciplines(resource, resourceObject.Disciplines); + SetResourceTypeObject(resource, resourceObject.ResourceTypeOption); + + return Update(resource); + } + + // TODO: Find out why resource.Type is not set + public void SetType(Resource resource) + { + if (resource.Type == null) + { + ResourceTypeModel resourceTypeModel = new ResourceTypeModel(); + resource.Type = resourceTypeModel.GetById(resource.TypeId); + } + } + + public void DeleteResourceTypeObject(Resource resource) + { + SetType(resource); + if (resource.Type.DisplayName == "rds" && resource.ResourceTypeOptionId != null) + { + RDSResourceTypeModel rdsResourceTypeModel = new RDSResourceTypeModel(); + rdsResourceTypeModel.Delete(rdsResourceTypeModel.GetById(resource.ResourceTypeOptionId.Value)); + } + else if (resource.Type.DisplayName == "s3" && resource.ResourceTypeOptionId != null) + { + S3ResourceTypeModel s3ResourceTypeModel = new S3ResourceTypeModel(); + s3ResourceTypeModel.Delete(s3ResourceTypeModel.GetById(resource.ResourceTypeOptionId.Value)); + } + else if (resource.Type.DisplayName == "gitlab" && resource.ResourceTypeOptionId != null) + { + GitlabResourceTypeModel gitlabResourceTypeModel = new GitlabResourceTypeModel(); + gitlabResourceTypeModel.Delete(gitlabResourceTypeModel.GetById(resource.ResourceTypeOptionId.Value)); + } + } + + public ResourceObject CreateReturnObjectFromDatabaseObject(Resource resource) + { + SetType(resource); + + DisciplineModel disciplineModel = new DisciplineModel(); + var disciplines = disciplineModel.GetAllWhere((discipline) => + (from relation in discipline.ResourceDisciplineDisciplineIdIds + where relation.ResourceId == resource.Id + select relation).Any()) + .Select((discipline) => new DisciplineObject(discipline.Id, discipline.Url, discipline.DisplayNameDe, discipline.DisplayNameEn)); + + if (resource.Visibility == null && resource.VisibilityId != null) + { + VisibilityModel visibilityModel = new VisibilityModel(); + resource.Visibility = visibilityModel.GetById(resource.VisibilityId.Value); + } + + if (resource.License == null && resource.LicenseId != null) + { + LicenseModel licenseModel = new LicenseModel(); + resource.License = licenseModel.GetById(resource.LicenseId.Value); + } + + ResourceTypeOptionObject resourceTypeOptionObject = null; + if(resource.Type.DisplayName == "rds" && resource.ResourceTypeOptionId != null) + { + RDSResourceTypeModel rdsResourceTypeModel = new RDSResourceTypeModel(); + var rdsResourceType = rdsResourceTypeModel.GetById(resource.ResourceTypeOptionId.Value); + resourceTypeOptionObject = new RDSResourceTypeObject(rdsResourceType.Id, rdsResourceType.BucketName, (int)rdsResourceType.Size); + } + else if (resource.Type.DisplayName == "s3" && resource.ResourceTypeOptionId != null) + { + S3ResourceTypeModel s3ResourceTypeModel = new S3ResourceTypeModel(); + var s3ResourceType = s3ResourceTypeModel.GetById(resource.ResourceTypeOptionId.Value); + resourceTypeOptionObject = new S3ResourceTypeObject(s3ResourceType.Id, s3ResourceType.BucketName, null, null); + } + else if(resource.Type.DisplayName == "gitlab" && resource.ResourceTypeOptionId != null) + { + GitlabResourceTypeModel gitlabResourceTypeModel = new GitlabResourceTypeModel(); + var gitlabResourceType = gitlabResourceTypeModel.GetById(resource.ResourceTypeOptionId.Value); + resourceTypeOptionObject = new GitlabResourceTypeObject(gitlabResourceType.Id, gitlabResourceType.RepositoryNumber, gitlabResourceType.RepositoryUrl, null); + } + + return new ResourceObject( + resource.Id, + resource.DisplayName, + resource.ResourceName, + resource.Description, + resource.Keywords, + resource.UsageRights, + new ResourceTypeObject(resource.Type.Id, resource.Type.DisplayName, resource.Type.Enabled), + disciplines, + (resource.Visibility != null) ? new VisibilityObject(resource.Visibility.Id, resource.Visibility.DisplayName) : null, + (resource.License != null) ? new LicenseObject(resource.License.Id, resource.License.DisplayName) : null, + JObject.FromObject(resourceTypeOptionObject), + resource.ApplicationProfile, + JToken.Parse(resource.FixedValues == null ? "{}": resource.FixedValues ), + (resource.Creator != null) ? resource.Creator : null + ); + } + + public override Expression<Func<Resource, Guid>> GetIdFromObject() + { + return databaseObject => databaseObject.Id; + } + + public override ITable<Resource> GetITableFromDatabase(CoscineDB db) + { + return db.Resources; + } + + public override void SetObjectId(Resource databaseObject, Guid id) + { + databaseObject.Id = id; + } + } +} diff --git a/src/Database/Models/ResourceTypeModel.cs b/src/Database/Models/ResourceTypeModel.cs new file mode 100644 index 0000000..87149e6 --- /dev/null +++ b/src/Database/Models/ResourceTypeModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class ResourceTypeModel : DatabaseModel<ResourceType> + { + public override Expression<Func<ResourceType, Guid>> GetIdFromObject() + { + return databaseObject => databaseObject.Id; + } + + public override ITable<ResourceType> GetITableFromDatabase(CoscineDB db) + { + return db.ResourceTypes; + } + + public override void SetObjectId(ResourceType databaseObject, Guid id) + { + databaseObject.Id = id; + } + } +} diff --git a/src/Database/Models/RoleModel.cs b/src/Database/Models/RoleModel.cs new file mode 100644 index 0000000..365c187 --- /dev/null +++ b/src/Database/Models/RoleModel.cs @@ -0,0 +1,35 @@ +using Coscine.Database.DataModel; +using Coscine.Database.Util; +using LinqToDB; +using System; +using System.Linq; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class RoleModel : DatabaseModel<Role> + { + public override Expression<Func<Role, Guid>> GetIdFromObject() + { + return databaseObject => databaseObject.Id; + } + + public override ITable<Role> GetITableFromDatabase(CoscineDB db) + { + return db.Roles; + } + + public override void SetObjectId(Role databaseObject, Guid id) + { + databaseObject.Id = id; + } + + public Role GetOwnerRole() + { + return DatabaseConnection.ConnectToDatabase((db) => + (from tableEntry in GetITableFromDatabase(db) + where tableEntry.DisplayName == "Owner" + select tableEntry).First()); + } + } +} diff --git a/src/Database/Models/S3ResourceTypeModel.cs b/src/Database/Models/S3ResourceTypeModel.cs new file mode 100644 index 0000000..1cc4fdc --- /dev/null +++ b/src/Database/Models/S3ResourceTypeModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class S3ResourceTypeModel : DatabaseModel<S3ResourceType> + { + public override Expression<Func<S3ResourceType, Guid>> GetIdFromObject() + { + return (rdsResourceType) => rdsResourceType.Id; + } + + public override ITable<S3ResourceType> GetITableFromDatabase(CoscineDB db) + { + return db.S3ResourceTypes; + } + + public override void SetObjectId(S3ResourceType databaseObject, Guid id) + { + databaseObject.Id = id; + } + } +} diff --git a/src/Database/Models/SubProjectModel.cs b/src/Database/Models/SubProjectModel.cs new file mode 100644 index 0000000..abba95f --- /dev/null +++ b/src/Database/Models/SubProjectModel.cs @@ -0,0 +1,34 @@ +using System; +using System.Linq.Expressions; +using Coscine.Database.DataModel; +using LinqToDB; + +namespace Coscine.Database.Models +{ + public class SubProjectModel : DatabaseModel<SubProject> + { + public override Expression<Func<SubProject, Guid>> GetIdFromObject() + { + return databaseObject => databaseObject.RelationId; + } + + public override ITable<SubProject> GetITableFromDatabase(CoscineDB db) + { + return db.SubProjects; + } + + public void LinkSubProject(Guid parentId, Guid childId) + { + Insert(new SubProject() + { + ProjectId = parentId, + SubProjectId = childId, + }); + } + + public override void SetObjectId(SubProject databaseObject, Guid id) + { + databaseObject.RelationId = id; + } + } +} diff --git a/src/Database/Models/UserModel.cs b/src/Database/Models/UserModel.cs new file mode 100644 index 0000000..7d5e516 --- /dev/null +++ b/src/Database/Models/UserModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class UserModel : DatabaseModel<User> + { + public override Expression<Func<User, Guid>> GetIdFromObject() + { + return databaseObject => databaseObject.Id; + } + + public override ITable<User> GetITableFromDatabase(CoscineDB db) + { + return db.Users; + } + + public override void SetObjectId(User databaseObject, Guid Id) + { + databaseObject.Id = Id; + } + } +} diff --git a/src/Database/Models/VisibilityModel.cs b/src/Database/Models/VisibilityModel.cs new file mode 100644 index 0000000..c3f0db9 --- /dev/null +++ b/src/Database/Models/VisibilityModel.cs @@ -0,0 +1,25 @@ +using Coscine.Database.DataModel; +using LinqToDB; +using System; +using System.Linq.Expressions; + +namespace Coscine.Database.Models +{ + public class VisibilityModel : DatabaseModel<Visibility> + { + public override Expression<Func<Visibility, Guid>> GetIdFromObject() + { + return (visibility) => visibility.Id; + } + + public override ITable<Visibility> GetITableFromDatabase(CoscineDB db) + { + return db.Visibilities; + } + + public override void SetObjectId(Visibility databaseObject, Guid id) + { + databaseObject.Id = id; + } + } +} diff --git a/src/Database/Properties/AssemblyInfo.cs b/src/Database/Properties/AssemblyInfo.cs index fdfec9f..b24475a 100644 --- a/src/Database/Properties/AssemblyInfo.cs +++ b/src/Database/Properties/AssemblyInfo.cs @@ -9,8 +9,8 @@ using System.Reflection; [assembly: AssemblyDescription("Database is a part of the CoScInE group.")] [assembly: AssemblyCompany("IT Center, RWTH Aachen University")] [assembly: AssemblyProduct("Database")] -[assembly: AssemblyVersion("1.15.0")] -[assembly: AssemblyFileVersion("1.15.0")] -[assembly: AssemblyInformationalVersion("1.15.0-topic-632-projec0003")] +[assembly: AssemblyVersion("1.16.0")] +[assembly: AssemblyFileVersion("1.16.0")] +[assembly: AssemblyInformationalVersion("1.16.0-topic-670-apiref0017")] [assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")] diff --git a/src/Database/ReturnObjects/DisciplineObject.cs b/src/Database/ReturnObjects/DisciplineObject.cs new file mode 100644 index 0000000..8dacadd --- /dev/null +++ b/src/Database/ReturnObjects/DisciplineObject.cs @@ -0,0 +1,22 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + public class DisciplineObject : IReturnObject + { + public Guid Id { get; set; } + + public string Url { get; set; } + public string DisplayNameDe { get; set; } + + public string DisplayNameEn { get; set; } + + public DisciplineObject(Guid id, string url, string displayNameDe, string displayNameEn) + { + Id = id; + Url = url; + DisplayNameDe = displayNameDe; + DisplayNameEn = displayNameEn; + } + } +} diff --git a/src/Database/ReturnObjects/GitlabResourceTypeObject.cs b/src/Database/ReturnObjects/GitlabResourceTypeObject.cs new file mode 100644 index 0000000..8412423 --- /dev/null +++ b/src/Database/ReturnObjects/GitlabResourceTypeObject.cs @@ -0,0 +1,22 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + [Serializable] + public class GitlabResourceTypeObject : ResourceTypeOptionObject + { + public Guid Id { get; set; } + + public int RepositoryNumber { get; set; } + public string RepositoryUrl { get; set; } + public string Token { get; set; } + + public GitlabResourceTypeObject(Guid id, int repositoryNumber, string repositoryUrl, string token) + { + Id = id; + RepositoryNumber = repositoryNumber; + RepositoryUrl = repositoryUrl; + Token = token; + } + } +} diff --git a/src/Database/ReturnObjects/IReturnObject.cs b/src/Database/ReturnObjects/IReturnObject.cs new file mode 100644 index 0000000..6d6b69b --- /dev/null +++ b/src/Database/ReturnObjects/IReturnObject.cs @@ -0,0 +1,6 @@ +namespace Coscine.Database.ReturnObjects +{ + public interface IReturnObject + { + } +} diff --git a/src/Database/ReturnObjects/InstituteObject.cs b/src/Database/ReturnObjects/InstituteObject.cs new file mode 100644 index 0000000..4ca6e87 --- /dev/null +++ b/src/Database/ReturnObjects/InstituteObject.cs @@ -0,0 +1,19 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + public class InstituteObject : IReturnObject + { + public Guid Id { get; set; } + + public string Ikz { get; set; } + public string DisplayName { get; set; } + + public InstituteObject(Guid id, string ikz, string displayName) + { + Id = id; + Ikz = ikz; + DisplayName = displayName; + } + } +} diff --git a/src/Database/ReturnObjects/LicenseObject.cs b/src/Database/ReturnObjects/LicenseObject.cs new file mode 100644 index 0000000..b6d0020 --- /dev/null +++ b/src/Database/ReturnObjects/LicenseObject.cs @@ -0,0 +1,18 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + [Serializable] + public class LicenseObject : IReturnObject + { + public Guid Id { get; set; } + + public string DisplayName { get; set; } + + public LicenseObject(Guid id, string displayName) + { + Id = id; + DisplayName = displayName; + } + } +} \ No newline at end of file diff --git a/src/Database/ReturnObjects/ProjectObject.cs b/src/Database/ReturnObjects/ProjectObject.cs new file mode 100644 index 0000000..469f53e --- /dev/null +++ b/src/Database/ReturnObjects/ProjectObject.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; + +namespace Coscine.Database.ReturnObjects +{ + + [Serializable] + public class ProjectObject : IReturnObject + { + public Guid Id { get; set; } + + public string Description { get; set; } + public string DisplayName { get; set; } + public DateTime StartDate { get; set; } + public DateTime EndDate { get; set; } + public string Keywords { get; set; } + + public string ProjectName { get; set; } + public string PrincipleInvestigators { get; set; } + public string GrantId { get; set; } + + public IEnumerable<DisciplineObject> Disciplines { get; set; } + public IEnumerable<InstituteObject> Institutes { get; set; } + public VisibilityObject Visibility { get; set; } + + public Guid ParentId { get; set; } + + public ProjectObject(Guid id, string description, string displayName, DateTime startDate, DateTime endDate, string keywords, string projectName, string principleInvestigators, string grantId, IEnumerable<DisciplineObject> discipline, IEnumerable<InstituteObject> institute, VisibilityObject visibility, Guid parentId = new Guid()) + { + Id = id; + Description = description; + DisplayName = displayName; + StartDate = startDate; + EndDate = endDate; + Keywords = keywords; + ParentId = parentId; + + ProjectName = projectName; + PrincipleInvestigators = principleInvestigators; + GrantId = grantId; + + Disciplines = discipline; + Institutes = institute; + Visibility = visibility; + } + } +} diff --git a/src/Database/ReturnObjects/ProjectRoleObject.cs b/src/Database/ReturnObjects/ProjectRoleObject.cs new file mode 100644 index 0000000..3b465ce --- /dev/null +++ b/src/Database/ReturnObjects/ProjectRoleObject.cs @@ -0,0 +1,20 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + [Serializable] + public class ProjectRoleObject : IReturnObject + { + public Guid ProjectId { get; set; } + public UserObject User { get; set; } + public RoleObject Role { get; set; } + + public ProjectRoleObject(Guid projectId, UserObject user, RoleObject role) + { + ProjectId = projectId; + User = user; + Role = role; + } + + } +} diff --git a/src/Database/ReturnObjects/RDSResourceTypeObject.cs b/src/Database/ReturnObjects/RDSResourceTypeObject.cs new file mode 100644 index 0000000..5e6cfdd --- /dev/null +++ b/src/Database/ReturnObjects/RDSResourceTypeObject.cs @@ -0,0 +1,19 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + [Serializable] + public class RDSResourceTypeObject : ResourceTypeOptionObject + { + public Guid Id { get; set; } + public string BucketName { get; set; } + public int Size { get; set; } + + public RDSResourceTypeObject(Guid id, string bucketName, int size) + { + Id = id; + BucketName = bucketName; + Size = size; + } + } +} diff --git a/src/Database/ReturnObjects/ResourceObject.cs b/src/Database/ReturnObjects/ResourceObject.cs new file mode 100644 index 0000000..4792ecc --- /dev/null +++ b/src/Database/ReturnObjects/ResourceObject.cs @@ -0,0 +1,51 @@ +using Coscine.Configuration; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; + +namespace Coscine.Database.ReturnObjects +{ + [Serializable] + public class ResourceObject : IReturnObject + { + public Guid Id { get; set; } + // TODO: Needs a better fix + public string PID { get { var configuration = new ConsulConfiguration(); return configuration.GetStringAndWait("coscine/global/epic/prefix") + "/" + Id.ToString(); } } + public string DisplayName { get; set; } + public string ResourceName { get; set; } + public string Description { get; set; } + public string Keywords { get; set; } + public string UsageRights { get; set; } + public ResourceTypeObject Type { get; set; } + public IEnumerable<DisciplineObject> Disciplines { get; set; } + public VisibilityObject Visibility { get; set; } + public LicenseObject License { get; set; } + public JObject ResourceTypeOption { get; set; } + public string ApplicationProfile { get; set; } + public JToken FixedValues { get; set; } + public Guid? Creator { 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, Guid? creator = null) + { + Id = id; + + DisplayName = displayName; + ResourceName = resourceName; + Description = description; + Keywords = keywords; + UsageRights = usageRights; + + Type = type; + Disciplines = disciplines; + Visibility = visibility; + License = license; + + ResourceTypeOption = resourceTypeOption; + + ApplicationProfile = applicationProfile; + FixedValues = fixedValues; + + Creator = creator; + } + } +} diff --git a/src/Database/ReturnObjects/ResourceTypeObject.cs b/src/Database/ReturnObjects/ResourceTypeObject.cs new file mode 100644 index 0000000..17f6a63 --- /dev/null +++ b/src/Database/ReturnObjects/ResourceTypeObject.cs @@ -0,0 +1,22 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + [Serializable] + public class ResourceTypeObject : IReturnObject + { + public Guid Id { get; set; } + + public string DisplayName { get; set; } + + public bool Enabled { get; set; } + + public ResourceTypeObject(Guid id, string displayName, bool enabled) + { + Id = id; + DisplayName = displayName; + Enabled = enabled; + } + + } +} diff --git a/src/Database/ReturnObjects/ResourceTypeOptionObject.cs b/src/Database/ReturnObjects/ResourceTypeOptionObject.cs new file mode 100644 index 0000000..0974a33 --- /dev/null +++ b/src/Database/ReturnObjects/ResourceTypeOptionObject.cs @@ -0,0 +1,9 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + [Serializable] + public abstract class ResourceTypeOptionObject : IReturnObject + { + } +} \ No newline at end of file diff --git a/src/Database/ReturnObjects/RoleObject.cs b/src/Database/ReturnObjects/RoleObject.cs new file mode 100644 index 0000000..a8e65a7 --- /dev/null +++ b/src/Database/ReturnObjects/RoleObject.cs @@ -0,0 +1,18 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + [Serializable] + public class RoleObject : IReturnObject + { + public Guid Id { get; set; } + + public string DisplayName { get; set; } + + public RoleObject(Guid id, string displayName) + { + Id = id; + DisplayName = displayName; + } + } +} \ No newline at end of file diff --git a/src/Database/ReturnObjects/S3ResourceTypeObject.cs b/src/Database/ReturnObjects/S3ResourceTypeObject.cs new file mode 100644 index 0000000..97f9ea5 --- /dev/null +++ b/src/Database/ReturnObjects/S3ResourceTypeObject.cs @@ -0,0 +1,22 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + [Serializable] + public class S3ResourceTypeObject : ResourceTypeOptionObject + { + public Guid Id { get; set; } + public string BucketName { get; set; } + public string AccessKey { get; set; } + public string SecretKey { get; set; } + + public S3ResourceTypeObject(Guid id, string bucketName, string accessKey, string secretKey) + { + Id = id; + BucketName = bucketName; + + AccessKey = accessKey; + SecretKey = secretKey; + } + } +} diff --git a/src/Database/ReturnObjects/UserObject.cs b/src/Database/ReturnObjects/UserObject.cs new file mode 100644 index 0000000..32a6e54 --- /dev/null +++ b/src/Database/ReturnObjects/UserObject.cs @@ -0,0 +1,30 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + [Serializable] + public class UserObject : IReturnObject + { + public Guid Id { get; set; } + + public string DisplayName { get; set; } + + public string Givenname { get; set; } + + public string Surname { get; set; } + + public string EmailAddress { get; set; } + + public bool HasProjectRole { get; set; } + + public UserObject(Guid id, string displayName, string givenname, string surname, string emailAddress, bool hasProjectRole = false) + { + Id = id; + DisplayName = displayName; + Givenname = givenname; + Surname = surname; + EmailAddress = emailAddress; + HasProjectRole = hasProjectRole; + } + } +} diff --git a/src/Database/ReturnObjects/VisibilityObject.cs b/src/Database/ReturnObjects/VisibilityObject.cs new file mode 100644 index 0000000..b09853f --- /dev/null +++ b/src/Database/ReturnObjects/VisibilityObject.cs @@ -0,0 +1,17 @@ +using System; + +namespace Coscine.Database.ReturnObjects +{ + public class VisibilityObject : IReturnObject + { + public Guid Id { get; set; } + + public string DisplayName { get; set; } + + public VisibilityObject(Guid id, string displayName) + { + Id = id; + DisplayName = displayName; + } + } +} diff --git a/src/Database/ReturnObjects/WaterbutlerFolder.cs b/src/Database/ReturnObjects/WaterbutlerFolder.cs new file mode 100644 index 0000000..4638da3 --- /dev/null +++ b/src/Database/ReturnObjects/WaterbutlerFolder.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; + +namespace Coscine.Database.ReturnObjects +{ + public class WaterbutlerObject + { + public bool IsFolder { get; set; } = false; + public string Absolutepath { get; set; } = null; + public string Name { get; set; } = null; + public string LastModified { get; set; } + public string Created { get; set; } + public string Size { get; set; } + // Shallow! Only one level deep. + // Should the folder contain additional folders, they will be empty/null. + public List<WaterbutlerObject> Content { get; set; } = null; + + public WaterbutlerObject() + { + + } + + public WaterbutlerObject(string path, JToken data) + { + Absolutepath = path; + Content = new List<WaterbutlerObject>(); + IsFolder = true; + + if (data == null) + { + throw new ArgumentNullException("The data for the WaterbutlerFolder cannot be null."); + } + + foreach (var obj in data) + { + if (obj["type"].ToObject<string>() == "files") + { + Content.Add(new WaterbutlerObject + { + IsFolder = obj["attributes"]["kind"].ToObject<string>() == "folder", + Absolutepath = obj["attributes"]["path"].ToObject<string>(), + Name = obj["attributes"]["name"].ToObject<string>(), + Created = obj["attributes"]["modified_utc"]?.ToObject<string>(), + LastModified = obj["attributes"]["LastModified_utc"]?.ToObject<string>(), + Size = obj["attributes"]["size"]?.ToObject<string>(), + }); + } + } + } + } +} diff --git a/src/Database/Settings/ConnectionStringSettings.cs b/src/Database/Settings/ConnectionStringSettings.cs new file mode 100644 index 0000000..2490f3f --- /dev/null +++ b/src/Database/Settings/ConnectionStringSettings.cs @@ -0,0 +1,12 @@ +using LinqToDB.Configuration; + +namespace Coscine.Database.Settings +{ + public class ConnectionStringSettings : IConnectionStringSettings + { + public string ConnectionString { get; set; } + public string Name { get; set; } + public string ProviderName { get; set; } + public bool IsGlobal => false; + } +} diff --git a/src/Database/Settings/CoscineSettings.cs b/src/Database/Settings/CoscineSettings.cs new file mode 100644 index 0000000..95fbf2d --- /dev/null +++ b/src/Database/Settings/CoscineSettings.cs @@ -0,0 +1,47 @@ +using Coscine.Configuration; +using LinqToDB.Configuration; +using System.Collections.Generic; +using System.Linq; + +namespace Coscine.Database.Settings +{ + public class CoscineSettings : ILinqToDBSettings + { + + public CoscineSettings(IConfiguration configuration) + { + Configuration = configuration; + } + + public string DbDataSourceKey { get; set; } = "coscine/global/db_data_source"; + public string DbNameKey { get; set; } = "coscine/global/db_name"; + public string DbUserIdKey { get; set; } = "coscine/global/db_user_id"; + public string DbPasswordKey { get; set; } = "coscine/global/db_password"; + + public IConfiguration Configuration { get; set; } + + public IEnumerable<IDataProviderSettings> DataProviders => Enumerable.Empty<IDataProviderSettings>(); + + public string DefaultConfiguration => "SqlServer"; + public string DefaultDataProvider => "SqlServer"; + + public IEnumerable<IConnectionStringSettings> ConnectionStrings + { + get + { + var dbDataSource = Configuration.GetStringAndWait(DbDataSourceKey); + var dbDatabase = Configuration.GetStringAndWait(DbNameKey); + var dbUserId = Configuration.GetStringAndWait(DbUserIdKey); + var dbPassword = Configuration.GetStringAndWait(DbPasswordKey); + + yield return + new ConnectionStringSettings + { + Name = "Coscine", + ProviderName = "SqlServer", + ConnectionString = $"Data Source={dbDataSource}; Database={dbDatabase}; User Id={dbUserId}; Password={dbPassword};" + }; + } + } + } +} \ No newline at end of file diff --git a/src/Database/Util/DatabaseConnection.cs b/src/Database/Util/DatabaseConnection.cs new file mode 100644 index 0000000..9abacdf --- /dev/null +++ b/src/Database/Util/DatabaseConnection.cs @@ -0,0 +1,27 @@ +using Coscine.Database.DataModel; +using System; + +namespace Coscine.Database.Util +{ + public class DatabaseConnection + { + public static void ConnectToDatabase(Action<CoscineDB> action) + { + using (var coscineDB = new CoscineDB()) + { + action.Invoke(coscineDB); + } + } + + public static T ConnectToDatabase<T>(Func<CoscineDB, T> func) + { + T result; + using (var coscineDB = new CoscineDB()) + { + result = func.Invoke(coscineDB); + } + return result; + } + + } +} diff --git a/src/Database/Util/UserRoles.cs b/src/Database/Util/UserRoles.cs new file mode 100644 index 0000000..9c22a86 --- /dev/null +++ b/src/Database/Util/UserRoles.cs @@ -0,0 +1,8 @@ +namespace Coscine.Database.Util +{ + public class UserRoles + { + public static string Member { get; } = "member"; + public static string Owner { get; } = "owner"; + } +} diff --git a/src/Database/packages.config b/src/Database/packages.config index b98ce80..cbfb6e2 100644 --- a/src/Database/packages.config +++ b/src/Database/packages.config @@ -2,7 +2,10 @@ <packages> <package id="Consul" version="0.7.2.6" targetFramework="net461" /> <package id="Coscine.Configuration" version="1.4.0" targetFramework="net461" /> + <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> <package id="linq2db" version="2.6.4" targetFramework="net461" /> <package id="linq2db.SqlServer" version="2.6.4" targetFramework="net461" /> <package id="linq2db.t4models" version="2.6.4" targetFramework="net461" /> + <package id="LinqKit" version="1.1.17" targetFramework="net461" /> + <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" /> </packages> \ No newline at end of file diff --git a/src/Migrator/App.config b/src/Migrator/App.config deleted file mode 100644 index 731f6de..0000000 --- a/src/Migrator/App.config +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<configuration> - <startup> - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> - </startup> -</configuration> \ No newline at end of file diff --git a/src/Migrator/Assets/Institutes.csv b/src/Migrator/Assets/Institutes.csv deleted file mode 100644 index f253dcb..0000000 --- a/src/Migrator/Assets/Institutes.csv +++ /dev/null @@ -1,1357 +0,0 @@ -1,RWTH Aachen University -10730,Abteilung 7.3 - Einkauf und Zollangelegenheiten -10720,Abteilung 7.2 - Kreditorenbuchhaltung -10440,Abteilung 4.4 - Drittmittel -10750,Abteilung 7.5 - Debitoren, Anlagen und Steuern -10760,Abteilung 7.6 - Bilanzierung und Liquiditätsmanagement (Kasse) -10800,Dezernat 8.0 - Personal -10810,Abteilung 8.1 - Wissenschaftliches Tarifpersonal und Hilfskräfte -10820,Abteilung 8.2 - Tarifpersonal in Technik und Verwaltung -10830,Abteilung 8.3 - Dienstreisemanagement und Hochschulbeihilfestelle -10840,Abteilung 8.4 - Aus- und Fortbildung -10850,Abteilung 8.5 - Berufungsmanagement und Beamtinnen und Beamte -10900,Dezernat 9.0 - Recht -11000,Dezernat 10.0 - Facility Management -11010,Abteilung 10.1 - Kaufmännisches Gebäudemanagement -11011,Sachgebiet Finanzbuchhaltung -11012,Sachgebiet Einkauf -11013,Sachgebiet Objektbuchhaltung -11021,Sachgebiet Projektkoordnination -11022,Sachgebiet Bauliche Instandhaltung -11024,Sachgebiet Flächenmanagement -11030,Abteilung 10.3 - Technisches Gebäudemanagement Maschinentechnik -11031,Sachgebiet MSR Hörsaaltechnik -11033,Sachgebiet Heizkraftwerk Melaten und Fernwärme -11034,Sachgebiet Abwasser-, Wasser-, und Gasanlagen -11035,Sachgebiet Technische Planung/Bauleitung -11037,Sachgebiet Nachhaltiges Instandhaltungsmanagem. -11040,Abteilung 10.4 - Technisches Gebäudemanagement Elektrotechnik -11041,Sachgebiet Stromverteilung -11042,Sachgebiet Stromversorgung -11044,Sachgebiet Brandmeldeanlagen -11045,Sachgebiet Übertragungstechnik -11110,Abteilung 11.1 - Infrastrukturelles Gebäudemanagement -11112,Sachgebiet Transportlogistik (inkl. Poststelle) -11113,Sachgebiet Außenbereichspflege -11114,Sachgebiet Reinigungsdienste -11115,Sachgebiet Raum- und Veranstaltungsmanagement (inkl. Hausmeisterdienste für Versammlungsstätten) -11120,Abteilung 11.2 - Gebäudelogistik und Umwelt -11124,Sachgebiet Infrastrukturelle Gebäudesicherheit -1217,Geschäftsführung IDEA League -1212,Exploratory Teaching Space -28100,Hochschularchiv -22000,IT Center -40870,SFB-Transregio 87 Gepulste Hochl. -41120,SFB 1120 Bauteilpräzision durch Beherrsc -42890,SFB 289 Formgebung met. Werkstoffe -44400,SFB 440 Montage hybride Mikrosysteme H. -44420,SFB 442 Umweltvertr. Tribossysteme d. -45320,SFB 532 Textilbewehrter Beton-Entw. -46860,SFB 686 Modellbas. Regelung d. homog. -80006,Exploratory Research Space -80008,JARA-SOFT -80010,JARA-BRAIN -80011,JARA-ENERGY -80020,Profilbereich Molecular Science & Engineering (MSE) -80022,Profilbereich Production Engineering (ProdE) -80023,JARA - FAME -80024,Center for Automotive Catalytic Systems Aachen -80025,Integrative Produktionstechnik für Hochlohnländer -80027,Center for Wind Power Drives -80030,Project House for PowertoFuelConversion -31000,Personalrat -37000,Gleichstellungsbüro -33000,Schwerbehindertenvertretung der RWTH -35000,Vertretung der wissenschaftlichen Mitarbeiter -34000,Zentrale Gruppenvertretung der Beschäftigten in Technik und Verwaltung -RWTH_AKB,Akademischer Bereich -100000,Fakultät für Mathematik, Informatik und Naturwissenschaften -110000,Fachgruppe Mathematik -111002,Bibliothek der Fachgruppe Mathematik -111410,Lehrstuhl für Angewandte Mathematik und Institut für Geometrie und Praktische Mathematik (N.N.) -112520,Lehr- und Forschungsgebiet Numerische und Angewandte Analysis -112430,Juniorprofessur für Mathematische Bild- und Signalverarbeitung -111710,Lehrstuhl für Numerische Mathematik -11121,Sachgebiet Abfallwirtschaft -11122,Sachgebiet Umweltschutz -11123,Sachgebiet Brandschutz -13000,Hochschularzt -1216,Integration Team -1500,CiL Center for Innovative Learning Technologies -25000,Gemeinschaftslabor für Elektronenmikroskopie 1430,Geschäftsstelle Elektromobilität -1431,Centre for Molecular Transformation -80052,E.ON Energy Research Center -21000,Universitätsbibliothek -23000,Zentrum für Lern- und Wissensmanagement -24000,Hochschulsportzentrum -27000,Sprachenzentrum -41290,SFB Transregio 129 Oxyflame -44010,SFB 401 Strömungsbeeinflussung und Str. -44270,SFB 427 Medien u. kultur. k. Jarke -44271,SFB 427 Medien u. kultur. K. T. Jäger -45610,SFB 561 Thermisch hochbelastete off. -47610,SFB 761 Stahl-abinitio; Quantenmechanisc -49170,SFB 917 Resistiv schaltende Chalkogenide -49850,SFB 985 Funktionelle Mikrogele und Mikro -80002,Center für Computational Engineering Sci -80003,Aachen Institute for Advanced Study in C -80004,UMIC - Ultra High-Speed Mobile Informati -80005,JARA-Office -80007,HumTec -80009,JARA-FIT -80012,JARA-HPC -80013,HCI Center -80015,Profilbereich Computational Science & Engineering (CompSE) -80016,Profilbereich Energy, Chemical & Process Engineering (ECPE) -80017,Profilbereich Information & Communication Technology (ICT) -80018,Profilbereich Materials Science & Engineering (MatSE) -80019,Profilbereich Medical Science & Technology (MedST) -80021,Profilbereich Mobility & Transport Engineering (MTE) -RWTH_ZB,Zentraler Bereich -2,Hochschulrat -1000,Rektorat -1100,Rektor -1200,Prorektor für Lehre -1300,Prorektor für Wirtschaft und Industrie -1400,Prorektor für Forschung und Struktur -2100,Prorektorin für Personal und Wissenschaftlichen Nachwuchs -10010,Kanzler -10019,Innenrevision -10031,Hochschulrat und Grundsatzfragen -10032,Marketing -10033,Relationship Management -10000,Zentrale Hochschulverwaltung -10100,Dezernat 1.0 - Akademische und studentische Angelegenheiten -10110,Abteilung 1.1 - Akademische Angelegenheiten -10120,Abteilung 1.2 - Studentische Angelegenheiten -10130,Abteilung 1.3 - Zentrales Prüfungsamt -10140,Abteilung 1.4 - Zentrale Studienberatung -10200,Dezernat 2.0 - Internationale Hochschulbeziehungen -10210,Abteilung 2.1 - Zugang und Soziales -10220,Abteilung 2.2 - Betreuung -10230,Abteilung 2.3 - Mobilität -10300,Dezernat 3.0 - Presse und Kommunikation -28200,RWTHextern-Das Bürgerforum -10400,Dezernat 4.0 - Forschung und Karriere -10410,Abteilung 4.1 - Technologietransfer -10420,Abteilung 4.2 - Forschungsförderung -10430,Abteilung 4.3 - Karriereentwicklung -10500,Dezernat 5.0 - Organisation und IT -10510,Abteilung 5.1 - Organisation -10530,Abteilung 5.3 - IT-Basisdienste -10600,Dezernat 6.0 - Planung, Entwicklung und Controlling -10610,Abteilung 6.1 - Strategie und Strukturplanung -10630,Abteilung 6.3 - Controlling und Informationsmanagement -10639,SAP-Berechtigungen manuell -10700,Dezernat 7.0 - Finanzen -10710,Abteilung 7.1 - Haushalt -132210,Lehrstuhl für Experimentalphysik und II. Physikalisches Institut -133320,Lehr- und Forschungsgebiet Experimentalphysik (Hochenergiephysik) -133130,Juniorprofessur für Experimentelle Astroteilchenphysik -134310,Lehrstuhl für Experimentalphysik IV C (FZ Jülich) -135220,Lehr- und Forschungsgebiet Theoretische Physik (kondensierte Materie) -135420,Lehr- und Forschungsgebiet Computerbasierte Festkörpertheorie -135510,Lehrstuhl für Theoretische Physik C und Institut für Theoretische Festkörperphysik -136320,Lehr- und Forschungsgebiet Theoretische Physik (N.N.) -164120,Lehr- und Forschungsgebiet System-Ökotoxikologie (UFZ Leipzig) -211220,Lehr- und Forschungsgebiet Computergestütztes Entwerfen -212110,Lehrstuhl für Planungstheorie und Stadtentwicklung -212410,Lehrstuhl und Institut für Städtebau und Entwerfen -213220,Lehr- und Forschungsgebiet Bauplanung und Baurealisierung -215230,Juniorprofessur für Werkzeugkulturen -215330,Juniorprofessur für Rezykliergerechtes Bauen -217320,Lehr- und Forschungsgebiet Stadtbaugeschichte (N.N.) -311610,Lehrstuhl und Institut für Massivbau -311810,Lehrstuhl für Baustatik und Baudynamik -314520,Lehr- und Forschungsgebiet Ingenieurhydrologie -314620,Lehr- und Forschungsgebiet Abfallwirtschaft (N.N.) -316210,Lehrstuhl für Bauinformatik und Geoinformationssysteme und Geodätisches Institut -316420,Lehr- und Forschungsgebiet Gender und Diversity in den Ingenieurwissenschaften -316520,Lehr- und Forschungsgebiet Strukturelle Polymerkomposite im Bauwesen und Institut für Baustoffforschung -316620,Lehr- und Forschungsgebiet Fachdidaktik Bautechnik -155410,Lehrstuhl für Materialien und Prozesse für elektrochemische Energiespeicher und -wandler (FZ Jülich) -155830,Juniorprofessur für Organische Chemie -161320,Lehr- und Forschungsgebiet Spezielle Botanik (N.N.) -163720,Lehr- und Forschungsgebiet Molekulare Ökologie der Rhizosphäre -162020,Lehr- und Forschungsgebiet Zoologie und Humanbiologie -162320,Lehr- und Forschungsgebiet Molekulare und systemische Neurophysiologie -163110,Lehr- und Forschungsgebiet Theoretische Systemneurobiologie (FZ Jülich) -164020,Lehr- und Forschungsgebiet Zelluläre und Angewandte Infektionsbiologie -163310,Lehrstuhl für Chemosensorik -161700,Institut für Angewandte Mikrobiologie (Biologie IV) -161710,Lehrstuhl für Angewandte Mikrobiologie -161820,Lehr- und Forschungsgebiet Mikrobielle Genetik -162420,Lehr- und Forschungsgebiet Ökosystemanalyse -162710,Lehrstuhl für Umweltbiologie und -chemodynamik -164220,Lehr- und Forschungsgebiet Bioanalytische Ökotoxikologie (UFZ Leipzig) -200000,Fakultät für Architektur -211110,Lehrstuhl für Tragkonstruktionen -212610,Lehrstuhl für Wohnbau und Grundlagen des Entwerfens und Institut für Wohnbau -212820,Lehr- und Forschungsgebiet Architekturtheorie -213110,Lehrstuhl für Gebäudelehre und Grundlagen des Entwerfens und Institut für Schulbau -214110,Lehrstuhl für Landschaftsarchitektur -215130,Juniorprofessur für Sicherung kulturellen Erbes -216110,Lehrstuhl für Bildnerische Gestaltung -216310,Lehrstuhl für Plastik -217110,Lehrstuhl für Architekturgeschichte -300000,Fakultät für Bauingenieurwesen -312530,Juniorprofessur für Umweltverträglichkeit von Baustoffen -311320,Lehr- und Forschungsgebiet Baustoffkunde - Bauwerkserhaltung und -instandsetzung und Institut für Baustoffforschung -311510,Lehrstuhl und Institut für Angewandte Mechanik -311710,Lehrstuhl für Stahl- und Leichtmetallbau und Institut für Stahlbau -312110,Lehrstuhl und Institut für Baubetrieb und Projektmanagement -312410,Lehrstuhl für Energieeffizientes Bauen -400000,Fakultät für Maschinenwesen -411110,Lehrstuhl und Institut für Allgemeine Mechanik -411410,Lehrstuhl und Institut für Technische Verbrennung -411610,Lehrstuhl und Institut für Allgemeine Konstruktionstechnik des Maschinenbaus -411710,Lehrstuhl und Institut für Maschinenelemente und Systementwicklung -411910,Lehrstuhl und Institut für Getriebetechnik, Maschinendynamik und Robotik -412420,Lehr- und Forschungsgebiet Laser-Messverfahren in der Thermofluiddynamik (N.N.) -412130,Juniorprofessur für Model-Based Fuel Design -412310,Lehrstuhl für Verbrennungskraftmaschinen und Institut für Thermodynamik -412610,Lehrstuhl für Wärme- und Stoffübertragung -412910,Lehrstuhl für Solartechnik (DLR) -413010,Lehrstuhl für Brennstoffzellen (FZ Jülich) -413110,Lehrstuhl für Reaktorsicherheit und -technik -413410,Lehrstuhl für Werkstoffe der Energietechnik (FZ Jülich) -413510,Lehrstuhl und Institut für Strahlantriebe und Turbomaschinen -413920,Lehr- und Forschungsgebiet Raumfahrtantriebe (DLR) -414110,Lehrstuhl und Institut für Kraftfahrzeuge (ika) -414430,Juniorprofessur für Kraftfahrzeug Systembewertung -414210,Lehrstuhl und Institut für Schienenfahrzeuge und Transportsysteme -136520,Lehr- und Forschungsgebiet Theoretische Teilchenphysik -139830,Juniorprofessur für Theoretische Nanospintronik (FZ Jülich) -137910,Lehrstuhl für Computational Materials Science -139020,Lehr- und Forschungsgebiet Didaktik der Physik und Technik -139110,Lehrstuhl für Physik (FZ Jülich) -139420,Lehr- und Forschungsgebiet für Experimentalphysik -139610,Lehrstuhl für Theoretische Astroteilchenphysik und Kosmologie und Institut für Theoretische Teilchenphysik und Kosmologie -137310,Lehrstuhl für Theoretische Physik -137620,Lehr- und Forschungsgebiet Theoretische Physik / Quanteninformationsverarbeitung (FZ Jülich) -135920,Lehr- und Forschungsgebiet Theoretische Physik (kondensierte Materie) -151110,Lehrstuhl für Festkörper- und Quantenchemie und Institut für Anorganische Chemie -151520,Lehr- und Forschungsgebiet Anorganische Chemie (Molekulare Funktionsmaterialien) -151830,Juniorprofessur für Moderne Strukturanalytik komplexer chemischer Systeme mit hochauflösenden experimentellen Methoden -152230,Juniorprofessur für Effiziente Synthesestrategien -152620,Lehr- und Forschungsgebiet Organische Chemie -154110,Lehrstuhl für Technische Chemie und Petrolchemie -154220,Lehr- und Forschungsgebiet Technische Chemie -154320,Lehr- und Forschungsgebiet für Translationale molekulare Katalyse -154610,Lehrstuhl für Textilchemie und Makromolekulare Chemie -154810,Lehrstuhl für Makromolekulare Chemie -155520,Lehr- und Forschungsgebiet In-operando Magnetische Resonanz (FZ Jülich) -155630,Juniorprofessur für Angewandte Grenzflächenelektrochemie (FZ Jülich) -160000,Fachgruppe Biologie -161220,Lehr- und Forschungsgebiet Ökologie des Bodens und Abteilung Systematik und Geobotanik -131220,Lehr- und Forschungsgebiet Biophysik -136720,Lehr- und Forschungsgebiet Metamaterialien und Nano-Optik -131430,Juniorprofessur für Experimentelle Astroteilchenphysik -132110,Lehrstuhl für Experimentalphysik (Festkörperphysik) und II. Physikalisches Institut -132520,Lehr- und Forschungsgebiet Experimentelle Physik der kondensierten Materie -132310,Lehrstuhl für Experimentalphysik (Festkörperphysik) und II. Physikalisches Institut -133110,Lehrstuhl für Experimentalphysik III A -133510,Lehrstuhl für Experimentalphysik III B -133720,Lehr- und Forschungsgebiet Experimentalphysik -134820,Lehr- und Forschungsgebiet Experimentalphysik -139520,Lehr- und Forschungsgebiet Physik der Teilchenbeschleuniger (FZ Jülich) -134110,Lehrstuhl für Experimentalphysik IV A (FZ Jülich) -138730,Juniorprofessur für Experimentalphysik (FZ Jülich) -134510,Lehrstuhl für Experimentalphysik IV E (FZ Jülich) -134610,Lehrstuhl für Experimentalphysik IV F (FZ Jülich) -135110,Lehrstuhl für Theoretische Physik A und Institut für Theorie der statistischen Physik -136110,Lehrstuhl für Theoretische Physik E und Institut für Theoretische Teilchenphysik und Kosmologie -136220,Lehr- und Forschungsgebiet Theoretische Teilchenphysik -136830,Juniorprofessur für Theoretische Teilchenphysik -137510,Lehrstuhl für Theoretische Physik (FZ Jülich) -138630,Juniorprofessur für Theoretische Physik (FZ Jülich) -25010,Lehrstuhl für Mikrostrukturanalytik -137000,Institut für Quanteninformation -137420,Lehr- und Forschungsgebiet Theoretische Physik (FZ Jülich) -150000,Fachgruppe Chemie -111620,Lehr- und Forschungsgebiet Numerische Analysis -114620,Lehr- und Forschungsgebiet Mathematik -111920,Lehr- und Forschungsgebiet Mathematik -112120,Lehr- und Forschungsgebiet Mathematik -112320,Lehr- und Forschungsgebiet Didaktik der Mathematik -113320,Lehr- und Forschungsgebiet Mathematik (Diskrete Optimierung) -114320,Lehr- und Forschungsgebiet Mathematik -114510,Lehrstuhl für Mathematik C (Analysis) -114920,Lehr- und Forschungsgebiet Mathematik (Algebra) -115010,Lehrstuhl für Mathematik (CCES) -115210,Lehrstuhl für Mathematik (Algebra) (N.N.) -116220,Lehr- und Forschungsgebiet Angewandte Statistik -121110,Lehrstuhl für Informatik 1 (Algorithmen und Komplexität) -123420,Lehr- und Forschungsgebiet Theorie Hybrider Systeme -121620,Lehr- und Forschungsgebiet Informatik 3 (Softwarekonstruktion) -123220,Lehr- und Forschungsgebiet Kooperationssysteme (Fraunhofer FIT) -122620,Lehr- und Forschungsgebiet Life Science Informatik (Fraunhofer FTI) -123320,Lehr- und Forschungsgebiet Medienprozesse(Fraunhofer FIT) -122420,Lehr- und Forschungsgebiet Informatik 9 (Lerntechnologien) -123010,Lehrstuhl für Informatik 12 (Hochleistungsrechnen) -123520,Lehr- und Forschungsgebiet Informatik-IT-Sicherheit -124620,Lehr- und Forschungsgebiet Virtuelle Realität und Immersive Visualisierung -151210,Lehrstuhl für Metallorganische Chemie und Institut für Anorganische Chemie -151620,Lehr- und Forschungsgebiet Anorganische Chemie (Molekularer Magnetismus) -152920,Lehr- und Forschungsgebiet für Organische Chemie -111810,Lehrstuhl für Mathematik (Analysis) -113110,Lehrstuhl I für Mathematik (für Ingenieure) -113520,Lehr- und Forschungsgebiet Mathematische Methoden der Physik -113210,Lehrstuhl II für Mathematik (für Ingenieure) -114110,Lehrstuhl A für Mathematik -114220,Lehr- und Forschungsgebiet Mathematik -114410,Lehrstuhl für Mathematik B (Algebra) (N.N.) -153110,Lehrstuhl für Physikalische Chemie I und Institut für Physikalische Chemie -153310,Lehrstuhl für Physikalische Chemie II und Institut für Physikalische Chemie -153420,Lehr- und Forschungsgebiet Theoretische Chemie -153630,Juniorprofessur für Spektroskopie kondensierter Materie -161920,Lehr- und Forschungsgebiet Molekulare Zellbiologie der Pflanzen -161510,Lehrstuhl und Institut für Biologie III (Pflanzenphysiologie) -162110,Lehrstuhl und Institut für Biologie II (Zoologie) -162610,Lehrstuhl für Biotechnologie -163820,Lehr- und Forschungsgebiet Bioprozess-Analytik (FZ Jülich) -162820,Lehr- und Forschungsgebiet Biomaterialien -163130,Juniorprofessur für Cellomics (N.N.) -163930,Juniorprofessur für Synthetische Enzymkaskaden (FZ Jülich) -163530,Juniorprofessur für Mikrobiologie für definierte Mischkulturen -162005,Institut für Umweltforschung (Biologie V) -313110,Lehrstuhl für Schienenbahnwesen und Verkehrswirtschaft und Verkehrswissenschaftliches Institut -313310,Lehrstuhl und Institut für Stadtbauwesen und Stadtverkehr -313410,Lehrstuhl und Institut für Straßenwesen -114530,Juniorprofessur für Mathematik der Signalverarbeitung -114710,Lehrstuhl D für Mathematik -115320,Lehr- und Forschungsgebiet Algebra -116110,Lehrstuhl für Stochastik und Institut für Statistik u. Wirtschaftsmathematik -116320,Lehr- und Forschungsgebiet Angewandte Stochastik -116410,Lehrstuhl für Statistik und Institut für Statistik u. Wirtschaftsmathematik -116510,Lehrstuhl für Statistik und Stochastische Modellierung -120000,Fachgruppe Informatik -121002,Bibliothek -121310,Lehrstuhl für Informatik 2 (Softwaremodellierung und Verifikation) -121510,Lehrstuhl für Informatik 3 (Software Engineering) -121710,Lehrstuhl für Informatik 4 (Kommunikation und verteilte Systeme) -121810,Lehrstuhl für Informatik 5 (Informationssysteme und Datenbanken) -121920,Lehr- und Forschungsgebiet Informatik 5 (Wissensbasierte Systeme) -122930,Juniorprofessur für Komplexität diskreter Probleme -122310,Lehrstuhl für Informatik 8 (Computergraphik und Multimedia) -122510,Lehrstuhl für Informatik 9 (Data Science) -122910,Lehrstuhl für Informatik 7 (Logik und Theorie diskreter Systeme) -123620,Lehr- und Forschungsgebiet für Algorithmen-Orientierte Code-Generierung für Hochleistungsrechnerarchitekturen -130000,Fachgruppe Physik -130002,Physikbibliothek -131005,I. Physikalisches Institut -131110,Lehrstuhl für Experimentalphysik I A und I. Physikalisches Institut -131720,Lehr- und Forschungsgebiet Experimentalphysik -131520,Lehr- und Forschungsgebiet Hochenergiephysik -131910,Lehrstuhl für Experimentelle Elementarteilchenphysik -524320,Lehr- und Forschungsgebiet Modellbildung in der Werkstofftechnik (N.N.) -524510,Lehrstuhl für Werkstoffsynthese der Energietechnik (FZ Jülich) -523620,Lehr- und Forschungsgebiet Grundlagen der Erstarrung (DLR) -532610,Lehrstuhl für Applied Geophysics and Geothermal Energy (E.ON Energy Research Center) -532820,Lehr- und Forschungsgebiet Wissenschaftliches Rechnen in terrestrischen Systemen (FZ Jülich) -542530,Juniorprofessur für Festkörperchemie der Actiniden (FZ Jülich) -551310,Lehrstuhl für Wirtschaftsgeographie -812920,Lehr- und Forschungsgebiet Dienstleistungs- und Technologiemarketing -813010,Lehrstuhl für Bürgerliches Recht, Wirtschaftsrecht und Arbeitsrecht -813310,Lehrstuhl für Operations Research -813510,Lehrstuhl für Operations Management -814110,Lehrstuhl für Organisation -814320,Lehr- und Forschungsgebiet Internationale Wirtschaftsbeziehungen -814620,Lehr- und Forschungsgebiet Wirtschafts-, Sozial- und Technologiegeschichte -815110,Lehrstuhl für Management Science -815220,Lehr- und Forschungsgebiet Wirtschaftsinformatik -816110,Lehrstuhl für Wirtschaftswissenschaften, insb. Energieökonomik -816410,Lehrstuhl für Innovation, Strategie und Organisation -816620,Lehr- und Forschungsgebiet Experimentelle Wirtschaftsforschung -816930,Juniorprofessur für Energieressourcen- und Innovationsökonomik -814210,Lehrstuhl für Personal -900000,Medizinische Fakultät -921110,Institut und Lehrstuhl für Molekulare und Zelluläre Anatomie -921210,Institut und Lehrstuhl für Anatomie und Zellbiologie -921310,Institut und Lehrstuhl für Medizinische Psychologie und Medizinische Soziologie -416310,Lehrstuhl für Fluidverfahrenstechnik -416510,Lehrstuhl für Bioverfahrenstechnik -416610,Lehrstuhl und Institut für Regelungstechnik -416710,Lehrstuhl für Systemverfahrenstechnik -420730,Juniorprofessur für Agile Managementpraktiken in technologieorientierten Handlungssystemen -417010,Lehrstuhl für Produktionsmanagement (N.N.) -420320,Lehr- und Forschungsgebiet Systemergonomie -417210,Lehrstuhl für Produktionssystematik -417410,Lehrstuhl für Technologie der Fertigungsverfahren -417420,Lehr- und Forschungsgebiet Konstruktion und Entwicklung von Mikrosystemen -418110,Lehrstuhl für Werkstoffanwendungen im Maschinenbau -418220,Lehr- und Forschungsgebiet Kontinuumsmechanik -418710,Lehrstuhl für Lasertechnik -418910,Lehrstuhl für Technologie optischer Systeme -419110,Lehrstuhl für Textilmaschinenbau und Institut für Textiltechnik -421220,Lehr- und Forschungsgebiet Kontaktmechanik -510000,Fachgruppe für Rohstoffe und Entsorgungstechnik -511220,Lehr- und Forschungsgebiet Berg-, Umwelt- und Europarecht -520000,Fachgruppe für Materialwissenschaft und Werkstofftechnik -521110,Lehrstuhl für Werkstoffchemie -522110,Lehrstuhl für Werkstofftechnik der Metalle und Institut für Eisenhüttenkunde -522610,Lehrstuhl für Metallurgische Prozesstechnik und Metallrecycling und Institut für Metallhüttenkunde und Elektrometallurgie -522710,Lehrstuhl für Korrosion und Korrosionsschutz -525510,Lehrstuhl für Werkstoffmechanik -526110,Lehrstuhl für Gießereiwesen und Gießerei-Institut -526610,Lehrstuhl für Prozessleittechnik -415410,Lehrstuhl und Institut für Flugsystemdynamik -415520,Lehr- und Forschungsgebiet und Abteilung Hochtemperatur-Gasdynamik -415610,Lehrstuhl und Institut für Strukturmechanik und Leichtbau -416110,Lehrstuhl für Chemische Verfahrenstechnik und Institut für Verfahrenstechnik -416210,Lehrstuhl für Datengetriebene Modellierung in der Computational Engineering Science -416220,Lehr- und Forschungsgebiet Mechanische Verfahrenstechnik (N.N.) -416910,Lehrstuhl für Informationsmanagement im Maschinenbau -530000,Fachgruppe für Geowissenschaften und Geographie -531110,Lehrstuhl für Geologie und Paläontologie und Geologisches Institut -531220,Lehr- und Forschungsgebiet Geologie - Endogene Dynamik -531320,Lehr- und Forschungsgebiet Neotektonik und Georisiken -532110,Lehrstuhl für Ingenieurgeologie und Hydrogeologie -532220,Lehr- und Forschungsgebiet Hydrogeologie -532920,Lehr- und Forschungsgebiet für Sedimentbecken-Analyse -532720,Lehr- und Forschungsgebiet Hydrogeophysik (FZ Jülich) -541110,Lehrstuhl für Angewandte Mineralogie und Lagerstättenlehre -541220,Lehr- und Forschungsgebiet Computational Geoscience and Reservoir Engineering -541320,Lehr- und Forschungsgebiet Ton- und Grenzflächenmineralogie -551720,Lehr- und Forschungsgebiet Wirtschaftsgeographie der Dienstleistungen -611010,Lehrstuhl für Medizinische Informationstechnik -611110,Lehrstuhl für Integrierte digitale Systeme und Schaltungsentwurf -611410,Lehrstuhl und Institut für Theoretische Elektrotechnik -611510,Lehrstuhl für Werkstoffe der Elektrotechnik I und Institut für Werkstoffe der Elektrotechnik -618420,Lehr- und Forschungsgebiet Technologie der Oxidelektronik (FZ Jülich) -611710,Lehrstuhl für Bildverarbeitung -611810,Lehrstuhl für Integrierte Systeme der Signalverarbeitung -613110,Lehrstuhl und Institut für Hochfrequenztechnik -613210,Lehrstuhl und Institut für Nachrichtentechnik -613310,Lehrstuhl und Institut für Kommunikationssysteme -613410,Lehrstuhl und Institut für Theoretische Informationstechnik -613630,Juniorprofessur für Medizinische Akustik -614410,Lehrstuhl für Elektromagnetische Energiewandlung und Institut für Elektrische Maschinen -614510,Lehrstuhl und Institut für Stromrichtertechnik und Elektrische Antriebe -614710,Lehrstuhl für Navigation (DLR) -615210,Lehrstuhl und Institut für Mensch-Maschine-Interaktion -615510,Lehrstuhl und Institut für Vernetzte Systeme -615730,Juniorprofessur für Self-Organized Networks -615610,Lehrstuhl für Photovoltaik (FZ Jülich) -616110,Lehrstuhl für Integrierte Analogschaltungen und Institut für Halbleitertechnik -616210,Lehrstuhl für Halbleitertechnik und Institut für Halbleitertechnik -616310,Lehrstuhl für Automation of Complex Power Systems -616520,Lehr- und Forschungsgebiet Monitoring und verteilte Kontrolle für Energiesysteme -616710,Lehrstuhl für Integrierte Photonik -618310,Lehrstuhl für Elektrochemische Energiewandlung und Speichersystemtechnik -700000,Philosophische Fakultät -793000,Institut für Anglistik, Amerikanistik und Romanistik -793720,Lehr- und Forschungsgebiet Fremdsprachendidaktik -711120,Lehr- und Forschungsgebiet Angewandte Ethik mit dem Schwerpunkt Technik- und Umweltethik -711520,Lehr- und Forschungsgebiet Philosophie der kulturellen Welt -791110,Lehrstuhl für Deutsche Sprache der Gegenwart (N.N.) und Germanistisches Institut -792620,Lehr- und Forschungsgebiet Linguistik und kognitive Semiotik -791220,Lehr- und Forschungsgebiet Germanistische Sprachwissenschaft -791620,Lehr- und Forschungsgebiet Neuere Deutsche Literaturgeschichte -792820,Lehr- und Forschungsgebiet Fachdidaktik Deutsch (Literaturdidaktik) -792530,Juniorprofessur für Allgemeine Literaturwissenschaft/Analyse von literarischen Konzepten -791910,Lehrstuhl für Ältere Deutsche Literatur und Germanistisches Institut -792220,Lehr- und Forschungsgebiet Germanistik/Mediävistik -792310,Lehrstuhl für Kommunikationswissenschaft -793110,Lehrstuhl für Anglistische Literaturwissenschaft -793610,Lehrstuhl für Angewandte Sprachwissenschaft (N.N.) -793810,Lehrstuhl für Anglistische Sprachwissenschaft -794110,Lehrstuhl für Romanische Philologie I -794220,Lehr- und Forschungsgebiet Romanische Sprachwissenschaft (N.N.) -794320,Lehr- und Forschungsgebiet Interkulturelle Studien - Romanistik -700002,Fachgruppe Gesellschaftswissenschaften -741110,Lehrstuhl für Alte Geschichte mit dem Schwerpunkt Geschichte als Wissenskultur und Historisches Institut -741210,Lehrstuhl für Mittlere Geschichte und Historisches Institut -741410,Lehrstuhl für Neuere Geschichte und Historisches Institut -741520,Lehr- und Forschungsgebiet Geschichte der Frühen Neuzeit -741730,Juniorprofessur für Geschichte und Kultur der Region Maas/Rhein -761520,Lehr- und Forschungsgebiet Technik und Diversität -771110,Lehrstuhl und Institut für Politische Theorie und Ideengeschichte -771220,Lehr- und Forschungsgebiet Internationale Beziehungen -771420,Lehr- und Forschungsgebiet Politische Systeme -771620,Lehr- und Forschungsgebiet Fachdidaktik Gesellschaftswissenschaften -781110,Lehrstuhl für Systematische Theologie -781220,Lehr- und Forschungsgebiet Biblische Theologie -781630,Juniorprofessur für Kirchengeschichte und europäische Identitätsbildung -700003,Fachgruppe Empirische Humanwissenschaften -731000,Geschäftsführung des Instituts für Erziehungswissenschaft -721310,Lehrstuhl und Institut für Psychologie -721630,Juniorprofessur für Psychologische Methodenlehre -721110,Lehrstuhl und Institut für Psychologie -721520,Lehr- und Forschungsgebiet Gesundheitspsychologie -731210,Lehrstuhl für Erziehungswissenschaft mit dem Schwerpunkt Berufspädagogik -731420,Lehr- und Forschungsgebiet Erziehungswissenschaft mit dem Schwerpunkt Schulpädagogik und empirische Bildungsforschung -731820,Lehr- und Forschungsgebiet Allgemeine Didaktik mit dem Schwerpunkt Technik- und Medienbildung -731920,Lehr- und Forschungsgebiet Erziehungswissenschaft mit dem Schwerpunkt Heterogenität -812110,Lehrstuhl für Controlling -812210,Lehrstuhl für Management für Industrie 4.0 -812310,Lehrstuhl für Marketing -812410,Lehrstuhl für Betriebswirtschaftslehre, insb. Betriebswirtschaftliche Steuerlehre und Wirtschaftsprüfung (N.N.) -812520,Lehr- und Forschungsgebiet Entscheidungsforschung und Finanzdienstleistungen -812630,Juniorprofessur für Real Estate Finance -812710,Lehrstuhl für Betriebswirtschaftslehre, insbesondere Technologie- und Innovationsmanagement -420830,Juniorprofessur für Interoperabilität von Simulationen im Maschinenbau -417110,Lehrstuhl und Institut für Arbeitswissenschaft -417310,Lehrstuhl für Werkzeugmaschinen -418020,Lehr- und Forschungsgebiet Nichtlineare Dynamik der Laser-Fertigungsverfahren -419410,Lehrstuhl für Medizintechnik -419510,Lehrstuhl für Gebäude- und Raumklimatechnik -419720,Lehr- und Forschungsgebiet für Verfahren höherer Ordnung in der Mehrphasenströmungssimulation -419810,Lehrstuhl für Technologieanalysen und -vorausschau -420110,Lehrstuhl für Enzymprozesstechnik (N.N.) -420910,Lehrstuhl für Production Engineering of E-Mobility Components -421010,Lehrstuhl für Solare Komponenten (DLR) -421110,Lehrstuhl für Technische Mechanik -500000,Fakultät für Georessourcen und Materialtechnik -511410,Lehrstuhl für Rohstoffgewinnung über Tage und Bohrtechnik und Institut für Bergbaukunde III -512110,Lehrstuhl für Aufbereitung und Recycling fester Abfallstoffe und Institut für Aufbereitung, Kokerei und Brikettierung -512320,Lehr- und Forschungsgebiet Aufbereitung mineralischer Rohstoffe -513220,Lehr- und Forschungsgebiet Lehr- und Forschungsgebiet für Advanced Mining Technologies -514110,Lehrstuhl für Markscheidewesen und Institut für Markscheidewesen Bergschadenkunde und Geophysik im Bergbau -525420,Lehr- und Forschungsgebiet Werkstoffe und Verfahren für Luftstrahlantriebe (DLR) -525820,Lehr- und Forschungsgebiet Thermochemie von Energiewerkstoffen -522310,Lehrstuhl für Metallurgie von Eisen und Stahl -523110,Lehrstuhl für Werkstoffphysik und Institut für Metallkunde und Metallphysik -523210,Lehrstuhl für Angewandte Metallkunde der Nichteisenmetalle (HZG) -523410,Lehrstuhl und Institut für Bildsame Formgebung -934620,Lehr- und Forschungsgebiet Experimentelle und klinische Nuklearmedizin (FZ Jülich) -934710,Klinik und Lehrstuhl für Orthopädie und Unfallchirurgie - Schwerpunkt Orthopädie -934810,Klinik und Lehrstuhl für Palliativmedizin -938820,Klinik und Lehr- und Forschungsgebiet für Phoniatrie und Pädaudiologie -935020,Lehr- und Forschungsgebiet Experimentelle Neuropsychiatrie -935120,Lehr- und Forschungsgebiet Experimentelle Psychopathologie -935220,Lehr- und Forschungsgebiet Experimentelle Verhaltenspsychobiologie -935320,Lehr- und Forschungsgebiet Struktur kortikaler Funktionseinheiten -935420,Lehr- und Forschungsgebiet Funktion kortikaler Schaltkreise -935520,Lehr- und Forschungsgebiet Neuropsychologische Geschlechterforschung -935630,Juniorprofessur für Translationale Hirnforschung in Psychiatrie und Neurologie -935810,Lehr- und Forschungsgebiet für Computational Neuroscience (FZ Jülich) -935910,Klinik und Lehrstuhl für Kinder- und Jugendpsychiatrie und -psychotherapie -936130,Juniorprofessur für Translationale Hirnforschung in Kinder- und Jugendpsychiatrie -936210,Klinik und Lehrstuhl für Diagnostische und Interventionelle Radiologie -936310,Klinik und Lehrstuhl für Diagnostische und Interventionelle Neuroradiologie -936530,Juniorprofessur für Funktionelle Bildgebung des chemosensorischen Systems -936610,Lehrstuhl für Strahlentherapie -936820,Lehr- und Forschungsgebiet Kinderherzchirurgie -937010,Klinik und Lehrstuhl für Gefäßchirurgie -937110,Klinik und Lehrstuhl für Urologie -937410,Klinik und Lehrstuhl für Kieferorthopädie (N.N.) -937620,Lehr- und Forschungsgebiet Orale Mikrobiologie und Immunologie -937710,Klinik und Lehrstuhl für Zahnärztliche Prothetik und Werkstoffkunde -937820,Lehr- und Forschungsgebiet Zahnärztliche Werkstoffkunde und Biomaterialforschung -938010,Klinik und Lehrstuhl für Mund-, Kiefer- und Gesichtschirurgie -EXT,Extern -50000,Angegliedertes Institut, Amt und Einrichtung -52100,IKV - Institut für Kunststoffverarbeitung in Industrie und Handwerk e.V. -53200,Fraunhofer-Institut für Produktionstechnologie - IPT -56700,ACTO - Aachener Centrum für Technologietransfer in der Ophthalmologie e. V. -3000,German University of Technology in Oman -54900,Institut für Industriekommunikation und Fachmedien GmbH (IIF) -55000,OWI Oel-Waerme-Institut GmbH -52000,gaiac - Forschungsinstitut für Ökosystemanalyse und -bewertung e.V. -52700,IAPK - Institut für Anwendungstechnik Pulvermetallurgie und Keramik e.V. -53400,Fraunhofer-Institut für Molekularbiologie und Angewandte Ökologie - IME -51300,RWTH International Academy GmbH -60000,Einrichtung der Studierendenschaft -60010,AStA Allgemeiner Studierenden Ausschuss -60120,Fachschaft Chemie -60130,Fachschaft Biowissenschaften -60210,Fachschaft Architektur -60410,Fachschaft Maschinenbau -60610,Fachschaft Elektrotechnik und Informationstechnik -60810,Fachschaft Wirtschaftswissenschaften -1761,Roboterclub Aachen e. V. -28400,Filmstelle -51830,Hochschulradio Aachen e. V. -SONST_EXT,sonstige Externe -60900,UNI und KIND e.V. -62000,Queerreferat an den Aachener Hochschulen e.V. -56300,Hochschulchor -56301,Hochschulorchester -24001,Betriebssportverein 1946 e.V. der RWTH Aachen -56100,Bau- und Liegenschaftsbetrieb NRW, Niederlassung Aachen -60020,Studierendenwerk -STUDW_EXT,Studierendenwohnheime -612020,Lehr- und Forschungsgebiet Technologie der Verbindungshalbleiter -551920,Lehr- und Forschungsgebiet Analyse und Monitoring Urbaner Räume -135100,Institut für Theorie der Statistischen Physik -52800,PIA - Prüf- und Entwicklungsinstitut für Abwassertechnik e.V. -55400,TFI - Deutsches Forschungsinstitut für Bodensysteme e. V. -53300,Fraunhofer-Institut für Angewandte Informationstechnik - FIT -53100,Fraunhofer-Institut für Lasertechnik - ILT -55100,RWTH Aachen Campus GmbH -52900,WZLforum an der RWTH Aachen -60110,Fachschaft Mathematik/Physik/Informatik -60310,Fachschaft Bauingenieurwesen -60510,Fachschaft Rohstoffe und Entsorgungstechnik -60520,Fachschaft Materialwissenschaft und Werkstofftechnik -60540,Fachschaft für Geographie -60710,Fachschaft Philosophie -60720,Fachschaft Lehramt -60730,Fachschaft Kommunikationswissenschaft -55200,PROvendis GmbH -54200,Forschungsstelle Technisch-wirtschaftliche Unternehmensstrukturen der Stahlindustrie -56200,Freunde und Förderer der RWTH (proRWTH) -51100,Haus der Technik e.V. -51200,Technische Akademie Wuppertal e.V. -55300,Landesprüfungsamt für Erste Staatsprüfungen für Lehrämter an Schulen - Außenstelle Aachen -124810,Lehrstuhl für Informatik 6 (Maschinelles Lernen) -136100,Institut für Theoretische Teilchenphysik und Kosmologie -PA5102,Prüfungsausschuss M.Sc. Rohstoffingenieurwesen -PA5103,Prüfungsausschuss M.Sc. Entsorgungsingenieurwesen -PA5104,Prüfungsausschuss M.Sc. Nachhaltige Energieversorgung -PA5204,Prüfungsausschuss M.Sc. Wirtschaftsingenieurwesen -PA5205,Prüfungsausschuss B.Sc. Materialwissenschaften -PA5305,Prüfungsausschuss M.Sc. Applied Geophysics -PA5306,Prüfungsausschuss B.Sc. Angewandte Geographie -PA5307,Prüfungsausschuss Prüfungsausschuss M.Sc. Angewandte Geographie -PA5308,Prüfungsausschuss M.Sc. Wirtschaftsgeographie -PA7006,Studiengang Digitale Medienkommunikation -52300,FIR - Forschungsinstitut für Rationalisierung e. V. -52400,FiW - Forschungsinstitut für Wasser- und Abfallwirtschaft e.V. -54700,Arbeitskreis Nord-Süd -56500,German Research School for Simulation Sciences GmbH -54300,ACCESS e.V. -52600,AMICA - Advanced Microelectronic Center Aachen -52200,DWI - Leibniz-Institut für Interaktive Materialien e.V. -51400,FGH - Forschungsgemeinschaft für Elektrische Anlagen und Stromwirtschaft e.V. -51500,IfU - Institut für Unternehmenskybernetik e.V. -PA7007,Studiengang Politikwissenschaft -PA7008,Studiengang Geschichtswissenschaft - Geschichte als Wissenskultur -PA7009,Studiengang Soziologie -PA7010,Studiengang Empirische Bildungsforschung -PA7011,Studiengang Literatur- und Sprachwissenschaft -PA7012,Studiengang Theologie und Globale Entwicklung -RB0030,Rektoratsbeauftragte für die Schülerlabore -925420,Institut und Lehr- und Forschungsgebiet Computational Genomics -612510,Lehrstuhl für Mikro- und Nanosysteme -PA1202,Prüfungsausschuss Media Informatics -80060,Graduiertenkolleg UnRAVeL -751110,Lehrstuhl für Technik und Individuum -217430,Juniorprofessur für Nachhaltige Wohnbestandsentwicklung -156130,Juniorprofessur für Physikalische Chemie weicher Materie -751010,Lehrstuhl für Technik und Gesellschaft -211520,Lehr- und Forschungsgebiet Individualisierte Bauproduktion -134920,Lehr- und Forschungsgebiet Spin Engineering -939320,Lehr- und Forschungsgebiet Nephro-Kardiologie -939410,Klinik und Lehrstuhl für Geriatrie und Altersmedizin -132930,Juniorprofessur der Theoretischen Astroteilchenphysik -164810,Lehrstuhl für Molekulare Biotechnologie -156310,Lehrstuhl für Makromolekulare Chemie -513310,Lehrstuhl und Institut für Advanced Mining Technologies -111400,Institut für Geometrie und Praktische Mathematik -116400,Institut für Statistik und Wirtschaftsmathematik -939120,Lehr- und Forschungsgebiet Präventive und Translationale Nephrologie -26000,Center für Lehr- und Lernservices (CLS) -791001,Germanistische Bibliothek -2071,Aachener Trompetenforum e.V. -155710,Lehrstuhl für Physikalische Chemie Weicher Materie (FZ Jülich) -750000,Zentrum für interdisziplinäre Wissenschafts- und Technikforschung -311310,Lehrstuhl für Baustoffkunde - Bauwerkserhaltung -KP0001,Bonn-Aachen International Center for Information Technology -PA7015,Studiengang Englisch -132810,Lehrstuhl für Physik Topologischer Isolatoren (FZ Jülich) -PA7016,Studiengang Französisch -PA7022,Prüfungsausschuss Technik-Kommunikation übergreifend -1659,Enactus Aachen e.V. -1706,bonding-studenteninitiative Aachen e.V. -1706,bonding-studenteninitiative Aachen e.V. -1731,Flugwissenschaftliche Vereinigung Aachen 1920 e.V. -1744,Energie Forum Aachen e.V. -1753,BEST Aachen e.V. -1783,EUROAVIA Aachen Theodor von Kármán e.V. -1795,Freunde der Medizinstudierendenschaft Aachen e.V. -1834,AISA (Association of Indian Students in Aachen) e.V. -1885,Tunisian Relations' Window e.V. -1905,VCWSA e.V. -1909,Sonnenwagen Aachen e.V. -1978,Debattierclub an der RWTH Aachen e.V. -PD1000,Prodekan -SD1000,Studiendekan -KO1001,Ältestenrat -KO1002,Kommission Haushalts- und Strukturkommission -KO1007,Habilitationskommission -KO1005,Kommission zur Verbesserung der Qualität von Studium und Lehre -KO1004,Graduiertenförderungskommission -KO1003,Satzungskommission -FS1100,Fachgruppensprecher der Fachgruppe Mathematik -939220,Lehr- und Forschungsgebiet Multimodale Bildgebung in der Neuropsychiatrie -162100,Institut für Biologie II (Zoologie) -524730,Juniorprofessur für Keramische Verbundwerkstoffe -PA1303,Prüfungsausschuss Lehramt Technik -57300,RWTH Innovation GmbH -115410,Lehrstuhl für Angewandten Mathematik -2030,Aachener Smart City e.V. -2062,Bigband der RWTH Aachen e.V. -2064,Projektverein akademischer Kultur e.V. -2077,Windfänger e.V. -5000,iGEM Aachen e.V. -FR1000,Fakultätsrat -DK1000,Dekan -KO1006,Studienbeirat -KO1102,Kommission für Lehre -PA1101,Prüfungsausschuss Mathematik (Bachelor, Master, Lehramt) -KO1101,Fachkommission Mathematik -FS1200,Fachgruppensprecher der Fachgruppe Informatik -KO1201,Kommission für Lehre -PA1201,Prüfungsausschuss Informatik -121001,Zentrale Einrichtungen -121003,Rechnerbetrieb Informatik -FS1300,Fachgruppensprecher der Fachgruppe Physik -KO1301,Fachkommission Physik -KO1302,Graduiertenförderungskommission -921410,Institut und Lehrstuhl für Physiologie -921520,Lehr- und Forschungsgebiet Physiologie, Schwerpunkt Neurophysiologie -921620,Lehr- und Forschungsgebiet Physiologie, Schwerpunkt zelluläre Physiologie -921710,Institut und Lehrstuhl für Biochemie und Molekularbiologie -921810,Institut und Lehrstuhl für Biochemie -921910,Institut und Lehrstuhl für Geschichte, Theorie und Ethik der Medizin -922230,Lehr- und Forschungsgebiet Juniorprofessur für Betriebliche Gesundheitspsychologie -922310,Institut und Lehrstuhl für Molekulare Medizin -922620,Lehr- und Forschungsgebiet Mukosale Infektionsbiologie (N.N.) -924820,Institut und Lehr- und Forschungsgebiet Immunologie -922710,Institut und Lehrstuhl für Medizinische Informatik -925020,Institut und Lehr- und Forschungsgebiet Medizinische Statistik -923020,Lehr- und Forschungsgebiet Pathologie (Tumorpathologie) -923120,Lehr- und Forschungsgebiet Onkologische Pathologie -923420,Lehr- und Forschungsgebiet Pharmakologie der Entzündung -925110,Lehrstuhl für Institut und Lehrstuhl für Versuchstierkunde -923620,Lehr- und Forschungsgebiet Rehabilitations- und Präventionstechnik -923820,Lehr- und Forschungsgebiet Tissue Engineering und Textile Implants -924210,Institut und Lehrstuhl für Experimentelle Molekulare Bildgebung -924320,Lehr- und Forschungsgebiet für Nanomedizin und Theranostik -925220,Institut und Lehr- und Forschungsgebiet Zell- und Molekularbiologie an Grenzflächen -938110,Klinik und Lehrstuhl für Augenheilkunde -938420,Klinik und Lehr- und Forschungsgebiet für gynäkologische Endokrinologie und Reproduktionsmedizin -932010,Klinik und Lehrstuhl für Hals-, Nasen- und Ohrenheilkunde -932210,Lehr- und Forschungsgebiet Pneumologie -932520,Lehr- und Forschungsgebiet Biophysik der Mikroskopie -932710,Klinik und Lehrstuhl für Innere Medizin (mit dem Schwerpunkt Gastroenterologie und Stoffwechselkrankheiten) -933920,Lehr- und Forschungsgebiet Epileptologie -922110,Institut und Lehrstuhl für Arbeitsmedizin -922410,Institut und Lehrstuhl für Molekulare Pathobiochemie, experimentelle Gentherapie und klinische Chemie -922510,Institut und Lehrstuhl für Medizinische Mikrobiologie -922810,Institut und Lehrstuhl für Neuropathologie -922910,Institut und Lehrstuhl für Pathologie -923210,Institut und Lehrstuhl für Pharmakologie und Toxikologie -923320,Lehr- und Forschungsgebiet Molekulare Pharmakologie -923720,Lehr- und Forschungsgebiet Kardiovaskuläre Technik -924010,Institut und Lehrstuhl für Zellbiologie -924120,Lehr- und Forschungsgebiet Stammzellbiologie -924420,Lehr- und Forschungsgebiet für Physik der molekularen Bildgebungssysteme -924510,Institut und Lehrstuhl Computational Biomedicine I -931210,Klinik und Lehrstuhl für Anästhesiologie -938320,Klinik und Lehrstuhl für Anästhesiologie Schwerpunkt Operative Intensivmedizin -931420,Lehr- und Forschungsgebiet Molekulare Tumorbiologie -931620,Lehr- und Forschungsgebiet Posttraumatische Inflammation -931710,Klinik und Lehrstuhl für Gynäkologie und Geburtsmedizin -931910,Klinik und Lehrstuhl für Dermatologie und Venerologie (N.N.) -932310,Institut und Lehrstuhl für Molekulare Herz-Kreislaufforschung -938520,Lehr- und Forschungsgebiet Neonatologische Intensivmedizin -938620,Lehr- und Forschungsgebiet Pädiatrische Onkologie und Stammzelltherapie -933610,Klinik und Lehrstuhl für Neurochirurgie -933720,Lehr- und Forschungsgebiet Translationale Neurochirurgie und Neurobiologie -933810,Klinik und Lehrstuhl für Neurologie -934020,Lehr- und Forschungsgebiet Physik der Magnetresonanztomographie in den Neurowissenschaften (FZ Jülich) -934230,Juniorprofessur für Translationale Hirnforschung in Psychiatrie und Neurologie -934410,Lehr- und Forschungsgebiet für Klinische Kognitionsforschung -211410,Lehrstuhl für Baukonstruktion -792020,Lehr- und Forschungsgebiet Textlinguistik und Technikkommunikation -FR9000,Fakultätsrat -KO9001,Ältestenrat -KO9002,Fakultätskommission für Haushalt und Finanzen -KO9003,Fakultätskommission Forschung und wissenschaftlichen Nachwuchs -KO9009,Arbeitsgruppe Medizinische Prüfungsfragen -DK9000,Dekanin -PD9000,Prodekan als ständiger Vertreter des Dekans -PD9001,Prodekan für Struktur und Finanzen -PD9002,Prodekan für Forschung und wissenschaftlichen Nachwuchs -920000,Fachgruppe A -930000,Fachgruppe B -60910,Fachschaft Medizin -60920,Fachschaft Zahnmedizin -551520,Lehr- und Forschungsgebiet Physische Geographie und Klimatologie (N.N.) -551002,Bibliothek des Geographischen Instituts -533030,Juniorprofessur für Numerisches Reservoir Engineering -923930,Juniorprofessur für Computational Cardiovascular Modelling -791510,Lehrstuhl für Germanistische und Allgemeine Literaturwissenschaft mit dem Schwerpunkt Wissensformen und Germanistisches Institut -132005,II. Physikalisches Institut -522520,Lehr- und Forschungsgebiet für Werkstoff- und Bauteilintegrität -119530,Juniorprofessur für Robuste Planung in der medizinischen Versorgung -131430,Juniorprofessur für Experimentelle Astroteilchenphysik -133005,III. Physikalisches Institut A -10150,Abteilung 1.5 - Prüfungs- und Satzungsrecht -164310,Lehrstuhl für Neurobiologische Forschung -312000,Center for Wind and Earthquake Engineering -FR8000,Fakultätsrat -KO8011,Berufungskommission -931010,Lehrgebiet Allgemeinmedizin -938210,Lehr- und Forschungsgebiet Experimentelle Opthalmologie -931510,Lehrstuhl für Orthopädie und Unfallchirurgie - Schwerpunkt Unfallchirurgie -932610,Klinik und Lehrstuhl für Innere Medizin (mit dem Schwerpunkt Nephrologie und Immunologie) -932820,Lehr- und Forschungsgebiet Endokrinologie und Diabetologie -932920,Lehr- und Forschungsgebiet Hepato-/Gastroenterologie -933020,Lehr- und Forschungsgebiet Hepatologie-/Gastroenterologie und hepatobiliäre /GI-Onkologie -933220,Lehr- und Forschungsgebiet Translationale Hämatologie und Onkologie -938720,Lehr- und Forschungsgebiet Neuropädiatrie und Sozialpädiatrie -936020,Lehr- und Forschungsgebiet Klinische Neuropsychologie im Kindes- und Jugendalter -936420,Lehr- und Forschungsgebiet für Experimentelle Interventionelle Neuroradiologie -936920,Lehr- und Forschungsgebiet Thoraxchirurgie -937920,Lehr- und Forschungsgebiet Computergestützte Zahnmedizin -900003,Interdisziplinäres Zentrum für Klinische Forschung - IZKF Aachen -PA9001,Prüfungsausschuss Aachener Modellstudiengang Medizin -PA9002,Prüfungsausschuss Zahnmedizin -PA9003,Prüfungsausschuss Logopädische Studiengänge -PA9004,Prüfungsausschuss Biomedical Engineering -811510,Lehrstuhl für Volkswirtschaftslehre insb. Mikroökonomie -812610,Lehrstuhl für Betriebswirtschaftslehre, insbes. Betriebliche Finanzwirtschaft -813210,Deutsche Post Lehrstuhl für Optimierung von Distributionsnetzwerken (N.N.) -816720,Lehr- und Forschungsgebiet Advanced Analytics -811630,Juniorprofessur für Spieltheorie und Verhaltensökonomik -816330,Juniorprofessur für Wirtschaftswissenschaften -800007,Exchange Office und Praktikum -137230,Juniorprofessur für Theoretische Physik (kondensierte Materie) -PA1301,Prüfungsausschuss Physik -151005,Institut für Anorganische Chemie -139320,Lehr- und Forschungsgebiet Experimentalphysik (FZ Jülich) -134210,Lehrstuhl für Experimentalphysik IV B (FZ Jülich) -313210,Lehrstuhl für Flughafenwesen und Luftverkehr (DLR) und Verkehrswissenschaftliches Institut -314110,Lehrstuhl für Siedlungswasserwirtschaft und Siedlungsabfallwirtschaft und Institut für Siedlungswasserwirtschaft -600002,Gemeinschaftswerkstatt Walter-Schottky-Haus -613510,Lehrstuhl und Institut für Technische Akustik -618510,Lehrstuhl für Höchstfrequenzelektronik -KO2001,Ältestenrat -KO2002,Studienbeirat -KO2003,Haushaltskommission -KO2005,Kommission zur Qualitätsverbesserung in Lehre und Studium -PA2001,Prüfungsausschuss Fakultät für Architektur -DK2000,Dekanin -KO3001,Ältestenrat -KO3005,Promotionsausschuss -KO3006,Kommission für Struktur und Finanzen -PA3002,Prüfungsausschuss Wirtschaftsingenieurwesen Fachrichtung Bauingenieurwesen (Master- Diplomstudiengang) -PA3004,Prüfungsausschuss Mobilität und Verkehr, Verkehrsingenieurwesen und Mobilität -PA3005,Prüfungsausschuss Lehramtsstudiengänge -PA3006,Prüfungsausschuss Management and Engineering in Water (MME-Water) -SD3000,Studiendekan -KO4004,Haushaltskommission -KO4005,Strategiekommission -KO4006,Kommission für Qualitätsverbesserungsmittel -PD4002,Prodekan für Finanzen -KO5003,Studienbeirat -KO5005,Promotionsausschuss -FS5100,Fachgruppensprecher der Fachgruppe für Rohstoffe und Entsorgungstechnik -KO5101,Fachgruppenrat -KO5102,Qualitätsverbesserungskommission -FS5200,Fachgruppensprecher -KO5201,Fachgruppenrat -FS5300,Fachgruppensprecher -KO5302,Strukturausschuss -FR6000,Fakultätsrat -SD6000,Studiendekan -KO7005,Kommission für Evaluierung -KO7006,Kommission für Bibliotheksfragen -KO7009,Ausschuss für Graduiertenförderung -PA7001,Fakultätsprüfungsausschuss -PA7002,Prüfungsausschuss Lehramt -DK7000,Dekan/in -SD7000,Prodekan für Lehre -740000,Historisches Institut -770000,Politische Wissenschaft -780000,Theologie -730000,Institut für Erziehungswissenschaft -720000,Institut für Psychologie -KO9004,Fakultätskommission für Struktur und Entwicklung -KO9005,Studienbeirat -KO9006,Habilitationskommission -KO9007,Bibliothekskommision -KO9008,Kommission zur Qualitätsverbesserung in Lehre und Studium -SD9000,Prodekan für Studium und Lehre -900001,AIXTRA - Skillslab (Aachener interdisziplinäres Trainingszentrum für medizinische Ausbildung) -900002,AVMZ (Audiovisuelles Medienzentrum) -60930,Fachschaft Logopädie -934510,Klinik und Lehrstuhl für Nuklearmedizin -937310,Klinik und Lehrstuhl für Plastische Chirurgie, Hand- und Verbrennungschirurgie -80014,AZL - Aachener Zentrum für Integrativen Leichtbau -800005,Studienberatung und Prüfungsmanagement -800004,Fachbereichsbibliothek -800006,Wirtschaftsdidaktik -618620,Lehr- und Forschungsgebiet für Alterungsprozesse und Lebensdauerprognose von Batterien (FZ Jülich) -PA1302,Prüfungsausschuss Materialwissenschaften M. Sc. -154005,Institut für Technische und Makromolekularen Chemie -FS1600,Fachgruppensprecher der Fachgruppe Biologie -KO1601,Fachkommission Biologie -PA1601,Prüfungsausschuss der Studiengänge der Fachgruppe Biologie -161001,Botanischer Garten -218010,Lehrstuhl und Institut für Kunstgeschichte -617120,Lehr- und Forschungsgebiet für Informationstheorie und Systematischer Entwurf von Kommunikationssystemen -FR2000,Fakultätsrat -PD2000,Prodekanin -SD2000,Studiendekanin -FR3000,Fakultätsrat -DK3000,Dekan/in -KO3002,Ausschuss für Gleichstellung -KO3003,Habilitationskommission -KO3004,Kommission für Qualitätsverbesserung in Lehre und Studium -PA3001,Prüfungsausschuss Bauingenieurwesen -PA3003,Prüfungsausschuss Umweltingenieurwissenschaften -PD3000,Prodekan -FR4000,Fakultätsrat -KO4001,Ältestenrat -KO4002,Studienbeirat -KO4003,Evaluierungskommission -PA4001,Prüfungsausschuss Maschinenbau -DK4000,Dekan -SD4000,Prodekan für das Studium -PD4000,Prodekan, Stellvertreter des Dekans -PD4001,Prodekan für Strategie -FR5000,Fakultätsrat -KO5001,Ältestenrat -KO5002,Kommission für Infrastruktur -KO5004,Satzungskommission -PA5001,Prüfungsausschuss Fakultät 5 -DK5000,Dekan/in -PD5000,Prodekan -SD5000,Studiendekan -PA5101,Prüfungsausschuss B.Sc. Rohstoffingenieurwesen -KO5202,Qualitätsverbesserungskommission -PA5201,Prüfungsausschuss B.Sc. Werkstoffingenieurwesen -KO5301,Fachgruppenrat -KO5303,Qualitätsverbesserungskommission der Lehreinheit Geographie -PA5301,Prüfungsausschuss B.Sc. Angewandte Geowissenschaften -KO6001,Ältestenrat -KO6002,Studienbeirat -KO6003,Kommission für Struktur und Haushalt -KO6004,Qualitätsverbesserungskommission -PA6001,Prüfungsausschuss Elektrotechnik, Informationstechnik und Technische Informatik -DK6000,Dekan/in -PD6000,Prodekan -FR7000,Fakultätsrat -KO7001,Kommission für Struktur, Forschung und Wissenschaftlicher Nachwuchs -KO7002,Kommission für Haushalt und Finanzen -KO7003,Qualitätsverbesserungskommission -KO7004,Studienbeirat -KO7007,Promotionsausschuss -KO7008,Ausschuss für Verleihungen nach § 41 Hochschulgesetz -PA7003,Prüfungsausschuss Psychologie -PA7004,Prüfungsausschuss Lehr- und Forschungslogopädie -PD7000,Prodekan für Forschung -700001,Fachgruppe Literaturwissenschaft, Sprachwissenschaft, Philosophie -FS7100,Fachgruppensprecher -710000,Institut für Philosophie -760000,Soziologie -790000,Sprachwissenschaften -761310,Lehrstuhl für Soziologie mit dem Schwerpunkt Technik- und Organisationssoziologie -417200,Werkzeugmaschinenlabor WZL der RWTH Aachen -412010,Chair for Wind Power Drives -412110,Lehrstuhl für Technische Thermodynamik und Institut für Thermodynamik -412510,Lehrstuhl für Kraftwerkstechnik, Dampf- und Gasturbinen und Institut für Dampf- und Gasturbinen -PA1501,Prüfungsausschuss Chemie -FS1500,Fachgruppensprecher der Fachgruppe Chemie -152003,Institut für Organische Chemie -153005,Institut für Physikalische Chemie -KO1602,Kommission zur Qualitätsverbesserung in Lehre und Studium -420520,Lehr- und Forschungsgebiet Modellierung in der elektrochemischen Verfahrenstechnik (FZ Jülich) -214220,Lehr- und Forschungsgebiet Immobilienprojektentwicklung -10030,Kanzlervertreter -316320,Lehr- und Forschungsgebiet für Hochleistungsrechnen ingenieurmäßiger Modelle -1600,Senat -415110,Lehrstuhl für Strömungslehre und Aerodynamisches Institut -932110,Klinik und Lehrstuhl für Innere Medizin (mit dem Schwerpunkt Kardiologie und Pneumologie) -511110,Lehrstuhl für Nachhaltige Rohstoffgewinnung und Institut für Rohstoffingenieurwesen -512220,Lehr- und Forschungsgebiet Technologie der Energierohstoffe -521420,Lehr- und Forschungsgebiet Metallische Strukturen und Werkstoffsysteme für die Luft- und Raumfahrt -524210,Lehrstuhl für Werkstoff- und Prozesstechnik - Glas und Verbundwerkstoffe und Institut für Gesteinshüttenkunde -524110,Lehrstuhl für Keramik und feuerfeste Werkstoffe und Institut für Gesteinshüttenkunde -524630,Juniorprofessur für Werkstoffmodellierung - atomare Ordnungshierarchien -525110,Lehrstuhl für Hochtemperaturtechnik und Institut für Industrieofenbau und Wärmetechnik -524205,Institut für Gesteinshüttenkunde -532410,Lehrstuhl für Geologie, Geochemie und Lagerstätten des Erdöls und der Kohle -542110,Lehrstuhl und Institut für Kristallographie (N.N.) -542220,Lehr- und Forschungsgebiet Angewandte Kristallographie und Mineralogie -134030,Juniorprofessur für Experimentalphysik -PA7017,Studiengang Geschichte -PA7014,Studiengang Deutsch -118110,Lehrstuhl für Mathematics of Uncertainty Quantification -1603,AEGEE-Aachen e.V. -1658,IAESTE LC Aachen e.V. -1660,Aachener Studentenorchester e.V. -1848,Ecurie Aix Formula Student Team RWTH Aachen e.V. -1921,Philou. e.V. -1945,VWI - HG Aachen e.V. -1960,STARRING Aachen e.V. -937510,Klinik und Lehrstuhl für Zahnerhaltung -1905,Verband der Chinesischen Wissenschaftler und Studenten in Aachen (VCWSA) e.V. -2024,Floodlight Musicals e.V. -2057,AIAS Aachen -2065,Sektion der EESTEC für Aachen e.V. -2078,Effective Altruism Aachen e.V. -2090,Collective Incubator e.V. -931820,Lehr- und Forschungsgebiet Pränatalmedizin -934120,Lehr- und Forschungsgebiet Bildgebung bei neurodegenerativen Erkrankungen -111520,Lehr- und Forschungsgebiet Mathematik und Abteilung für Numerische Mathematik -124510,Lehrstuhl für Informatik 5 (Informationssysteme und Datenbanken) -122110,Lehrstuhl für Informatik 7 (Logik und Theorie diskreter Systeme)(N.N.) -123720,Lehr- und Forschungsgebiet Informatik 8 (Computer Vision) -122710,Lehrstuhl für Informatik 10 (Medieninformatik und Mensch-Computer-Interaktion) -131410,Lehrstuhl für Experimentalphysik I B und I. Physikalisches Institut -135820,Lehr- und Forschungsgebiet Theoretische Physik (Theorie der kondensierten Materie) -135130,Juniorprofessur für Theoretische Nanoelektronik -GS0003,Wahlprüfungsausschuss -GS0004,Gleichstellungskommission -GS0005,Kommission zur Qualitätsverbesserung in Lehre und Studium -GS0006,Kommission für Struktur, Finanz- und Bauangelegenheiten -GR0003,Kommission zur Aufklärung wissenschaftlichen Fehlverhaltens -GR0004,Bürgerforum RWTH-extern -GR0005,Steuerungsgruppe für die Universitätsbibliothek -GR0006,Steuerungsgruppe für das IT Center -GR0007,Steuerungsgruppe für das Hochschulsportzentrum -GR0008,Steuerungsgruppe für das Gemeinschaftslabor für Elektronenmikroskopie -GR0009,Beirat für das Sprachenzentrum -GR0010,Steuerungsgruppe für das Zentrum für Lern- und Wissensmanagement -GS0007,Vergabekommission (Förderung des wiss. Nachwuchses) -GR0012,Internetbeirat -GB0370,Gleichstellungsbeauftragte -136620,Lehr- und Forschungsgebiet Theoretische Physik (N.N.) -135620,Lehr- und Forschungsgebiet Theoretische Physik (kondensierte Materie) -KO8008,Kommission für Promotion -KO8009,Bibliothekskommission -KO8010,Kommission für Internationales -KO8013,Kommission für E-Learning -KO8012,Kommission für Ehrungen -KO8014,Kommission für Graduiertenförderung -PD8000,Prodekan -DK8000,Dekan/in -SD8000,Studiendekan -152310,Lehrstuhl für Organische Chemie II und Institut für Organische Chemie -152510,Lehrstuhl für Organische Chemie III und Institut für Organische Chemie -152820,Lehr- und Forschungsgebiet Synthetische Organische Chemie -155220,Lehr- und Forschungsgebiet Funktionale und interaktive Polymere -124720,Lehr- und Forschungsgebiet Computer Animation -GS0001,Ältestenrat -GS0002,Satzungskommission -GR0011,Gremien Zentrumsrat des Lehrerbildungszentrums -GR0001,Kommission für Qualitätsmanagement in der Lehre -GR0002,Strategierat -10841,Verbundausbildung -111730,Juniorprofessur für Optimierung mit partiellen Differentialgleichungen -80043,JARA-Institut FIT Quantum Information -80044,JARA-Institut FIT Green IT -139430,Juniorprofessur für Experimentalphysik -151920,Lehr- und Forschungsgebiet Bioanorganische Chemie -155001,Mechanikwerkstatt IAC/IPC -771510,Lehrstuhl für Zukunftsforschung -792630,Juniorprofessur für Sprachwissenschaft und kognitive Semiotik (HumTec) -793300,Geschäftsführung Anglistik, Amerikanistik und Romanistik -800008,Medien für die Lehre -1434,SignGes Kompetenzzentrum für Gebärdensprache und Gestik der RWTH Aachen -112620,Lehr- und Forschungsgebiet Optimierung mit partiellen Differentialgleichungen -115020,Lehr- und Forschungsgebiet Simulation in der Kerntechnik (N.N) -KO8006,Dauerstellenkommission -KO8007,Zwischenevaluierungskommission -PA8002,Prüfungsausschuss Betriebswirtschaftslehre (M. Sc.) -KO8001,Ältestenrat -KO8004,Kommission für Struktur, Forschung, wissenschaftlicher Nachwuchs und Evaluierung -KO8005,Kommission zur Qualitätsverbesserung in der Lehre -KO9010,Promotionsausschuss -KO9011,Habilitationsausschuss -PA9005,Prüfungsausschuss Lasers in Dentistry -PA9006,Prüfungsausschuss Laboratory Animal Science -900006,Clinical Trials Center Aachen (CTC-A) -900005,Biomaterialbank -900008,Medizinische Bibliothek -900010,Wissenschaftliche Werkstatt -934910,Klinik und Lehrstuhl für Psychiatrie, Psychotherapie und Psychosomatik -11020,Abteilung 10.2 - Baumanagement -939020,Lehr- und Forschungsgebiet Gynäkologische Onkologie -161100,Institut für Biologie I (Botanik) -161500,Institut für Biologie III (Pflanzenphysiologie) -135500,Institut für Theoretische Festkörperphysik -616810,Lehrstuhl für Radar-Systemtechnik -124170,Virtual Reality Group -138530,Juniorprofessur für Theoretische Physik (FZ Jülich) -421620,Lehr- und Forschungsgebiet Mess- und Prüfverfahren in der Fügetechnik -791820,Lehr- und Forschungsgebiet Europäisch-jüdische Literatur- und Kulturgeschichte -761110,Lehrstuhl für Soziologie -800000,Fakultät für Wirtschaftswissenschaften -115120,Lehr- und Forschungsgebiet Mathematik, insb. Computational Mathematics -KO8002,Studienbeirat -KO8003,Kommission für Haushaltsplanung und Finanzen -121220,Lehr- und Forschungsgebiet Theoretische Informatik -124430,Juniorprofessur für Algorithmen zur Gittergenerierung und -Optimierung -152110,Lehrstuhl für Organische Chemie I und Institut für Organische Chemie -154510,Lehrstuhl für Technische Chemie und heterogene Katalyse u. Institut für Brennstoffchemie und physikalisch-chemische Verfahrenstechnik (N.N.) -161110,Lehrstuhl für Botanik und Institut für Biologie I (Botanik) -153510,Lehrstuhl für Makromolekulare Materialien und Oberflächen (Physikalische Chemie) (N.N.) -135001,Theoretische Physik allgemein -154330,Juniorprofessur für Mechanismen in der Katalyse -160001,Biologie allgemein -416410,Lehrstuhl für Lehrstuhl für Prozesstechnik -420010,Lehrstuhl für Chemische Verfahrenstechnik -522000,Zentrale Einrichtungen der Eisenhüttenkunde -600004,Praktikantenamt der Fakultät für Elektrotechnik -615110,Lehrstuhl für Betriebssysteme -114820,Lehr- und Forschungsgebiet Mathematik (Algebra) -117220,Lehr- und Forschungsgebiet Mathematische Grundlagen der Informatik (Logik und Komplexität) -121420,Lehr- und Forschungsgebiet Informatik 2 (Programmiersprachen und Verifikation) -122010,Lehrstuhl für Informatik 6 (Sprachverarbeitung und Mustererkennung) -122810,Lehrstuhl für Informatik 11 (Embedded Software) -123120,Lehr- und Forschungsgebiet Informatik 12 (Software und Werkzeuge für Computational Engineering) -131820,Lehr- und Forschungsgebiet Physik -PA6002,Prüfungsausschuss Wirtschaftsingenieurwesen Fachrichtung Elektrische Energietechnik -PA6003,Prüfungsausschuss Lehramtsstudiengänge -751210,Lehrstuhl für Methodik und Theorie computerbasierter Geistes- und Sozialwissenschaften -PA5202,Prüfungsausschuss M.Sc. Werkstoffingenieurwesen -PA5203,Prüfungsausschuss M.Sc. Metallurgical Engineering -PA5302,Prüfungsausschuss M.Sc. Angewandte Geowissenschaften -PA5303,Prüfungsausschuss B.Sc. Georessourcenmanagement -PA5304,Prüfungsausschuss M.Sc. Georessourcenmanagement -53500,Fraunhofer-Institut für Hochfrequenztechnik -51600,RWTH Aachen Business School GmbH -PA7005,Studiengang Technik-Kommunikation -925310,Institut und Lehrstuhl für Computational Biomedicine II -10013,Arbeits- und Strahlenschutz -11100,Dezernat 11.0 - Infrastruktur -791000,Institut für Germanistische und Allgemeine Literaturwissenschaft -618830,Juniorprofessur für Biomedizinische Bildverarbeitung -164620,Lehr- und Forschungsgebiet Funktionale Epigenetik im Tiermodell -156510,Lehrstuhl für Technische Chemie und Petrolchemie -134005,III. Physikalisches Institut B -2069,Akademischer Seglerverein der RWTH in Aachen e.V. -10540,Abteilung 5.4 - Web-Anwendungen -939510,Lehrstuhl für Invasive Elektrophysiologie -PA7018,Studiengang Katholische Religionslehre -PA7020,Studiengang Spanisch -PA7019,Studiengang Politik -PA7013,Studiengang Bildungswissenschaftliches Studium -721720,Lehr- und Forschungsgebiet Psychologie mit dem Schwerpunkt Auditive Kognition -781520,Lehr- und Forschungsgebiet Grenzfragen von Theologie, Naturwissenschaft und Technik -1702,Interkulturelles Centrum Aachener Studierender e.V. -316710,Lehrstuhl für Nachhaltigkeit im Bauwesen -1745,Nightline Aachen e.V. -1889,PPI AACHEN e.V. -1915,Förderer der Energie- und Informationstechnik für zukunftsfähige Netze Aachen e. V. -1970,Kowi Aachen e.V. -1994,MX AIX e.V. -2000,Bläserphilharmonie Aachen e.V. -2003,mündigmacher e.V. -2006,Association des Camerounais d'Aix-La-Chapelle e.V. -RB0001,Beauftragter für die Zusammenarbeit mit der Thai-German Graduate School of Engineering (TGGS), Thailand -2026,Energybirds e.V. -2056,studentischer Automobilverband Aachen e.V. -2068,Chinese-German Society Aachen e.V. -2083,Aachen hat Ausdauer e.V. -211510,Lehrstuhl für Individualisierte Bauproduktion -311100,Bauforschung -711000,Philosophisches Institut Geschäftsführung -711110,Lehrstuhl für Praktische Philosophie -741000,Historisches Institut Geschäftsführung -761000,Geschäftsführung Soziologie -311110,Lehrstuhl für Baustoffkunde -PA3008,Prüfungsausschuss Sustainable Management in Water and Energy (SuMWE) -KO3008,Fakultäts-Tenure-Kommission -112710,Lehrstuhl für Mathematik A (Analysis) -156210,Lehrstuhl der Organischen Synthese -136020,Lehr- und Forschungsgebiet Theoretische Quantentechnologie -156420,Lehr- und Forschungsgebiet Polymere Biomaterialien (DWI) -PA7021,Prüfungsausschuss Lehramt übergreifend -1630,Iranian Student Association Aachen -1754,Aachener Studentenchor der KHG e.V. -1758,aixsolution e.V. -1805,TEDxClub RWTH Aachen e.V. -1825,Ingenieure ohne Grenzen e.V. -132620,Lehr- und Forschungsgebiet für Physik photonischer Bauelemente (FZ Jülich) -139720,Lehr- und Forschungsgebiet Experimentelle Physik - Symmetriebrechung (FZ Jülich) -613620,Lehr- und Forschungsgebiet für Medizinische Akustik -80051,Projekthaus Turbomachinery Manufacturing -1210,Lehrerbildungszentrum -PA8004,Prüfungsausschuss Wirtschaftsingenieurwesen Fachrichtung Bauingenieurwesen, Elektrische Energietechnik, Werkstoff- und Prozesstechnik (B. Sc.) -PA8005,Prüfungsausschuss Wirtschaftswissenschaft (M. Sc.) -RB0019,Vertrauensperson zur Sicherung guter wissenschaftlicher Praxis an der RWTH -RB0020,Beauftragter für die Lehramtsausbildung -RB0021,Beauftragter für das Projekt Leonardo -RB0028,Beauftragte für Socially Responsible Education -RB0029,Beauftragter für die Zusammenarbeit mit dem Israel-Institut für Technologie, Haifa/Israel -PA4005,Prüfungsausschuss Automatisierungstechnik -421710,Lehrstuhl für Soft Matter Process Engineering -923510,Institut und Lehrstuhl für Angewandte Medizintechnik -931310,Klinik und Lehrstuhl für Allgemein-, Viszeral- und Transplantationschirurgie -933410,Lehrstuhl für Allgemeine Pädiatrie -936710,Klinik und Lehrstuhl für Thorax-, Herz- und Gefäßchirurgie -PA1001,Prüfungsausschuss für Lehramtsstudiengänge und Zwischenprüfungen -935730,Juniorprofessur für Soziale und Affektive Neurowissenschaften -80053,Sonstiger Forschungsbereich Forschungskolleg VERBUND.NRW -781000,Geschäftsführung Katholische Theologie -155910,Lehrstuhl für Makromolekulare Chemie II -132730,Juniorprofessur für Theoretische Astroteilchenphysik und Kosmologie -960000,Uniklinik -VO9610,Vorstand -962001,Unternehmenskommunikation -962002,Medizinische strategische Unternehmensentwicklung -962003,Projektmanagement -962004,Medizinisches Controlling -962005,Vorstandsbüro -962006,Strategisches Baumanagement -136930,Juniorprofessur für Theorie neuronaler Netzwerke -10620,Abteilung 6.2 - Lehre -11023,Sachgebiet Bauwerkstatt -PA8001,Prüfungsausschuss Betriebswirtschaftslehre (B. Sc.) -PA8003,Prüfungsausschuss Lehramt Wirtschaftswissenschaften (B. Sc., M. Ed., Staatsexamen) -KO2004,Raumkommission -KO2006,Kommission für Außendarstellung -KO2007,Kommission zur Überarbeitung der Fakultätsordnung -KO2008,Promotionsausschuss -KO2009,Graduiertenkommission -KO2010,Bibliothekskommission -KO2011,Strategiekommission -KO3007,Studienbeirat -PA3007,Prüfungsausschuss Management and Engineering in Structual Engineering and Risk Management of Industrial Facilities (MME-Construct) -312800,Institut für Stahlbau -RB0007,Beauftragter für die Zusammenarbeit mit dem Land Korea -RB0010,Rektoratsbeauftragter für die Zusammenarbeit mit der KIC Raw Materials (Knowledge and Innovation Community) -RB0013,Beauftragter für die wirtschaftliche Zusammenarbiet mit dem Land Türkei -RB0014,Beauftragter für die Wissenschaftsstadt Aachen -RB0015,Beauftragte für wissenschaftliche Sammlungen -RB0016,Beauftragter für die Vertretung im Wissenschaftlich-Technischen Rat (WTR) des FZ Jülich -RB0022,Beauftragter für RWTH-extern - Das Bürgerforum -RB0023,Beauftragter für das Kuratorium der Friedrich-Wilhelm-Stiftung -RB0024,Beauftragter für Blended Learning -RB0025,Vertrauensdozent für Angelegenheiten der Deutschen Forschungsgemeinschaft (DFG) -RB0026,Beauftragter für das Hochschulsportzentrum und den Spitzensport -RB0027,Beauftragter für die Zusammenarbeit mit dem Land Brasilien -FS7200,Fachgruppensprecher -FS7300,Fachgruppensprecher -41880,Sonderforschungsbereich SFB/Transregio 188 Schädigungskontrollierte Umformprozesse -KO1202,Kommission zur Qualitätsverbesserung in Lehre und Studium -KO1204,Fachkommission -741820,Lehr- und Forschungsgebiet Wissensdiskurse des Mittelalters -KO8019,VKS – Vergabekommission Studienbei-tragsersatzmittel (Qualitätsverbesserungskommission) -KO8020,Raumvergabeausschuss -PA4002,Prüfungsausschuss Wirtschaftsingenieurwesen Fachrichtung Maschinenbau -PA4003,Prüfungsaussuss Computational Engineering Science -PA4004,Prüfungsausschuss Simulation Sciences -KO1008,Promotionsausschuss -933330,Juniorprofessur für Computerbasierte Molekulare Wissenschaft (FZ Jülich) -KO1203,Professorium -133920,Lehr- und Forschungsgebiet Experimentalphysik -938920,Lehr- und Forschungsgebiet Translationale Nuklearmedizin -526720,Lehr- und Forschungsgebiet Werkstoffmechanik von Energiewerkstoffen -618710,Lehrstuhl für Elektronische Bauelemente -117320,Lehr- und Forschungsgebiet Mathematical Data Science -962007,Interne Revision -964001,Geschäftsbereich Betriebe -964002,Geschäftsbereich Finanzmanagement -964003,Geschäftsbereich Gebäudetechnik -964006,Geschäftsbereich Materialwirtschaft, Apotheke -964007,Geschäftsbereich Patientenmanagement -965002,Schule für Kinderkranken- und Krankenpflege -965003,Schule für Logopädie -965004,Schule für med.-techn. Assistenten -965006,Schule für Physiotherapie -966002,Physiotherapie -966003,Transfusionsmedizin -965008,Casemanagement -900009,Veranstaltungstechnik -921010,Institut und Lehrstuhl für Neuroanatomie -924610,Institut und Lehrstuhl für Humangenetik -924720,Institut und Lehr- und Forschungsgebiet Biochemie und Molekulare Immunologie -933110,Klinik und Lehrstuhl für Innere Medizin (mit dem Schwerpunkt Onkologie und Hämatologie) -933510,Klinik und Lehrstuhl für Kinderkardiologie mit Schwerpunkt Interventionelle Elektrophysiologie -211710,Lehrstuhl für Gebäudetechnologie -217220,Lehr- und Forschungsgebiet Denkmalpflege und Historische Bauforschung -212320,Lehr- und Forschungsgebiet Raumgestaltung -412330,Juniorprofessur für Mechatronische Systeme am Verbrennungsmotor -415310,Lehrstuhl und Institut für Luft- und Raumfahrtsysteme (ILR) -542420,Lehr- und Forschungsgebiet Biokristallographie (FZ Jülich) -600000,Fakultät für Elektrotechnik und Informationstechnik -611610,Lehrstuhl für Werkstoffe der Elektrotechnik II und Institut für Werkstoffe der Elektrotechnik -793220,Lehr- und Forschungsgebiet Englischsprachige Literatur- und Kulturwissenschaft mit dem Schwerpunkt Kognition (N.N.) -811110,Lehrstuhl für Computational Economics -10520,Abteilung 5.2 - SAP - Entwicklung und Betrieb -421510,Lehrstuhl für Digitale Additive Produktion -416100,Aachener Verfahrenstechnik -962008,OP-Management -962009,Krankenhaushygiene und Infektologie -963001,Personalvertretung -963002,Gleichstellungsbeauftragte -963003,Schwerbehindertenvertretung -964004,Geschäftsbereich IT -964005,Geschäftsbereich Kaufmännisches Controlling -964008,Geschäftsbereich Personal -964009,Geschäftsbereich Recht -965001,Pflegedienstleistung -965005,Schule für OP-techn. Assistenten -965007,Belegungsmanagement -965009,Sozialdienst -965010,Diät- und Ernährungsberatung -965011,Zentralsterilisation -966001,Notaufnahme -900007,Ethikkommission -900004,AIXTRA Dental -151310,Lehrstuhl für Anorganische Chemie und Elektrochemie und Institut für Anorganische Chemie -155120,Lehr- und Forschungsgebiet Niederfeld-NMR (Methoden der NMR) (FZ Jülich) -162220,Lehr- und Forschungsgebiet Entwicklungsbiologie und Morphologie der Tiere -162910,Lehrstuhl für Molekulare Biotechnologie -163620,Lehr- und Forschungsgebiet Didaktik der Biologie und Chemie (N.N.) -417510,Lehrstuhl für Fertigungsmesstechnik und Qualitätsmanagement -415530,Juniorprofessur für Physico-Chemical Fundamentals of Combustion -521220,Lehr- und Forschungsgebiet Werkstoffanalytik -551610,Lehrstuhl für Physische Geographie und Geoökologie -551820,Lehr- und Forschungsgebiet Kulturgeographie -711210,Lehrstuhl für Wissenschaftstheorie und Technikphilosophie und Philosophisches Institut -761420,Lehr- und Forschungsgebiet Soziologie mit dem Schwerpunkt Methoden der empirischen Sozialforschung -781420,Lehr- und Forschungsgebiet für Religionspädagogik -721220,Lehr- und Forschungsgebiet Arbeits- und Kognitionspsychologie -813110,Lehrstuhl für Wirtschaftswissenschaften für Ingenieure und Naturwissenschaftler -811320,Lehr- und Forschungsgebiet Empirische Wirtschaftsforschung -816520,Lehr- und Forschungsgebiet Technologieorientiertes Unternehmertum -816830,Juniorprofessur für Decision Analysis -11032,Sachgebiet HKL (einschl. Klima, Kälte, Wärme) -11036,Sachgebiet Energiemanagement u. techn. Projektk -137810,Lehrstuhl für Theoretische Biophysik -151910,Lehrstuhl für Bioanorganische Chemie und Institut für Anorganische Chemie -152720,Lehr- und Forschungsgebiet Organische Chemie -153220,Lehr- und Forschungsgebiet Molekülspektroskopie -155310,Lehrstuhl für Heterogene Katalyse und Technische Chemie -163020,Lehr- und Forschungsgebiet Molekulare Sinnes- und Neurobiologie (FZ Jülich) -161620,Lehr- und Forschungsgebiet Biochemie und Molekularbiologie der Pflanzen -934310,Lehr- und Forschungsgebiet für Neurobiologische Forschung -614110,Lehrstuhl und Institut für Elektrische Anlagen und Energiewirtschaft -614210,Lehrstuhl und Institut für Hochspannungstechnik -617230,Juniorprofessur für Mixed Signal CMOS Circuits -611910,Lehrstuhl für Software für Systeme auf Silizium -11043,Sachgebiet Förderanlagen -10018,Datenschutzbeauftragter -32000,Personalrat der wissenschaftlich, ärztlich und künstlerisch Beschäftigten der RWTH Aachen -60530,Fachschaft Geowissenschaften und Ressourcenmanagement -61000,ErstsemesterInnenprojekt der Fachschaften der RWTH Aachen e. V. -RB0002,Beauftragter für das Land Indien -RB0003,Beauftragter für die Zusammenarbeit mit den Ländern USA und Kanada -RB0004,Beauftragter für UNITECH International -RB0005,Beauftragter für die Zusammenarbeit mit dem Land China -RB0006,Beauftragter für die Zusammenarbeit mit japanischen Hochschulen -RB0008,Beauftragter für EU- Forschungsförderung -311100,Institut für Baustoffforschung -312720,Lehr- und Forschungsgebiet Nachhaltigkeit im Metallleichtbau -314310,Lehrstuhl für Geotechnik im Bauwesen und Institut für Grundbau, Bodenmechanik, Felsmechanik und Verkehrswasserbau -314410,Lehrstuhl und Institut für Wasserbau und Wasserwirtschaft -419010,Lehrstuhl für Oberflächentechnik im Maschinenbau -417610,Lehrstuhl und Institut für Schweißtechnik und Fügetechnik -417810,Lehrstuhl für Kunststoffverarbeitung -412810,Lehrstuhl und Institut für fluidtechnische Antriebe und Systeme -416010,Lehrstuhl für Computergestützte Analyse technischer Systeme -420410,Lehrstuhl für Computational Systems Biotechnology (FZ Jülich) -421430,Juniorprofessur für Microscale Bioengineering (FZ Jülich) -510001,Zentralwerkstatt -512410,Lehrstuhl für Nukleare Entsorgung und Techniktransfer (N.N.) -513410,Lehrstuhl für Entsorgung nuklearer Abfälle (FZ Jülich) -11111,Sachgebiet Parkraumbewirtschaftung, Objektschutz und zentrale Abteilungsdienste -KO8015,Promotionsausschuss -KO8016,Habilitationsausschuss -KO8017,AG START -KO8018,Gutachtergremium Innovative Lehrprojekte -RB0009,Rektoratsbeauftragter für die Zusammenarbeit mit der KIC InnoLife (Knowledge and Innovation Community) -RB0011,Beauftragter für die Zusammenarbeit mit den Arabischen Staaten -RB0012,Beauftragter für die Zusammenarbeit mit Russland -RB0017,Beauftragter für die Zusammenarbeit der Hochschulen im belgisch-deutsch-niederländischen Raum -RB0018,Beauftragter für Alumni \ No newline at end of file diff --git a/src/Migrator/Assets/Licenses.rdf b/src/Migrator/Assets/Licenses.rdf deleted file mode 100644 index 49890c7..0000000 --- a/src/Migrator/Assets/Licenses.rdf +++ /dev/null @@ -1,101 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"> - - <rdf:Description rdf:about="https://spdx.org/licenses/Apache-2.0"> - <rdf:about>https://spdx.org/licenses/Apache-2.0</rdf:about> - <rdfs:label xml:lang="en">Apache License 2.0</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - - <rdf:Description rdf:about="https://spdx.org/licenses/GPL-3.0+"> - <rdf:about>https://spdx.org/licenses/GPL-3.0+</rdf:about> - <rdfs:label xml:lang="en">GNU General Public License v3.0</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - - <rdf:Description rdf:about="https://spdx.org/licenses/MIT"> - <rdf:about>https://spdx.org/licenses/MIT</rdf:about> - <rdfs:label xml:lang="en">MIT License</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - - <rdf:Description rdf:about="https://spdx.org/licenses/BSD-2-Clause"> - <rdf:about>https://spdx.org/licenses/BSD-2-Clause</rdf:about> - <rdfs:label xml:lang="en">BSD 2-clause 'Simplified' License</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - - <rdf:Description rdf:about="https://spdx.org/licenses/BSD-3-Clause"> - <rdf:about>https://spdx.org/licenses/BSD-3-Clause</rdf:about> - <rdfs:label xml:lang="en">BSD 3-clause 'New' or 'Revised' License</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - - <rdf:Description rdf:about="https://spdx.org/licenses/EPL-1.0"> - <rdf:about>https://spdx.org/licenses/EPL-1.0</rdf:about> - <rdfs:label xml:lang="en">Eclipse Public License 1.0</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - - <rdf:Description rdf:about="https://spdx.org/licenses/GPL-3.0"> - <rdf:about>https://spdx.org/licenses/AGPL-3.0</rdf:about> - <rdfs:label xml:lang="en">GNU Affero General Public License v3.0</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - - <rdf:Description rdf:about="https://spdx.org/licenses/GPL-2.0"> - <rdf:about>https://spdx.org/licenses/GPL-2.0</rdf:about> - <rdfs:label xml:lang="en">GNU General Public License v2.0</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - - <rdf:Description rdf:about="https://spdx.org/licenses/LGPL-2.1"> - <rdf:about>https://spdx.org/licenses/LGPL-2.1</rdf:about> - <rdfs:label xml:lang="en">GNU Lesser General Public License v2.1</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - - <rdf:Description rdf:about="https://spdx.org/licenses/LGPL-3.0"> - <rdf:about>https://spdx.org/licenses/LGPL-3.0</rdf:about> - <rdfs:label xml:lang="en">GNU Lesser General Public License v3.0</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - - <rdf:Description rdf:about="https://spdx.org/licenses/MPL-2.0"> - <rdf:about>https://spdx.org/licenses/MPL-2.0</rdf:about> - <rdfs:label xml:lang="en">Mozilla Public License 2.0</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - - <rdf:Description rdf:about="https://spdx.org/licenses/Unlicense"> - <rdf:about>https://spdx.org/licenses/Unlicense</rdf:about> - <rdfs:label xml:lang="en">The Unlicense</rdfs:label> - <rdf:resource>http://purl.org/dc/terms/LicenseDocument</rdf:resource> - <rdf:resource>http://purl.org/dc/terms/RightsDocument</rdf:resource> - <rdf:type rdf:resource="https://spdx.org/licenses/"/> - </rdf:Description> - -</rdf:RDF> \ No newline at end of file diff --git a/src/Migrator/Assets/dfg_structure.rdf b/src/Migrator/Assets/dfg_structure.rdf deleted file mode 100644 index 2af0969..0000000 --- a/src/Migrator/Assets/dfg_structure.rdf +++ /dev/null @@ -1,2138 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" -xmlns:dcterms="http://purl.org/dc/terms/" -xmlns:skos="http://www.w3.org/2004/02/skos/core#"> - -<skos:ConceptScheme rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"> - <rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#ConceptScheme"/> - <dcterms:title>DFG Fachsystematik</dcterms:title> - <skos:hasTopConcept rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher"/> -</skos:ConceptScheme> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher"> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:prefLabel xml:lang="de">DFG Fachsystematik</skos:prefLabel> - <skos:notation>---</skos:notation> - <skos:prefLabel xml:lang="en">DFG Structure</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>1</skos:notation> - <skos:prefLabel xml:lang="de">Geistes- und Sozialwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Humanities and Social Sciences</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=101"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>101</skos:notation> - <skos:prefLabel xml:lang="de">Alte Kulturen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Ancient Cultures</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=101#101-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=101"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>101-01</skos:notation> - <skos:prefLabel xml:lang="de">Ur- und Frühgeschichte (weltweit)</skos:prefLabel> - <skos:prefLabel xml:lang="en">Prehistory</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=101#101-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=101"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>101-02</skos:notation> - <skos:prefLabel xml:lang="de">Klassische Philologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Classical Philology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=101#101-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=101"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>101-03</skos:notation> - <skos:prefLabel xml:lang="de">Alte Geschichte</skos:prefLabel> - <skos:prefLabel xml:lang="en">Ancient History</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=101#101-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=101"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>101-04</skos:notation> - <skos:prefLabel xml:lang="de">Klassische Archäologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Classical Archaeology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=101#101-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=101"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>101-05</skos:notation> - <skos:prefLabel xml:lang="de">Ägyptische und Vorderasiatische Altertumswissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Egyptology and Ancient Near Eastern Studies</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=102"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>102</skos:notation> - <skos:prefLabel xml:lang="de">Geschichtswissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">History</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=102#102-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=102"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>102-01</skos:notation> - <skos:prefLabel xml:lang="de">Mittelalterliche Geschichte</skos:prefLabel> - <skos:prefLabel xml:lang="en">Medieval History</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=102#102-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=102"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>102-02</skos:notation> - <skos:prefLabel xml:lang="de">Frühneuzeitliche Geschichte</skos:prefLabel> - <skos:prefLabel xml:lang="en">Early Modern History</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=102#102-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=102"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>102-03</skos:notation> - <skos:prefLabel xml:lang="de">Neuere und Neueste Geschichte (einschl. Europäische Geschichte der Neuzeit und Außereuropäische Geschichte)</skos:prefLabel> - <skos:prefLabel xml:lang="en">Modern and Current History</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=102#102-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=102"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>102-04</skos:notation> - <skos:prefLabel xml:lang="de">Wissenschaftsgeschichte</skos:prefLabel> - <skos:prefLabel xml:lang="en">History of Science</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=103"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>103</skos:notation> - <skos:prefLabel xml:lang="de">Kunst-, Musik-, Theater- und Medienwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Fine Arts, Music, Theatre and Media Studies</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=103#103-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=103"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>103-01</skos:notation> - <skos:prefLabel xml:lang="de">Kunstgeschichte</skos:prefLabel> - <skos:prefLabel xml:lang="en">Art History</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=103#103-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=103"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>103-02</skos:notation> - <skos:prefLabel xml:lang="de">Musikwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Musicology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=103#103-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=103"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>103-03</skos:notation> - <skos:prefLabel xml:lang="de">Theater- und Medienwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Theatre and Media Studies</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=104"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>104</skos:notation> - <skos:prefLabel xml:lang="de">Sprachwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Linguistics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=104#104-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=104"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>104-01</skos:notation> - <skos:prefLabel xml:lang="de">Allgemeine und Vergleichende Sprachwissenschaft, Typologie, Außereuropäische Sprachen</skos:prefLabel> - <skos:prefLabel xml:lang="en">General and Comparative Linguistics, Typology, Non-European Languages</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=104#104-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=104"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>104-02</skos:notation> - <skos:prefLabel xml:lang="de">Einzelsprachwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Individual Linguistics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=104#104-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=104"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>104-03</skos:notation> - <skos:prefLabel xml:lang="de">Historische Linguistik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Historical Linguistics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=104#104-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=104"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>104-04</skos:notation> - <skos:prefLabel xml:lang="de">Angewandte Sprachwissenschaften, Experimentelle Linguistik, Computerlinguistik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Applied Linguistics, Experimental Linguistics, Computational Linguistics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=105"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>105</skos:notation> - <skos:prefLabel xml:lang="de">Literaturwissenschaft</skos:prefLabel> - <skos:prefLabel xml:lang="en">Literary Studies</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=105#105-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=105"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>105-01</skos:notation> - <skos:prefLabel xml:lang="de">Ältere deutsche Literatur</skos:prefLabel> - <skos:prefLabel xml:lang="en">Medieval German Literature</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=105#105-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=105"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>105-02</skos:notation> - <skos:prefLabel xml:lang="de">Neuere deutsche Literatur</skos:prefLabel> - <skos:prefLabel xml:lang="en">Modern German Literature</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=105#105-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=105"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>105-03</skos:notation> - <skos:prefLabel xml:lang="de">Europäische und Amerikanische Literaturen</skos:prefLabel> - <skos:prefLabel xml:lang="en">European and American Literature</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=105#105-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=105"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>105-04</skos:notation> - <skos:prefLabel xml:lang="de">Allgemeine und vergleichende Literaturwissenschaft; Kulturwissenschaft</skos:prefLabel> - <skos:prefLabel xml:lang="en">General and Comparative Literature and Cultural Studies</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=106"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>106</skos:notation> - <skos:prefLabel xml:lang="de">Sozial- und Kulturanthropologie, Außereuropäische Kulturen, Judaistik und Religionswissenschaft</skos:prefLabel> - <skos:prefLabel xml:lang="en">Social and Cultural Anthropology, Non-European Cultures, Jewish Studies and Religious Studies</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=106#106-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=106"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>106-01</skos:notation> - <skos:prefLabel xml:lang="de">Ethnologie und Europäische Ethnologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Social and Cultural Anthropology and Ethnology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=106#106-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=106"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>106-02</skos:notation> - <skos:prefLabel xml:lang="de">Asienbezogene Wissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Asian Studies</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=106#106-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=106"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>106-03</skos:notation> - <skos:prefLabel xml:lang="de">Afrika-, Amerika- und Ozeanienbezogene Wissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">African, American and Oceania Studies </skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=106#106-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=106"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>106-04</skos:notation> - <skos:prefLabel xml:lang="de">Islamwissenschaften, Arabistik, Semitistik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Islamic Studies, Arabian Studies, Semitic Studies</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=106#106-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=106"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>106-05</skos:notation> - <skos:prefLabel xml:lang="de">Religionswissenschaft und Judaistik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Religious Studies and Jewish Studies</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=107"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>107</skos:notation> - <skos:prefLabel xml:lang="de">Theologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Theology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=107#107-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=107"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>107-01</skos:notation> - <skos:prefLabel xml:lang="de">Evangelische Theologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Protestant Theology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=107#107-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=107"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>107-02</skos:notation> - <skos:prefLabel xml:lang="de">Katholische Theologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Roman Catholic Theology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=108"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>108</skos:notation> - <skos:prefLabel xml:lang="de">Philosophie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Philosophy</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=108#108-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=108"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>108-01</skos:notation> - <skos:prefLabel xml:lang="de">Geschichte der Philosophie</skos:prefLabel> - <skos:prefLabel xml:lang="en">History of Philosophy</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=108#108-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=108"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>108-02</skos:notation> - <skos:prefLabel xml:lang="de">Theoretische Philosophie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Theoretical Philosophy</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=108#108-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=108"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>108-03</skos:notation> - <skos:prefLabel xml:lang="de">Praktische Philosophie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Practical Philosophy</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=109"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>109</skos:notation> - <skos:prefLabel xml:lang="de">Erziehungswissenschaft und Bildungsforschung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Educational Research</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=109#109-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=109"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>109-01</skos:notation> - <skos:prefLabel xml:lang="de">Allgemeine und Historische Pädagogik</skos:prefLabel> - <skos:prefLabel xml:lang="en">General Education and History of Education</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=109#109-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=109"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>109-02</skos:notation> - <skos:prefLabel xml:lang="de">Allgemeines und fachbezogenes Lehren und Lernen</skos:prefLabel> - <skos:prefLabel xml:lang="en">General and Domain-Specific Teaching and Learning</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=109#109-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=109"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>109-03</skos:notation> - <skos:prefLabel xml:lang="de">Bildungssysteme und Bildungsinstitutionen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Education Systems and Educational Institutions</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=109#109-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=109"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>109-04</skos:notation> - <skos:prefLabel xml:lang="de">Pädagogische Sozial- und Organisationsforschung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Educational Research on Socialization, Welfare and Organisations</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=110"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>110</skos:notation> - <skos:prefLabel xml:lang="de">Psychologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Psychology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=110#110-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=110"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>110-01</skos:notation> - <skos:prefLabel xml:lang="de">Allgemeine, Biologische und Mathematische Psychologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">General, Biological and Mathematical Psychology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=110#110-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=110"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>110-02</skos:notation> - <skos:prefLabel xml:lang="de">Entwicklungspsychologie und Pädagogische Psychologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Developmental and Educational Psychology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=110#110-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=110"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>110-03</skos:notation> - <skos:prefLabel xml:lang="de">Sozialpsychologie und Arbeits- und Organisationspsychologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Social Psychology, Industrial and Organisational Psychology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=110#110-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=110"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>110-04</skos:notation> - <skos:prefLabel xml:lang="de">Differentielle Psychologie, Klinische Psychologie, Medizinische Psychologie, Methoden</skos:prefLabel> - <skos:prefLabel xml:lang="en">Differential Psychology, Clinical Psychology, Medical Psychology, Methodology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=111"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>111</skos:notation> - <skos:prefLabel xml:lang="de">Sozialwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Social Sciences</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=111#111-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=111"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>111-01</skos:notation> - <skos:prefLabel xml:lang="de">Soziologische Theorie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Sociological Theory</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=111#111-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=111"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>111-02</skos:notation> - <skos:prefLabel xml:lang="de">Empirische Sozialforschung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Empirical Social Research</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=111#111-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=111"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>111-03</skos:notation> - <skos:prefLabel xml:lang="de">Publizistik und Kommunikationswissenschaft</skos:prefLabel> - <skos:prefLabel xml:lang="en">Communication Sciences</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=111#111-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=111"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>111-04</skos:notation> - <skos:prefLabel xml:lang="de">Politikwissenschaft</skos:prefLabel> - <skos:prefLabel xml:lang="en">Political Science</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=112"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>112</skos:notation> - <skos:prefLabel xml:lang="de">Wirtschaftswissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Economics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=112#112-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=112"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>112-01</skos:notation> - <skos:prefLabel xml:lang="de">Wirtschaftstheorie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Economic Theory</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=112#112-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=112"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>112-02</skos:notation> - <skos:prefLabel xml:lang="de">Wirtschaftspolitik und Finanzwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Economic Policy and Public Finance</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=112#112-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=112"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>112-03</skos:notation> - <skos:prefLabel xml:lang="de">Betriebswirtschaftslehre</skos:prefLabel> - <skos:prefLabel xml:lang="en">Business Administration</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=112#112-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=112"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>112-04</skos:notation> - <skos:prefLabel xml:lang="de">Statistik und Ökonometrie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Statistics and Econometrics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=112#112-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=112"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>112-05</skos:notation> - <skos:prefLabel xml:lang="de">Wirtschafts- und Sozialgeschichte</skos:prefLabel> - <skos:prefLabel xml:lang="en">Economic and Social History</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=113"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#1"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>113</skos:notation> - <skos:prefLabel xml:lang="de">Rechtswissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Jurisprudence</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=113#113-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=113"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>113-01</skos:notation> - <skos:prefLabel xml:lang="de">Grundlagen des Rechts und der Rechtswissenschaft</skos:prefLabel> - <skos:prefLabel xml:lang="en">Principles of Law and Jurisprudence</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=113#113-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=113"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>113-02</skos:notation> - <skos:prefLabel xml:lang="de">Privatrecht</skos:prefLabel> - <skos:prefLabel xml:lang="en">Private Law</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=113#113-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=113"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>113-03</skos:notation> - <skos:prefLabel xml:lang="de">Öffentliches Recht</skos:prefLabel> - <skos:prefLabel xml:lang="en">Public Law</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=113#113-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=113"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>113-04</skos:notation> - <skos:prefLabel xml:lang="de">Strafrecht, Strafprozessrecht</skos:prefLabel> - <skos:prefLabel xml:lang="en">Criminal Law and Law of Criminal Procedure</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=113#113-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=113"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>113-05</skos:notation> - <skos:prefLabel xml:lang="de">Kriminologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Criminology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#2"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>2</skos:notation> - <skos:prefLabel xml:lang="de">Lebenswissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Life Sciences</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#2"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>201</skos:notation> - <skos:prefLabel xml:lang="de">Grundlagen der Biologie und Medizin</skos:prefLabel> - <skos:prefLabel xml:lang="en">Basic Research in Biology and Medicine</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201#201-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>201-01</skos:notation> - <skos:prefLabel xml:lang="de">Biochemie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Biochemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201#201-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>201-02</skos:notation> - <skos:prefLabel xml:lang="de">Biophysik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Biophysics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201#201-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>201-03</skos:notation> - <skos:prefLabel xml:lang="de">Zellbiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Cell Biology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201#201-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>201-04</skos:notation> - <skos:prefLabel xml:lang="de">Strukturbiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Structural Biology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201#201-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>201-05</skos:notation> - <skos:prefLabel xml:lang="de">Allgemeine Genetik</skos:prefLabel> - <skos:prefLabel xml:lang="en">General Genetics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201#201-06"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>201-06</skos:notation> - <skos:prefLabel xml:lang="de">Entwicklungsbiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Developmental Biology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201#201-07"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>201-07</skos:notation> - <skos:prefLabel xml:lang="de">Bioinformatik und Theoretische Biologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Bioinformatics and Theoretical Biology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201#201-08"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=201"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>201-08</skos:notation> - <skos:prefLabel xml:lang="de">Anatomie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Anatomy</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#2"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>202</skos:notation> - <skos:prefLabel xml:lang="de">Pflanzenwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Plant Sciences</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202#202-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>202-01</skos:notation> - <skos:prefLabel xml:lang="de">Evolution und Systematik der Pflanzen und Pilze</skos:prefLabel> - <skos:prefLabel xml:lang="en">Evolution and Systematics of Plants and Fungi</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202#202-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>202-02</skos:notation> - <skos:prefLabel xml:lang="de">Pflanzenökologie und Ökosystemforschung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Plant Ecology and Ecosystem Analysis</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202#202-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>202-03</skos:notation> - <skos:prefLabel xml:lang="de">Organismische Interaktionen und chemische Ökologie pflanzlicher Systeme</skos:prefLabel> - <skos:prefLabel xml:lang="en">Inter-Organismic Interactions and Chemical Ecology of Plant Systems</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202#202-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>202-04</skos:notation> - <skos:prefLabel xml:lang="de">Pflanzenphysiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Plant Physiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202#202-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>202-05</skos:notation> - <skos:prefLabel xml:lang="de">Biochemie und Biophysik der Pflanzen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Plant Biochemistry and Biophysics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202#202-06"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>202-06</skos:notation> - <skos:prefLabel xml:lang="de">Zell- und Entwicklungsbiologie der Pflanzen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Plant Cell and Developmental Biology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202#202-07"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=202"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>202-07</skos:notation> - <skos:prefLabel xml:lang="de">Genetik der Pflanzen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Plant Genetics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#2"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>203</skos:notation> - <skos:prefLabel xml:lang="de">Zoologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Zoology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203#203-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>203-01</skos:notation> - <skos:prefLabel xml:lang="de">Systematik und Morphologie der Tiere</skos:prefLabel> - <skos:prefLabel xml:lang="en">Special Zoology and Morphology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203#203-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>203-02</skos:notation> - <skos:prefLabel xml:lang="de">Evolution, Anthropologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Evolution, Anthropology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203#203-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>203-03</skos:notation> - <skos:prefLabel xml:lang="de">Ökologie der Tiere, Biodiversität und Ökosystemforschung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Animal Ecology, Biodiversity and Ecosystem Research</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203#203-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>203-04</skos:notation> - <skos:prefLabel xml:lang="de">Biologie des Verhaltens und der Sinne</skos:prefLabel> - <skos:prefLabel xml:lang="en">Sensory and Behavioural Biology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203#203-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>203-05</skos:notation> - <skos:prefLabel xml:lang="de">Biochemie und Physiologie der Tiere</skos:prefLabel> - <skos:prefLabel xml:lang="en">Biochemistry and Animal Physiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203#203-06"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=203"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>203-06</skos:notation> - <skos:prefLabel xml:lang="de">Evolutionäre Zell- und Entwicklungsbiologie der Tiere</skos:prefLabel> - <skos:prefLabel xml:lang="en">Evolutionary Cell and Developmental Biology (Zoology)</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=204"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#2"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>204</skos:notation> - <skos:prefLabel xml:lang="de">Mikrobiologie, Virologie und Immunologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Microbiology, Virology and Immunology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=204#204-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=204"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>204-01</skos:notation> - <skos:prefLabel xml:lang="de">Stoffwechselphysiologie, Biochemie und Genetik der Mikroorganismen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Metabolism, Biochemistry and Genetics of Microorganisms</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=204#204-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=204"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>204-02</skos:notation> - <skos:prefLabel xml:lang="de">Mikrobielle Ökologie und Angewandte Mikrobiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Microbial Ecology and Applied Microbiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=204#204-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=204"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>204-03</skos:notation> - <skos:prefLabel xml:lang="de">Medizinische Mikrobiologie, Parasitologie, medizinische Mykologie und Hygiene, Molekulare Infektionsbiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Medical Microbiology, Parasitology, Medical Mycology and Hygiene, Molecular Infection Biology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=204#204-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=204"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>204-04</skos:notation> - <skos:prefLabel xml:lang="de">Virologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Virology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=204#204-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=204"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>204-05</skos:notation> - <skos:prefLabel xml:lang="de">Immunologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Immunology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#2"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205</skos:notation> - <skos:prefLabel xml:lang="de">Medizin</skos:prefLabel> - <skos:prefLabel xml:lang="en">Medicine</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-01</skos:notation> - <skos:prefLabel xml:lang="de">Epidemiologie, Medizinische Biometrie, Medizinische Informatik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Epidemiology, Medical Biometry, Medical Informatics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-02</skos:notation> - <skos:prefLabel xml:lang="de">Public Health, medizinische Versorgungsforschung, Sozialmedizin</skos:prefLabel> - <skos:prefLabel xml:lang="en">Public Health, Health Services Research, Social Medicine</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-03</skos:notation> - <skos:prefLabel xml:lang="de">Humangenetik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Human Genetics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-04</skos:notation> - <skos:prefLabel xml:lang="de">Physiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Physiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-05</skos:notation> - <skos:prefLabel xml:lang="de">Ernährungswissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Nutritional Sciences</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-06"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-06</skos:notation> - <skos:prefLabel xml:lang="de">Pathologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Pathology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-07"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-07</skos:notation> - <skos:prefLabel xml:lang="de">Klinische Chemie und Pathobiochemie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Clinical Chemistry and Pathobiochemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-08"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-08</skos:notation> - <skos:prefLabel xml:lang="de">Pharmazie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Pharmacy</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-09"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-09</skos:notation> - <skos:prefLabel xml:lang="de">Pharmakologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Pharmacology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-10"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-10</skos:notation> - <skos:prefLabel xml:lang="de">Toxikologie, Arbeitsmedizin und Rechtsmedizin</skos:prefLabel> - <skos:prefLabel xml:lang="en">Toxicology, Occupational Medicine and Forensic Medicine</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-11"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-11</skos:notation> - <skos:prefLabel xml:lang="de">Anästhesiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Anaesthesiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-12"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-12</skos:notation> - <skos:prefLabel xml:lang="de">Kardiologie, Angiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Cardiology, Angiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-13"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-13</skos:notation> - <skos:prefLabel xml:lang="de">Pneumologie, Klinische Infektiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Pneumology, Clinical Infectiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-14"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-14</skos:notation> - <skos:prefLabel xml:lang="de">Hämatologie, Onkologie, Transfusionsmedizin</skos:prefLabel> - <skos:prefLabel xml:lang="en">Hematology, Oncology, Transfusion Medicine</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-15"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-15</skos:notation> - <skos:prefLabel xml:lang="de">Gastroenterologie, Stoffwechsel</skos:prefLabel> - <skos:prefLabel xml:lang="en">Gastroenterology, Metabolism</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-16"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-16</skos:notation> - <skos:prefLabel xml:lang="de">Nephrologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Nephrology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-17"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-17</skos:notation> - <skos:prefLabel xml:lang="de">Endokrinologie, Diabetologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Endocrinology, Diabetology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-18"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-18</skos:notation> - <skos:prefLabel xml:lang="de">Rheumatologie, Klinische Immunologie, Allergologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Rheumatology, Clinical Immunology, Allergology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-19"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-19</skos:notation> - <skos:prefLabel xml:lang="de">Dermatologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Dermatology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-20"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-20</skos:notation> - <skos:prefLabel xml:lang="de">Kinder- und Jugendmedizin</skos:prefLabel> - <skos:prefLabel xml:lang="en">Pediatric and Adolescent Medicine</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-21"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-21</skos:notation> - <skos:prefLabel xml:lang="de">Frauenheilkunde und Geburtshilfe</skos:prefLabel> - <skos:prefLabel xml:lang="en">Gynaecology and Obstetrics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-22"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-22</skos:notation> - <skos:prefLabel xml:lang="de">Reproduktionsmedizin/ -biologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Reproductive Medicine/Biology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-23"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-23</skos:notation> - <skos:prefLabel xml:lang="de">Urologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Urology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-24"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-24</skos:notation> - <skos:prefLabel xml:lang="de">Biogerontologie und Geriatrie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Biogerontology and Geriatric Medicine</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-25"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-25</skos:notation> - <skos:prefLabel xml:lang="de">Allgemein- und Viszeralchirurgie</skos:prefLabel> - <skos:prefLabel xml:lang="en">General and Visceral Surgery</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-26"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-26</skos:notation> - <skos:prefLabel xml:lang="de">Herz-, Thorax-, Gefäßchirurgie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Cardiothoracic and Vascular Surgery</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-27"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-27</skos:notation> - <skos:prefLabel xml:lang="de">Unfallchirurgie und Orthopädie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Traumatology and Orthopaedics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-28"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-28</skos:notation> - <skos:prefLabel xml:lang="de">Zahnheilkunde; Mund-, Kiefer- und Gesichtschirurgie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Dentistry, Oral Surgery</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-29"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-29</skos:notation> - <skos:prefLabel xml:lang="de">Hals-Nasen-Ohrenheilkunde</skos:prefLabel> - <skos:prefLabel xml:lang="en">Otolaryngology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-30"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-30</skos:notation> - <skos:prefLabel xml:lang="de">Radiologie und Nuklearmedizin</skos:prefLabel> - <skos:prefLabel xml:lang="en">Radiology and Nuclear Medicine</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-31"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-31</skos:notation> - <skos:prefLabel xml:lang="de">Radioonkologie und Strahlenbiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Radiation Oncology and Radiobiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205#205-32"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=205"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>205-32</skos:notation> - <skos:prefLabel xml:lang="de">Biomedizinische Technik und Medizinische Physik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Biomedical Technology and Medical Physics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#2"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206</skos:notation> - <skos:prefLabel xml:lang="de">Neurowissenschaft</skos:prefLabel> - <skos:prefLabel xml:lang="en">Neurosciences</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206#206-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206-01</skos:notation> - <skos:prefLabel xml:lang="de">Molekulare Neurowissenschaft und Neurogenetik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Molecular Neuroscience and Neurogenetics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206#206-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206-02</skos:notation> - <skos:prefLabel xml:lang="de">Zelluläre Neurowissenschaft</skos:prefLabel> - <skos:prefLabel xml:lang="en">Cellular Neuroscience</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206#206-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206-03</skos:notation> - <skos:prefLabel xml:lang="de">Entwicklungsneurobiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Developmental Neurobiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206#206-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206-04</skos:notation> - <skos:prefLabel xml:lang="de">Systemische Neurowissenschaft, Computational Neuroscience, Verhalten</skos:prefLabel> - <skos:prefLabel xml:lang="en">Systemic Neuroscience, Computational Neuroscience, Behaviour</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206#206-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206-05</skos:notation> - <skos:prefLabel xml:lang="de">Organismische Neurobiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Organismic Neurobiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206#206-06"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206-06</skos:notation> - <skos:prefLabel xml:lang="de">Kognitive Neurowissenschaft</skos:prefLabel> - <skos:prefLabel xml:lang="en">Cognitive Neuroscience</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206#206-07"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206-07</skos:notation> - <skos:prefLabel xml:lang="de">Molekulare und Zelluläre Neurologie, Neuropathologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Molecular and Cellular Neurology, Neuropathology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206#206-08"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206-08</skos:notation> - <skos:prefLabel xml:lang="de">Klinische Neurowissenschaften I - Neurologie, Neurochirurgie, Neuroradiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Clinical Neurosciences I - Neurology, Neurosurgery, Neuroradiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206#206-09"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206-09</skos:notation> - <skos:prefLabel xml:lang="de">Biologische und molekulare Psychiatrie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Biological and Molecular Psychiatry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206#206-10"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206-10</skos:notation> - <skos:prefLabel xml:lang="de">Klinische Neurowissenschaften II - Psychiatrie, Psychotherapie, Kinder- und Jugendspychiatrie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Clinical Neurosciences II - Psychiatry, Psychotherapy, Child and Adolescent Psychiatry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206#206-11"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=206"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>206-11</skos:notation> - <skos:prefLabel xml:lang="de">Klinische Neurowissenschaften III - Augenheilkunde</skos:prefLabel> - <skos:prefLabel xml:lang="en">Clinical Neurosciences III - Ophthalmology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#2"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207</skos:notation> - <skos:prefLabel xml:lang="de">Agrar-, Forstwissenschaften und Tiermedizin</skos:prefLabel> - <skos:prefLabel xml:lang="en">Agriculture, Forestry and Veterinary Medicine</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-01</skos:notation> - <skos:prefLabel xml:lang="de">Bodenwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Soil Sciences</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-02</skos:notation> - <skos:prefLabel xml:lang="de">Pflanzenbau und Agrartechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Plant Cultivation and Agricultural Technology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-03</skos:notation> - <skos:prefLabel xml:lang="de">Pflanzenernährung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Plant Nutrition</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-04</skos:notation> - <skos:prefLabel xml:lang="de">Ökologie von Agrarlandschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Ecology of Agricultural Landscapes</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-05</skos:notation> - <skos:prefLabel xml:lang="de">Pflanzenzüchtung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Plant Breeding</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-06"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-06</skos:notation> - <skos:prefLabel xml:lang="de">Phytomedizin</skos:prefLabel> - <skos:prefLabel xml:lang="en">Phytomedicine</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-07"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-07</skos:notation> - <skos:prefLabel xml:lang="de">Agrarökonomie und -soziologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Agricultural Economics and Sociology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-08"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-08</skos:notation> - <skos:prefLabel xml:lang="de">Forstwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Forestry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-09"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-09</skos:notation> - <skos:prefLabel xml:lang="de">Tierzucht, Tierhaltung und Tierhygiene</skos:prefLabel> - <skos:prefLabel xml:lang="en">Animal Husbandry, Breeding and Hygiene</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-10"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-10</skos:notation> - <skos:prefLabel xml:lang="de">Tierernährung und Tierernährungsphysiologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Animal Nutrition and Nutrition Physiology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-11"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-11</skos:notation> - <skos:prefLabel xml:lang="de">Grundlagen der Tiermedizin</skos:prefLabel> - <skos:prefLabel xml:lang="en">Basic Veterinary Medical Science</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207#207-12"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=207"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>207-12</skos:notation> - <skos:prefLabel xml:lang="de">Grundlagen von Pathogenese, Diagnostik, Therapie und Klinische Tiermedizin</skos:prefLabel> - <skos:prefLabel xml:lang="en">Basic Research on Pathogenesis, Diagnostics and Therapy and Clinical Veterinary Medicine</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>3</skos:notation> - <skos:prefLabel xml:lang="de">Naturwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Natural Sciences</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=301"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>301</skos:notation> - <skos:prefLabel xml:lang="de">Molekülchemie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Molecular Chemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=301#301-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=301"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>301-01</skos:notation> - <skos:prefLabel xml:lang="de">Anorganische Molekülchemie - Synthese, Charakterisierung, Theorie und Modellierung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Inorganic Molecular Chemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=301#301-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=301"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>301-02</skos:notation> - <skos:prefLabel xml:lang="de">Organische Molekülchemie - Synthese, Charakterisierung, Theorie und Modellierung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Organic Molecular Chemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=302"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>302</skos:notation> - <skos:prefLabel xml:lang="de">Chemische Festkörper- und Oberflächenforschung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Chemical Solid State and Surface Research</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=302#302-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=302"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>302-01</skos:notation> - <skos:prefLabel xml:lang="de">Festkörper- und Oberflächenchemie, Materialsynthese</skos:prefLabel> - <skos:prefLabel xml:lang="en">Solid State and Surface Chemistry, Material Synthesis</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=302#302-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=302"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>302-02</skos:notation> - <skos:prefLabel xml:lang="de">Physikalische Chemie von Festkörpern und Oberflächen, Materialcharakterisierung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Physical Chemistry of Solids and Surfaces, Material Characterisation</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=302#302-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=302"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>302-03</skos:notation> - <skos:prefLabel xml:lang="de">Theorie und Modellierung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Theory and Modelling</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=303"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>303</skos:notation> - <skos:prefLabel xml:lang="de">Physikalische und Theoretische Chemie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Physical and Theoretical Chemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=303#303-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=303"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>303-01</skos:notation> - <skos:prefLabel xml:lang="de">Physikalische Chemie von Molekülen, Flüssigkeiten und Grenzflächen - Spektroskopie, Kinetik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Physical Chemistry of Molecules, Interfaces and Liquids - Spectroscopy, Kinetics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=303#303-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=303"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>303-02</skos:notation> - <skos:prefLabel xml:lang="de">Allgemeine Theoretische Chemie</skos:prefLabel> - <skos:prefLabel xml:lang="en">General Theoretical Chemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=304"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>304</skos:notation> - <skos:prefLabel xml:lang="de">Analytik, Methodenentwicklung (Chemie)</skos:prefLabel> - <skos:prefLabel xml:lang="en">Analytical Chemistry, Method Development (Chemistry)</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=304#304-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=304"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>304-01</skos:notation> - <skos:prefLabel xml:lang="de">Analytik, Methodenentwicklung (Chemie)</skos:prefLabel> - <skos:prefLabel xml:lang="en">Analytical Chemistry, Method Development (Chemistry)</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=305"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>305</skos:notation> - <skos:prefLabel xml:lang="de">Biologische Chemie und Lebensmittelchemie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Biological Chemistry and Food Chemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=305#305-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=305"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>305-01</skos:notation> - <skos:prefLabel xml:lang="de">Biologische und Biomimetische Chemie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Biological and Biomimetic Chemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=305#305-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=305"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>305-02</skos:notation> - <skos:prefLabel xml:lang="de">Lebensmittelchemie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Food Chemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=306"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>306</skos:notation> - <skos:prefLabel xml:lang="de">Polymerforschung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Polymer Research</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=306#306-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=306"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>306-01</skos:notation> - <skos:prefLabel xml:lang="de">Präparative und Physikalische Chemie von Polymeren</skos:prefLabel> - <skos:prefLabel xml:lang="en">Preparatory and Physical Chemistry of Polymers</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=306#306-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=306"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>306-02</skos:notation> - <skos:prefLabel xml:lang="de">Experimentelle und Theoretische Polymerphysik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Experimental and Theoretical Physics of Polymers</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=306#306-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=306"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>306-03</skos:notation> - <skos:prefLabel xml:lang="de">Polymermaterialien</skos:prefLabel> - <skos:prefLabel xml:lang="en">Polymer Materials</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=307"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>307</skos:notation> - <skos:prefLabel xml:lang="de">Physik der kondensierten Materie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Condensed Matter Physics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=307#307-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=307"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>307-01</skos:notation> - <skos:prefLabel xml:lang="de">Experimentelle Physik der kondensierten Materie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Experimental Condensed Matter Physics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=307#307-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=307"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>307-02</skos:notation> - <skos:prefLabel xml:lang="de">Theoretische Physik der kondensierten Materie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Theoretical Condensed Matter Physics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=308"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>308</skos:notation> - <skos:prefLabel xml:lang="de">Optik, Quantenoptik und Physik der Atome, Moleküle und Plasmen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Optics, Quantum Optics and Physics of Atoms, Molecules and Plasmas</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=308#308-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=308"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>308-01</skos:notation> - <skos:prefLabel xml:lang="de">Optik, Quantenoptik, Physik der Atome, Moleküle und Plasmen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Optics, Quantum Optics, Atoms, Molecules, Plasmas</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=309"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>309</skos:notation> - <skos:prefLabel xml:lang="de">Teilchen, Kerne und Felder</skos:prefLabel> - <skos:prefLabel xml:lang="en">Particles, Nuclei and Fields</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=309#309-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=309"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>309-01</skos:notation> - <skos:prefLabel xml:lang="de">Kern- und Elementarteilchenphysik, Quantenmechanik, Relativitätstheorie, Felder</skos:prefLabel> - <skos:prefLabel xml:lang="en">Particles, Nuclei and Fields</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=310"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>310</skos:notation> - <skos:prefLabel xml:lang="de">Statistische Physik, Weiche Materie, Biologische Physik, Nichtlineare Dynamik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Statistical Physics, Soft Matter, Biological Physics, Nonlinear Dynamics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=310#310-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=310"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>310-01</skos:notation> - <skos:prefLabel xml:lang="de">Statistische Physik, Weiche Materie, Biologische Physik, Nichtlineare Dynamik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Statistical Physics, Soft Matter, Biological Physics, Nonlinear Dynamics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=311"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>311</skos:notation> - <skos:prefLabel xml:lang="de">Astrophysik und Astronomie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Astrophysics and Astronomy</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=311#311-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=311"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>311-01</skos:notation> - <skos:prefLabel xml:lang="de">Astrophysik und Astronomie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Astrophysics and Astronomy</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=312"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>312</skos:notation> - <skos:prefLabel xml:lang="de">Mathematik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Mathematics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=312#312-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=312"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>312-01</skos:notation> - <skos:prefLabel xml:lang="de">Mathematik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Mathematics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=313"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>313</skos:notation> - <skos:prefLabel xml:lang="de">Atmosphären-, Meeres- und Klimaforschung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Atmospheric Science, Oceanography and Climate Research</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=313#313-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=313"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>313-01</skos:notation> - <skos:prefLabel xml:lang="de">Physik und Chemie der Atmosphäre</skos:prefLabel> - <skos:prefLabel xml:lang="en">Atmospheric Science</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=313#313-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=313"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>313-02</skos:notation> - <skos:prefLabel xml:lang="de">Physik, Chemie und Biologie des Meeres</skos:prefLabel> - <skos:prefLabel xml:lang="en">Oceanography</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=314"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>314</skos:notation> - <skos:prefLabel xml:lang="de">Geologie und Paläontologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Geology and Palaeontology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=314#314-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=314"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>314-01</skos:notation> - <skos:prefLabel xml:lang="de">Geologie, Ingenieurgeologie, Paläontologie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Geology and Palaeontology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=315"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>315</skos:notation> - <skos:prefLabel xml:lang="de">Geophysik und Geodäsie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Geophysics and Geodesy</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=315#315-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=315"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>315-01</skos:notation> - <skos:prefLabel xml:lang="de">Physik des Erdkörpers</skos:prefLabel> - <skos:prefLabel xml:lang="en">Geophysics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=315#315-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=315"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>315-02</skos:notation> - <skos:prefLabel xml:lang="de">Geodäsie, Photogrammetrie, Fernerkundung, Geoinformatik, Kartographie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Geodesy, Photogrammetry, Remote Sensing, Geoinformatics, Cartography</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=316"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>316</skos:notation> - <skos:prefLabel xml:lang="de">Geochemie, Mineralogie und Kristallographie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Geochemistry, Mineralogy and Crystallography</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=316#316-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=316"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>316-01</skos:notation> - <skos:prefLabel xml:lang="de">Organische und Anorganische Geochemie, Biogeochemie, Mineralogie, Petrologie, Kristallographie, Lagerstättenkunde</skos:prefLabel> - <skos:prefLabel xml:lang="en">Geochemistry, Mineralogy and Crystallography</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=317"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>317</skos:notation> - <skos:prefLabel xml:lang="de">Geographie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Geography</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=317#317-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=317"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>317-01</skos:notation> - <skos:prefLabel xml:lang="de">Physische Geographie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Physical Geography</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=317#317-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=317"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>317-02</skos:notation> - <skos:prefLabel xml:lang="de">Humangeographie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Human Geography</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=318"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#3"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>318</skos:notation> - <skos:prefLabel xml:lang="de">Wasserforschung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Water Research</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=318#318-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=318"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>318-01</skos:notation> - <skos:prefLabel xml:lang="de">Hydrogeologie, Hydrologie, Limnologie, Siedlungswasserwirtschaft, Wasserchemie, Integrierte Wasser-Ressourcen Bewirtschaftung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Hydrogeology, Hydrology, Limnology, Urban Water Management, Water Chemistry, Integrated Water Resources Management </skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#4"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>4</skos:notation> - <skos:prefLabel xml:lang="de">Ingenieurwissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Engineering Sciences</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#4"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>401</skos:notation> - <skos:prefLabel xml:lang="de">Produktionstechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Production Technology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401#401-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>401-01</skos:notation> - <skos:prefLabel xml:lang="de">Spanende Fertigungstechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Metal-Cutting Manufacturing Engineering</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401#401-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>401-02</skos:notation> - <skos:prefLabel xml:lang="de">Ur- und Umformtechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Primary Shaping and Reshaping Technology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401#401-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>401-03</skos:notation> - <skos:prefLabel xml:lang="de">Füge-, Montage- und Trenntechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Joining, Mounting and Separation Technology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401#401-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>401-04</skos:notation> - <skos:prefLabel xml:lang="de">Kunststofftechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Plastics Engineering</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401#401-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>401-05</skos:notation> - <skos:prefLabel xml:lang="de">Produktionsorganisation und Betriebswissenschaften</skos:prefLabel> - <skos:prefLabel xml:lang="en">Production Management and Operations Management</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401#401-06"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=401"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>401-06</skos:notation> - <skos:prefLabel xml:lang="de">Werkzeugmaschinen und Produktionsautomatisierung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Machine Tools and Production Automation</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=402"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#4"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>402</skos:notation> - <skos:prefLabel xml:lang="de">Mechanik und Konstruktiver Maschinenbau</skos:prefLabel> - <skos:prefLabel xml:lang="en">Mechanics and Constructive Mechanical Engineering</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=402#402-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=402"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>402-01</skos:notation> - <skos:prefLabel xml:lang="de">Konstruktion, Maschinenelemente, Produktentwicklung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Engineering Design, Machine Elements, Product Development</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=402#402-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=402"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>402-02</skos:notation> - <skos:prefLabel xml:lang="de">Mechanik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Mechanics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=402#402-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=402"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>402-03</skos:notation> - <skos:prefLabel xml:lang="de">Leichtbau, Textiltechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Lightweight Construction, Textile Technology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=402#402-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=402"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>402-04</skos:notation> - <skos:prefLabel xml:lang="de">Akustik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Acoustics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=403"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#4"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>403</skos:notation> - <skos:prefLabel xml:lang="de">Verfahrenstechnik, Technische Chemie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Process Engineering, Technical Chemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=403#403-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=403"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>403-01</skos:notation> - <skos:prefLabel xml:lang="de">Chemische und Thermische Verfahrenstechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Chemical and Thermal Process Engineering</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=403#403-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=403"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>403-02</skos:notation> - <skos:prefLabel xml:lang="de">Technische Chemie</skos:prefLabel> - <skos:prefLabel xml:lang="en">Technical Chemistry</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=403#403-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=403"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>403-03</skos:notation> - <skos:prefLabel xml:lang="de">Mechanische Verfahrenstechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Mechanical Process Engineering</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=403#403-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=403"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>403-04</skos:notation> - <skos:prefLabel xml:lang="de">Bioverfahrenstechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Biological Process Engineering</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=404"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#4"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>404</skos:notation> - <skos:prefLabel xml:lang="de">Wärmeenergietechnik, Thermische Maschinen, Strömungsmechanik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Heat Energy Technology, Thermal Machines, Fluid Mechanics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=404#404-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=404"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>404-01</skos:notation> - <skos:prefLabel xml:lang="de">Energieverfahrenstechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Energy Process Engineering</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=404#404-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=404"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>404-02</skos:notation> - <skos:prefLabel xml:lang="de">Technische Thermodynamik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Technical Thermodynamics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=404#404-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=404"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>404-03</skos:notation> - <skos:prefLabel xml:lang="de">Strömungsmechanik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Fluid Mechanics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=404#404-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=404"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>404-04</skos:notation> - <skos:prefLabel xml:lang="de">Strömungs- und Kolbenmaschinen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Hydraulic and Turbo Engines and Piston Engines</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=405"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#4"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>405</skos:notation> - <skos:prefLabel xml:lang="de">Werkstofftechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Materials Engineering</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=405#405-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=405"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>405-01</skos:notation> - <skos:prefLabel xml:lang="de">Metallurgische und thermische Prozesse und thermomechanische Behandlung von Werkstoffen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Metallurgical and Thermal Processes, Thermomechanical Treatment of Materials</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=405#405-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=405"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>405-02</skos:notation> - <skos:prefLabel xml:lang="de">Keramische und metallische Sinterwerkstoffe</skos:prefLabel> - <skos:prefLabel xml:lang="en">Sintered Metallic and Ceramic Materials</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=405#405-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=405"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>405-03</skos:notation> - <skos:prefLabel xml:lang="de">Verbundwerkstoffe</skos:prefLabel> - <skos:prefLabel xml:lang="en">Composite Materials</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=405#405-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=405"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>405-04</skos:notation> - <skos:prefLabel xml:lang="de">Mechanisches Verhalten von Konstruktionswerkstoffen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Mechanical Behaviour of Construction Materials</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=405#405-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=405"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>405-05</skos:notation> - <skos:prefLabel xml:lang="de">Beschichtungs- und Oberflächentechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Coating and Surface Technology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=406"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#4"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>406</skos:notation> - <skos:prefLabel xml:lang="de">Materialwissenschaft</skos:prefLabel> - <skos:prefLabel xml:lang="en">Materials Science</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=406#406-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=406"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>406-01</skos:notation> - <skos:prefLabel xml:lang="de">Thermodynamik und Kinetik von Werkstoffen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Thermodynamics and Kinetics of Materials</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=406#406-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=406"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>406-02</skos:notation> - <skos:prefLabel xml:lang="de">Herstellung und Eigenschaften von Funktionsmaterialien</skos:prefLabel> - <skos:prefLabel xml:lang="en">Synthesis and Properties of Functional Materials</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=406#406-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=406"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>406-03</skos:notation> - <skos:prefLabel xml:lang="de">Mikrostrukturelle mechanische Eigenschaften von Materialien</skos:prefLabel> - <skos:prefLabel xml:lang="en">Microstructural Mechanical Properties of Materials</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=406#406-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=406"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>406-04</skos:notation> - <skos:prefLabel xml:lang="de">Strukturierung und Funktionalisierung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Structuring and Functionalisation</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=406#406-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=406"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>406-05</skos:notation> - <skos:prefLabel xml:lang="de">Biomaterialien</skos:prefLabel> - <skos:prefLabel xml:lang="en">Biomaterials</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#4"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>407</skos:notation> - <skos:prefLabel xml:lang="de">Systemtechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Systems Engineering</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407#407-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>407-01</skos:notation> - <skos:prefLabel xml:lang="de">Automatisierungstechnik, Regelungssysteme, Robotik, Mechatronik, Cyber Physical Systems</skos:prefLabel> - <skos:prefLabel xml:lang="en">Automation, Control Systems, Robotics, Mechatronics, Cyber Physical Systems</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407#407-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>407-02</skos:notation> - <skos:prefLabel xml:lang="de">Messsysteme</skos:prefLabel> - <skos:prefLabel xml:lang="en">Measurement Systems</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407#407-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>407-03</skos:notation> - <skos:prefLabel xml:lang="de">Mikrosysteme</skos:prefLabel> - <skos:prefLabel xml:lang="en">Microsystems</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407#407-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>407-04</skos:notation> - <skos:prefLabel xml:lang="de">Verkehrs- und Transportsysteme, Logistik, Intelligenter und automatisierter Verkehr</skos:prefLabel> - <skos:prefLabel xml:lang="en">Traffic and Transport Systems, Logistics, Intelligent and Automated Traffic</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407#407-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>407-05</skos:notation> - <skos:prefLabel xml:lang="de">Arbeitswissenschaft, Ergonomie, Mensch-Maschine-Systeme</skos:prefLabel> - <skos:prefLabel xml:lang="en">Human Factors, Ergonomics, Human-Machine Systems</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407#407-06"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=407"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>407-06</skos:notation> - <skos:prefLabel xml:lang="de">Biomedizinische Systemtechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Biomedical Systems Technology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=408"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#4"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>408</skos:notation> - <skos:prefLabel xml:lang="de">Elektrotechnik und Informationstechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Electrical Engineering and Information Technology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=408#408-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=408"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>408-01</skos:notation> - <skos:prefLabel xml:lang="de">Elektronische Halbleiter, Bauelemente und Schaltungen, Integrierte Systeme</skos:prefLabel> - <skos:prefLabel xml:lang="en">Electronic Semiconductors, Components, Circuits, Systems</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=408#408-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=408"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>408-02</skos:notation> - <skos:prefLabel xml:lang="de">Nachrichten- und Hochfrequenztechnik, Kommunikationstechnik und -netze, Theoretische Elektrotechnik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Communications, High-Frequency and Network Technology, Theoretical Electrical Engineering</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=408#408-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=408"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>408-03</skos:notation> - <skos:prefLabel xml:lang="de">Elektrische Energieerzeugung, -übertragung, -verteilung und -anwendung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Electrical Energy Generation, Distribution, Application</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#4"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>409</skos:notation> - <skos:prefLabel xml:lang="de">Informatik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Computer Science</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409#409-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>409-01</skos:notation> - <skos:prefLabel xml:lang="de">Theoretische Informatik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Theoretical Computer Science</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409#409-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>409-02</skos:notation> - <skos:prefLabel xml:lang="de">Softwaretechnik und Programmiersprachen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Software Engineering and Programming Languages</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409#409-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>409-03</skos:notation> - <skos:prefLabel xml:lang="de">Sicherheit und Verlässlichkeit</skos:prefLabel> - <skos:prefLabel xml:lang="en">Security and Dependability</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409#409-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>409-04</skos:notation> - <skos:prefLabel xml:lang="de">Betriebs-, Kommunikations-, Datenbank- und verteilte Systeme</skos:prefLabel> - <skos:prefLabel xml:lang="en">Operating, Communication, Database and Distributed Systems</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409#409-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>409-05</skos:notation> - <skos:prefLabel xml:lang="de">Interaktive und intelligente Systeme, Bild- und Sprachverarbeitung, Computergraphik und Visualisierung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Interactive and Intelligent Systems, Image and Language Processing, Computer Graphics and Visualisation</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409#409-06"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>409-06</skos:notation> - <skos:prefLabel xml:lang="de">Informationssysteme, Prozess- und Wissensmanagement</skos:prefLabel> - <skos:prefLabel xml:lang="en">Information Systems, Process and Knowledge Management</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409#409-07"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>409-07</skos:notation> - <skos:prefLabel xml:lang="de">Rechnerarchitekturen und eingebettete Systeme</skos:prefLabel> - <skos:prefLabel xml:lang="en">Computer Architecture and Embedded Systems</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409#409-08"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=409"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>409-08</skos:notation> - <skos:prefLabel xml:lang="de">Massiv parallele und datenintensive Systeme</skos:prefLabel> - <skos:prefLabel xml:lang="en">Massively Parallel and Data-Intensive Systems</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/#4"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>410</skos:notation> - <skos:prefLabel xml:lang="de">Bauwesen und Architektur</skos:prefLabel> - <skos:prefLabel xml:lang="en">Construction Engineering and Architecture</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410#410-01"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>410-01</skos:notation> - <skos:prefLabel xml:lang="de">Architektur, Bau- und Konstruktionsgeschichte, Bauforschung, Ressourcenökonomie im Bauwesen</skos:prefLabel> - <skos:prefLabel xml:lang="en">Architecture, Building and Construction History, Construction Research, Sustainable Building Technology</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410#410-02"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>410-02</skos:notation> - <skos:prefLabel xml:lang="de">Städtebau/Stadtentwicklung, Raumplanung, Verkehrs- und Infrastrukturplanung, Landschaftsplanung</skos:prefLabel> - <skos:prefLabel xml:lang="en">Urbanism, Spatial Planning, Transportation and Infrastructure Planning, Landscape Planning</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410#410-03"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>410-03</skos:notation> - <skos:prefLabel xml:lang="de">Baustoffwissenschaften, Bauchemie, Bauphysik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Construction Material Sciences, Chemistry, Building Physics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410#410-04"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>410-04</skos:notation> - <skos:prefLabel xml:lang="de">Konstruktiver Ingenieurbau, Bauinformatik und Baubetrieb</skos:prefLabel> - <skos:prefLabel xml:lang="en">Structural Engineering, Building Informatics and Construction Operation</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410#410-05"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>410-05</skos:notation> - <skos:prefLabel xml:lang="de">Angewandte Mechanik, Statik und Dynamik</skos:prefLabel> - <skos:prefLabel xml:lang="en">Applied Mechanics, Statics and Dynamics</skos:prefLabel> -</skos:Concept> - -<skos:Concept rdf:about="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410#410-06"> - <skos:broader rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/liste/index.jsp?id=410"/> - <skos:inScheme rdf:resource="http://www.dfg.de/dfg_profil/gremien/fachkollegien/faecher/"/> - <skos:notation>410-06</skos:notation> - <skos:prefLabel xml:lang="de">Geotechnik, Wasserbau</skos:prefLabel> - <skos:prefLabel xml:lang="en">Geotechnics, Hydraulic Engineering</skos:prefLabel> -</skos:Concept> -</rdf:RDF> \ No newline at end of file diff --git a/src/Migrator/LinqToDB.Templates/CopyMe.SqlServer.tt.txt b/src/Migrator/LinqToDB.Templates/CopyMe.SqlServer.tt.txt deleted file mode 100644 index 891b6b7..0000000 --- a/src/Migrator/LinqToDB.Templates/CopyMe.SqlServer.tt.txt +++ /dev/null @@ -1,56 +0,0 @@ -<#@ template language="C#" debug="True" hostSpecific="True" #> -<#@ output extension=".generated.cs" #> -<#@ include file="$(LinqToDBT4SqlServerTemplatesDirectory)LinqToDB.SqlServer.Tools.ttinclude" #> -<#@ include file="$(LinqToDBT4SqlServerTemplatesDirectory)PluralizationService.ttinclude" #> -<# //@ include file="$(ProjectDir)LinqToDB.Templates\LinqToDB.SqlServer.Tools.ttinclude" #> -<# //@ include file="$(ProjectDir)LinqToDB.Templates\PluralizationService.ttinclude" #> -<# - /* - 1. Create new *.tt file (e.g. MyDatabase.tt) in a folder where you would like to generate your data model - and copy content from this file to it. For example: - - MyProject - DataModels - MyDatabase.tt - - 2. Modify the connection settings below to connect to your database. - - 3. Add connection string to the web/app.config file: - - <connectionStrings> - <add name="MyDatabase" providerName="System.Data.SqlClient" - connectionString="Data Source=.;Database=MyDatabase;User Id=User;Password=TestPassword;" /> - </connectionStrings> - - 4. To access your database use the following code: - - using (var db = new MyDatabaseDB()) - { - var q = - from c in db.Customers - select c; - - foreach (var c in q) - Console.WriteLine(c.ContactName); - } - - 5. See more at https://github.com/linq2db/t4models - - If you need to use the Microsoft.SqlServer.Types namespace, install the Microsoft.SqlServer.Types nuget, - and replace the following include at the top of this file: - - "$(ProjectDir)LinqToDB.Templates\LinqToDB.SqlServer.Tools.ttinclude" - - with - - "$(ProjectDir)LinqToDB.Templates\LinqToDB.SqlServer.SqlTypes.Tools.ttinclude" - */ - - NamespaceName = "DataModels"; - - LoadSqlServerMetadata("MyServer", "MyDatabase", "User", "Password"); -// LoadSqlServerMetadata(".", "MyDatabase"); // Integrated Security -// LoadSqlServerMetadata(string connectionString); - - GenerateModel(); -#> diff --git a/src/Migrator/LinqToDB.Templates/DataAnnotations.ttinclude b/src/Migrator/LinqToDB.Templates/DataAnnotations.ttinclude deleted file mode 100644 index a98aea2..0000000 --- a/src/Migrator/LinqToDB.Templates/DataAnnotations.ttinclude +++ /dev/null @@ -1,65 +0,0 @@ -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - beforeGenerateModel(); - DataAnnotationsImpl(); - }; - } -#> -<#+ -void DataAnnotationsImpl() -{ - foreach (Class cl in GetTreeNodes(Model).OfType<Class>()) - { - foreach (var p in GetTreeNodes(cl).OfType<Property>()) - { - if (p.DisplayName != null) - { - p.Attributes.Add(new Attribute("Display", "Name=" + ToStringLiteral(p.DisplayName)) { IsSeparated = true }); - } - - if (p.IsRequired) - { - var attr = new Attribute("Required") { IsSeparated = true }; - - if (p.IsRequiredMessage != null) - attr.Parameters.Add(string.Format("ErrorMessage=" + ToStringLiteral(p.IsRequiredMessage), p.DisplayName ?? p.Name)); - - p.Attributes.Add(attr); - } - - if (p.StringLength > 0) - { - var attr = new Attribute("StringLength", p.StringLength.ToString()) { IsSeparated = true }; - - if (p.StringLengthMessage != null) - attr.Parameters.Add(string.Format("ErrorMessage=" + ToStringLiteral(p.StringLengthMessage), p.DisplayName ?? p.Name)); - - p.Attributes.Add(attr); - -// p.Attributes.Add( -// new Attribute("StringLength", -// p.StringLength.ToString(), -// "ErrorMessage=" + ToStringLiteral(string.Format( -// "The {0} must be a string with a maximum length of {1}.", -// p.DisplayName ?? "field", -// p.StringLength))) -// { -// IsSeparated = true -// }); - } - } - } -} - -partial class Property -{ - public string DisplayName; - public bool IsRequired; - public string IsRequiredMessage; - public int StringLength; - public string StringLengthMessage; -} -#> diff --git a/src/Migrator/LinqToDB.Templates/DataModel.ttinclude b/src/Migrator/LinqToDB.Templates/DataModel.ttinclude deleted file mode 100644 index b28013d..0000000 --- a/src/Migrator/LinqToDB.Templates/DataModel.ttinclude +++ /dev/null @@ -1,871 +0,0 @@ -<#@ assembly name="System.Data" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="LinqToDB.SchemaProvider" #> -<#@ import namespace="LinqToDB.Data" #> -<#@ include file="T4Model.ttinclude" #> -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - GenerateTypesFromMetadata(); - beforeGenerateModel(); - }; - } -#><#+ - -string NamespaceName -{ - get { return Model.Namespace.Name; } - set { Model.Namespace.Name = value; } -} - -string DatabaseName = null; -string DataContextName = null; -string BaseDataContextClass = null; -string BaseEntityClass = null; -string OneToManyAssociationType = "IEnumerable<{0}>"; - -bool GenerateDatabaseName = false; -bool GenerateConstructors = true; -string DefaultConfiguration = null; -bool GenerateAssociations = true; -bool GenerateBackReferences = true; -bool GenerateAssociationExtensions = false; -bool ReplaceSimilarTables = true; -bool IncludeDefaultSchema = true; - -Class DataContextObject; - -bool PluralizeClassNames = false; -bool SingularizeClassNames = true; -bool PluralizeDataContextPropertyNames = true; -bool SingularizeDataContextPropertyNames = false; - -bool NormalizeNames = true; - -private Func<string, bool, string> _toValidName; -Func<string, bool, string> ToValidName -{ - get { return _toValidName ?? ToValidNameDefault; } - set { _toValidName = value; } -} - -private Func<string, bool, string> _convertToCompilabl; -Func<string, bool, string> ConvertToCompilable -{ - get { return _convertToCompilabl ?? ConvertToCompilableDefault; } - set { _convertToCompilabl = value; } -} - -private Func<ForeignKey, string> _getAssociationExtensionPluralName; -Func<ForeignKey, string> GetAssociationExtensionPluralName -{ - get { return _getAssociationExtensionPluralName ?? GetAssociationExtensionPluralNameDefault; } - set { _getAssociationExtensionPluralName = value; } -} - -private Func<ForeignKey, string> _getAssociationExtensionSingularName; -Func<ForeignKey, string> GetAssociationExtensionSinglularName -{ - get { return _getAssociationExtensionSingularName ?? GetAssociationExtensionSinglularNameDefault; } - set { _getAssociationExtensionSingularName = value; } -} - -LinqToDB.SchemaProvider.GetSchemaOptions GetSchemaOptions = - new LinqToDB.SchemaProvider.GetSchemaOptions(); - -LinqToDB.SqlProvider.ISqlBuilder SqlBuilder; - -Func<TableSchema,Table> LoadProviderSpecificTable = tableSchema => null; - -static Func<ColumnSchema,string> ConvertColumnMemberType = (c) => c.MemberType; -static Func<TableSchema,ColumnSchema,string> ConvertTableColumnMemberType = (t,c) => ConvertColumnMemberType(c); -static Func<ProcedureSchema,ColumnSchema,string> ConvertProcedureColumnMemberType = (t,c) => ConvertColumnMemberType(c); - -HashSet<string> KeyWords = new HashSet<string> -{ - "abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", - "class", "const", "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", - "event", "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "goto", - "if", "implicit", "in", "int", "interface", "internal", "is", "lock", "long", "new", - "null", "object", "operator", "out", "override", "params", "private", "protected", "public", "readonly", - "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static", "struct", "switch", - "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", - "using", "virtual", "volatile", "void", "while", "namespace", "string" -}; - -void LoadServerMetadata(DataConnection dataConnection) -{ - SqlBuilder = dataConnection.DataProvider.CreateSqlBuilder(); - - var sp = dataConnection.DataProvider.GetSchemaProvider(); - var db = sp.GetSchema(dataConnection, GetSchemaOptions); - - if (DatabaseName == null && GenerateDatabaseName) - DatabaseName = db.Database; - - if (DataContextName == null) - DataContextObject.Name = DataContextName = ToValidName(db.Database, true) + "DB"; - - DataContextObject.Comment.Add("/ <summary>"); - DataContextObject.Comment.Add("/ Database : " + db.Database); - DataContextObject.Comment.Add("/ Data Source : " + db.DataSource); - DataContextObject.Comment.Add("/ Server Version : " + db.ServerVersion); - DataContextObject.Comment.Add("/ </summary>"); - - var tables = db.Tables - .Where(t => !t.IsProviderSpecific) - .Select(t => new - { - t, - key = t.IsDefaultSchema ? t.TableName : t.SchemaName + "." + t.TableName, - table = new Table - { - TableSchema = t, - IsDefaultSchema = t.IsDefaultSchema, - Schema = t.IsDefaultSchema && !IncludeDefaultSchema || string.IsNullOrEmpty(t.SchemaName)? null : t.SchemaName, - BaseClass = BaseEntityClass, - TableName = t.TableName, - TypeName = t.TypeName, - DataContextPropertyName = t.TypeName, - IsView = t.IsView, - IsProviderSpecific = false, - Description = t.Description, - Columns = t.Columns.ToDictionary( - c => c.ColumnName, - c => new Column - { - ColumnName = c.ColumnName, - ColumnType = c.ColumnType, - DataType = "DataType." + c.DataType, - Length = c.Length, - Precision = c.Precision, - Scale = c.Scale, - IsNullable = c.IsNullable, - IsIdentity = c.IsIdentity, - IsPrimaryKey = c.IsPrimaryKey, - PrimaryKeyOrder = c.PrimaryKeyOrder, - MemberName = CheckType(c.SystemType, c.MemberName), - TypeBuilder = () => ConvertTableColumnMemberType(t, c), - SkipOnInsert = c.SkipOnInsert, - SkipOnUpdate = c.SkipOnUpdate, - Description = c.Description, - }) - } - }) - .ToList(); - - if (PluralizeClassNames || SingularizeClassNames) - { - var foundNames = new HashSet<string>(tables.Select(t => t.table.Schema + '.' + t.table.TypeName)); - - foreach (var t in tables) - { - var newName = t.table.TypeName; - newName = - PluralizeClassNames ? ToPlural (newName) : - SingularizeClassNames ? ToSingular(newName) : newName; - - if (newName != t.table.TypeName) - { - if (!foundNames.Contains(t.table.Schema + '.' + newName)) - { - t.table.TypeName = newName; - foundNames.Add(t.table.Schema + '.' + newName); - } - } - } - } - - if (PluralizeDataContextPropertyNames || SingularizeDataContextPropertyNames) - { - var foundNames = new HashSet<string>(tables.Select(t => t.table.Schema + '.' + t.table.DataContextPropertyName)); - - foreach (var t in tables) - { - var newName = t.table.DataContextPropertyName; - newName = - PluralizeDataContextPropertyNames ? ToPlural (newName) : - SingularizeDataContextPropertyNames ? ToSingular(newName) : newName; - - if (newName != t.table.TypeName) - { - if (!foundNames.Contains(t.table.Schema + '.' + newName)) - { - t.table.DataContextPropertyName = newName; - foundNames.Add(t.table.Schema + '.' + newName); - } - } - } - } - - tables.AddRange(db.Tables - .Where(t => t.IsProviderSpecific) - .Select(t => new - { - t, - key = t.IsDefaultSchema ? t.TableName : t.SchemaName + "." + t.TableName, - table = LoadProviderSpecificTable(t) - }) - .Where(t => t.table != null)); - - foreach (var t in tables) - Tables.Add(t.key, t.table); - - var keys = - ( - from t in tables - from k in t.t.ForeignKeys - let otherTable = tables.Where(tbl => tbl.t == k.OtherTable).Select(tbl => tbl.table).Single() - select new - { - k, - k.KeyName, - t, - key = new ForeignKey - { - KeyName = k.KeyName, - OtherTable = otherTable, - OtherColumns = k.OtherColumns.Select(c => otherTable.Columns[c.ColumnName]).ToList(), - ThisColumns = k.ThisColumns. Select(c => t.table. Columns[c.ColumnName]).ToList(), - CanBeNull = k.CanBeNull, - MemberName = k.MemberName, - AssociationType = (AssociationType)(int)k.AssociationType, - } - } - ).ToList(); - - foreach (var key in keys) - { - key.t.table.ForeignKeys.Add( - key.k.OtherTable.IsDefaultSchema ? key.KeyName : key.k.OtherTable.SchemaName + "." + key.KeyName, - key.key); - - if (key.k.BackReference != null) - key.key.BackReference = keys.First(k => k.k == key.k.BackReference).key; - - key.key.MemberName = key.key.MemberName.Replace(".", string.Empty); - - key.key.MemberName = key.key.AssociationType == AssociationType.OneToMany ? - ToPlural(key.key.MemberName) : ToSingular(key.key.MemberName); - } - - var procedures = db.Procedures - .Select(p => new - { - p, - key = p.IsDefaultSchema ? p.ProcedureName : p.SchemaName + "." + p.ProcedureName, - proc = new Procedure - { - Schema = (p.IsDefaultSchema && !IncludeDefaultSchema) || string.IsNullOrEmpty(p.SchemaName)? null : p.SchemaName, - ProcedureName = p.ProcedureName, - Name = ToValidName(p.MemberName, true), - IsFunction = p.IsFunction, - IsTableFunction = p.IsTableFunction, - IsAggregateFunction = p.IsAggregateFunction, - IsDefaultSchema = p.IsDefaultSchema, - IsLoaded = p.IsLoaded, - ResultTable = p.ResultTable == null ? null : - new Table - { - TypeName = ToValidName( - PluralizeClassNames ? ToPlural (p.ResultTable.TypeName) : - SingularizeClassNames ? ToSingular(p.ResultTable.TypeName) : p.ResultTable.TypeName, true), - Columns = ToDictionary( - p.ResultTable.Columns, - c => c.ColumnName, - c => new Column - { - ColumnName = c.ColumnName, - ColumnType = c.ColumnType, - IsNullable = c.IsNullable, - IsIdentity = c.IsIdentity, - IsPrimaryKey = c.IsPrimaryKey, - PrimaryKeyOrder = c.PrimaryKeyOrder, - MemberName = CheckColumnName(CheckType(c.SystemType, c.MemberName)), - TypeBuilder = () => ConvertProcedureColumnMemberType(p, c), - SkipOnInsert = c.SkipOnInsert, - SkipOnUpdate = c.SkipOnUpdate, - Description = c.Description, - }, - (c,n) => - { - c.IsDuplicateOrEmpty = true; - return "$" + (c.MemberName = "Column" + n); - }) - }, - ResultException = p.ResultException, - SimilarTables = p.SimilarTables == null ? new List<Table>() : - p.SimilarTables - .Select(t => tables.Single(tbl => tbl.t == t).table) - .ToList(), - ProcParameters = p.Parameters - .Select(pr => new Parameter - { - SchemaName = pr.SchemaName, - SchemaType = pr.SchemaType, - IsIn = pr.IsIn, - IsOut = pr.IsOut, - IsResult = pr.IsResult, - Size = pr.Size, - ParameterName = CheckParameterName(CheckType(pr.SystemType, pr.ParameterName)), - ParameterType = pr.ParameterType, - SystemType = pr.SystemType, - DataType = pr.DataType.ToString(), - }) - .ToList(), - } - }) - .ToList(); - - foreach (var p in procedures) - { - if (ReplaceSimilarTables) - if (p.proc.SimilarTables.Count() == 1 || p.proc.SimilarTables.Count(t => !t.IsView) == 1) - p.proc.ResultTable = p.proc.SimilarTables.Count() == 1 ? - p.proc.SimilarTables[0] : - p.proc.SimilarTables.First(t => !t.IsView); - - Procedures[p.key] = p.proc; - } -} - -Dictionary<string,TR> ToDictionary<T,TR>(IEnumerable<T> source, Func<T,string> keyGetter, Func<T,TR> objGetter, Func<TR,int,string> getKeyName) -{ - var dic = new Dictionary<string,TR>(); - var current = 1; - - foreach (var item in source) - { - var key = keyGetter(item); - var obj = objGetter(item); - - if (string.IsNullOrEmpty(key) || dic.ContainsKey(key)) - key = getKeyName(obj, current); - - dic.Add(key, obj); - - current++; - } - - return dic; -} - -string CheckType(Type type, string typeName) -{ - if (!Model.Usings.Contains(type.Namespace)) - Model.Usings.Add(type.Namespace); - return typeName; -} - -string CheckColumnName(string memberName) -{ - if (string.IsNullOrEmpty(memberName)) - memberName = "Empty"; - else - { - memberName = memberName - .Replace("%", "Percent") - .Replace(">", "Greater") - .Replace("<", "Lower") - .Replace("+", "Plus") - .Replace('(', '_') - .Replace(')', '_') - .Replace('-', '_') - .Replace('|', '_') - .Replace(',', '_') - .Replace('"', '_') - .Replace("'", "_") - .Replace(".", "_") - .Replace("\u00A3", "Pound"); - - if (KeyWords.Contains(memberName)) - memberName = "@" + memberName; - } - return memberName; -} - -string CheckParameterName(string parameterName) -{ - var invalidParameterNames = new List<string> - { - "@DataType" - }; - - var result = parameterName; - while (invalidParameterNames.Contains(result)) - { - result = result + "_"; - } - return result; -} - -Action AfterLoadMetadata = () => {}; - -void LoadMetadata(DataConnection dataConnection) -{ - if (DataContextObject == null) - { - DataContextObject = new Class(DataContextName) { BaseClass = BaseDataContextClass, }; - - Model.Types.Add(DataContextObject); - } - - LoadServerMetadata(dataConnection); - - if (Tables.Values.SelectMany(_ => _.ForeignKeys.Values).Any(_ => _.AssociationType == AssociationType.OneToMany)) - Model.Usings.Add("System.Collections.Generic"); - - foreach (var t in Tables.Values) - { - if (KeyWords.Contains(t.TypeName)) - t.TypeName = "@" + t.TypeName; - - if (KeyWords.Contains(t.DataContextPropertyName)) - t.DataContextPropertyName = "@" + t.DataContextPropertyName; - - t.TypeName = ConvertToCompilable(t.TypeName, true); - t.DataContextPropertyName = ConvertToCompilable(t.DataContextPropertyName, true); - - foreach (var col in t.Columns.Values) - { - if (KeyWords.Contains(col.MemberName)) - col.MemberName = "@" + col.MemberName; - - col.MemberName = ConvertToCompilable(col.MemberName, true); - - if (col.MemberName == t.TypeName) - col.MemberName += "_Column"; - } - - foreach (var fk in t.ForeignKeys.Values) - { - if (KeyWords.Contains(fk.MemberName)) - fk.MemberName = "@" + fk.MemberName; - - fk.MemberName = ConvertToCompilable(fk.MemberName, true); - - if (fk.MemberName == t.TypeName) - fk.MemberName += "_FK"; - } - } - - foreach (var t in Tables.Values) - { - var hasDuplicates = t.Columns.Values - .Select(c => c.MemberName) - .Concat(t.ForeignKeys.Values.Select(f => f.MemberName)) - .ToLookup(n => n) - .Any(g => g.Count() > 1); - - if (hasDuplicates) - { - foreach (var fk in t.ForeignKeys.Values) - { - var mayDuplicate = t.Columns.Values - .Select(c => c.MemberName) - .Concat(t.ForeignKeys.Values.Where(f => f != fk).Select(f => f.MemberName)); - - fk.MemberName = SuggestNoDuplicate(mayDuplicate, fk.MemberName, "FK"); - } - - foreach (var col in t.Columns.Values) - { - var mayDuplicate = t.Columns.Values - .Where(c => c != col) - .Select(c => c.MemberName) - .Concat(t.ForeignKeys.Values.Select(fk => fk.MemberName)); - - col.MemberName = SuggestNoDuplicate(mayDuplicate, col.MemberName, null); - } - } - } - - foreach (var proc in Procedures.Values) - { - proc.Name = ConvertToCompilable(proc.Name, false); - - if (KeyWords.Contains(proc.Name)) - proc.Name = "@" + proc.Name; - - foreach (var param in proc.ProcParameters) - { - if (KeyWords.Contains(param.ParameterName)) - param.ParameterName = ConvertToCompilable("@" + param.ParameterName, true); - } - } - - AfterLoadMetadata(); -} - -string SuggestNoDuplicate(IEnumerable<string> currentNames, string newName, string prefix) -{ - var names = new HashSet<string>(currentNames); - var result = newName; - if (names.Contains(result)) - { - if (!string.IsNullOrEmpty(prefix)) - result = prefix + result; - if (names.Contains(result)) - { - var counter = 0; - var number = string.Concat(result.Reverse().Take(6).TakeWhile(c => Char.IsDigit(c)).Reverse()); - if (!string.IsNullOrEmpty(number)) - { - if (int.TryParse(number, out counter)) - { - result = result.Remove(result.Length - number.Length); - } - } - - do - { - ++counter; - if (!names.Contains(result + counter)) - { - result = result + counter; - break; - } - } - while(true); - } - } - - return result; -} - -string ConvertToCompilableDefault(string name, bool mayRemoveUnderscore) -{ - var query = - from c in name - select char.IsLetterOrDigit(c) || c == '@' ? c : '_'; - - return ToValidName(new string(query.ToArray()), mayRemoveUnderscore); -} - -Table GetTable(string name) -{ - Table tbl; - - if (Tables.TryGetValue(name, out tbl)) - return tbl; - - WriteLine("#error Table '" + name + "' not found."); - WriteLine("/*"); - WriteLine("\tExisting tables:"); - WriteLine(""); - - foreach (var key in Tables.Keys) - WriteLine("\t" + key); - - WriteLine(" */"); - - throw new ArgumentException("Table '" + name + "' not found."); -} - -Procedure GetProcedure(string name) -{ - Procedure proc; - - if (Procedures.TryGetValue(name, out proc)) - return proc; - - WriteLine("#error Procedure '" + name + "' not found."); - WriteLine(""); - WriteLine("/*"); - WriteLine("\tExisting procedures:"); - WriteLine(""); - - foreach (var key in Procedures.Keys) - WriteLine("\t" + key); - - WriteLine(" */"); - - throw new ArgumentException("Procedure '" + name + "' not found."); -} - -Column GetColumn(string tableName, string columnName) -{ - var tbl = GetTable(tableName); - - Column col; - - if (tbl.Columns.TryGetValue(columnName, out col)) - return col; - - WriteLine("#error Column '" + tableName + "'.'" + columnName + "' not found."); - WriteLine(""); - WriteLine("/*"); - WriteLine("\tExisting '" + tableName + "'columns:"); - WriteLine(""); - - foreach (var key in tbl.Columns.Keys) - WriteLine("\t" + key); - - WriteLine(" */"); - - throw new ArgumentException("Column '" + tableName + "'.'" + columnName + "' not found."); -} - -ForeignKey GetFK(string tableName, string fkName) -{ - return GetForeignKey(tableName, fkName); -} - -ForeignKey GetForeignKey(string tableName, string fkName) -{ - var tbl = GetTable(tableName); - - ForeignKey col; - - if (tbl.ForeignKeys.TryGetValue(fkName, out col)) - return col; - - WriteLine("#error FK '" + tableName + "'.'" + fkName + "' not found."); - WriteLine(""); - WriteLine("/*"); - WriteLine("\tExisting '" + tableName + "'FKs:"); - WriteLine(""); - - foreach (var key in tbl.ForeignKeys.Keys) - WriteLine("\t" + key); - - WriteLine(" */"); - - throw new ArgumentException("FK '" + tableName + "'.'" + fkName + "' not found."); -} - - -public TableContext SetTable(string tableName, - string TypeName = null, - string DataContextPropertyName = null) -{ - var ctx = new TableContext { Transformation = this, TableName = tableName }; - - if (TypeName != null || DataContextPropertyName != null) - { - var t = GetTable(tableName); - - if (TypeName != null) t.TypeName = TypeName; - if (DataContextPropertyName != null) t.DataContextPropertyName = DataContextPropertyName; - } - - return ctx; -} - -public class TableContext -{ - public GeneratedTextTransformation Transformation; - public string TableName; - - public TableContext Column(string columnName, - string MemberName = null, - string Type = null, - bool? IsNullable = null, - string Conditional = null) - { - var c = Transformation.GetColumn(TableName, columnName); - - if (MemberName != null) c.MemberName = MemberName; - if (Type != null) c.TypeBuilder = () => Type; - if (IsNullable != null) c.IsNullable = IsNullable.Value; - if (Conditional != null) c.Conditional = Conditional; - - return this; - } - - public TableContext FK(string fkName, - string MemberName = null, - AssociationType? AssociationType = null, - bool? CanBeNull = null) - { - var c = Transformation.GetFK(TableName, fkName); - - if (MemberName != null) c.MemberName = MemberName; - if (AssociationType != null) c.AssociationType = AssociationType.Value; - if (CanBeNull != null) c.CanBeNull = CanBeNull.Value; - - return this; - } -} - - -Dictionary<string,Table> Tables = new Dictionary<string,Table> (); -Dictionary<string,Procedure> Procedures = new Dictionary<string,Procedure>(); - -public partial class Table : Class -{ - public TableSchema TableSchema { get; set; } - public string Schema { get; set; } - public string TableName { get; set; } - public string DataContextPropertyName { get; set; } - public MemberBase DataContextProperty { get; set; } - public bool IsView { get; set; } - public bool IsProviderSpecific { get; set; } - public bool IsDefaultSchema { get; set; } - public string Description { get; set; } - public string AliasPropertyName { get; set; } - public string AliasTypeName { get; set; } - public string TypePrefix { get; set; } - - public string TypeName - { - get { return Name; } - set { Name = value; } - } - - public Dictionary<string,Column> Columns; - public Dictionary<string,ForeignKey> ForeignKeys = new Dictionary<string,ForeignKey>(); -} - -public partial class Column : Property -{ - public string ColumnName; // Column name in database - public bool IsNullable; - public bool IsIdentity; - public string ColumnType; // Type of the column in database - public string DataType; - public long? Length; - public int? Precision; - public int? Scale; - public DbType DbType; - public string Description; - public bool IsPrimaryKey; - public int PrimaryKeyOrder; - public bool SkipOnUpdate; - public bool SkipOnInsert; - public bool IsDuplicateOrEmpty; - public bool IsDiscriminator; - public string AliasName; - - public string MemberName - { - get { return Name; } - set { Name = value; } - } -} - -public enum AssociationType -{ - Auto, - OneToOne, - OneToMany, - ManyToOne, -} - -public partial class ForeignKey : Property -{ - public string KeyName; - public Table OtherTable; - public List<Column> ThisColumns; - public List<Column> OtherColumns; - public bool CanBeNull; - public ForeignKey BackReference; - - public string MemberName - { - get { return Name; } - set { Name = value; } - } - - private AssociationType _associationType = AssociationType.Auto; - public AssociationType AssociationType - { - get { return _associationType; } - set - { - _associationType = value; - - if (BackReference != null) - { - switch (value) - { - case AssociationType.Auto : BackReference.AssociationType = AssociationType.Auto; break; - case AssociationType.OneToOne : BackReference.AssociationType = AssociationType.OneToOne; break; - case AssociationType.OneToMany : BackReference.AssociationType = AssociationType.ManyToOne; break; - case AssociationType.ManyToOne : BackReference.AssociationType = AssociationType.OneToMany; break; - } - } - } - } -} - -public partial class Procedure : Method -{ - public string Schema { get; set; } - public string ProcedureName { get; set; } - public bool IsFunction { get; set; } - public bool IsTableFunction { get; set; } - public bool IsAggregateFunction { get; set; } - public bool IsDefaultSchema { get; set; } - public bool IsLoaded { get; set; } - - public Table ResultTable { get; set; } - public Exception ResultException { get; set; } - public List<Table> SimilarTables { get; set; } - public List<Parameter> ProcParameters { get; set; } -} - -public class Parameter -{ - public string SchemaName { get; set; } - public string SchemaType { get; set; } - public bool IsIn { get; set; } - public bool IsOut { get; set; } - public bool IsResult { get; set; } - public long? Size { get; set; } - - public string ParameterName { get; set; } - public string ParameterType { get; set; } - public Type SystemType { get; set; } - public string DataType { get; set; } -} - -private int _counter = 0; - -string ToValidNameDefault(string name, bool mayRemoveUnderscore) -{ - if (NormalizeNames && mayRemoveUnderscore && name.Contains("_")) - { - name = SplitAndJoin(name, "", '_'); - } - - if (name.Contains(".")) - { - name = SplitAndJoin(name, "", '.'); - } - - if (name.Length > 0 && char.IsDigit(name[0])) - name = "_" + name; - - if (string.IsNullOrEmpty(name)) - name = "_" + _counter++; - - if (NormalizeNames) - { - name = char.ToUpper(name[0]) + name.Substring(1); - } - - return name; -} - -static string SplitAndJoin(string value, string join, params char[] split) -{ - var ss = value.Split(split, StringSplitOptions.RemoveEmptyEntries) - .Select(s => char.ToUpper(s[0]) + (s.Substring(1).All(char.IsUpper) ? s.Substring(1).ToLower() : s.Substring(1))); - - return string.Join(join, ss.ToArray()); -} - -private string GetAssociationExtensionSinglularNameDefault(ForeignKey key) -{ - return ToSingular(key.Name); -} - -private string GetAssociationExtensionPluralNameDefault(ForeignKey key) -{ - return ToPlural(ToSingular(key.Name)); -} - -#> diff --git a/src/Migrator/LinqToDB.Templates/EditableObject.ttinclude b/src/Migrator/LinqToDB.Templates/EditableObject.ttinclude deleted file mode 100644 index e9506c2..0000000 --- a/src/Migrator/LinqToDB.Templates/EditableObject.ttinclude +++ /dev/null @@ -1,250 +0,0 @@ -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - EditableObjectImpl(); - beforeGenerateModel(); - }; - - SetPropertyValueAction += (obj,prop,val) => - { - if (prop == "IsEditable") - obj.IsEditable = (bool)val; - }; - } -#> -<#+ -void EditableObjectImpl() -{ - foreach (Property prop in GetTreeNodes(Model).OfType<Property>().Where(p => p.IsEditable).ToList()) - { - SetPropertyValue(prop, "IsNotifying", true); - - List<IClassMember> parentMembers; - - MemberGroup gr = null; - - if (prop.Parent is Class) - { - var parent = (Class)prop.Parent; - parentMembers = parent.Members; - } - else - { - var parent = (MemberGroup)prop.Parent; - parentMembers = parent.Members; - - parent.IsCompact = false; - } - - var name = prop.Name.Trim(); - var type = prop.BuildType().Trim(); - - if (gr == null) - { - gr = new MemberGroup - { - Region = name + " : " + type, - Members = { prop }, - IsPropertyGroup = true, - }; - - var index = parentMembers.IndexOf(prop); - - parentMembers.RemoveAt(index); - parentMembers.Insert (index, gr); - } - - var originalField = new Field(() => type, "_original" + name) - { - AccessModifier = AccessModifier.Private, - InsertBlankLineAfter = false, - }; - - gr.Members.Insert(0, originalField); - - var currentField = new Field(() => type, " _current" + name) - { - AccessModifier = AccessModifier.Private, - InsertBlankLineAfter = false, - }; - - if (prop.InitValue != null) - currentField.InitValue = prop.InitValue; - - gr.Members.Insert(0, currentField); - - prop.Name = " " + name; - prop.TypeBuilder = () => " " + type; - prop.IsAuto = false; - - if (prop.HasGetter) prop.GetBodyBuilders.Add(() => new [] { "return " + currentField.Name.Trim() + ";" }); - if (prop.HasSetter) prop.SetBodyBuilders.Add(() => new [] { currentField.Name.Trim() + " = value;" }); - - var ac = new Method (() => "void", "Accept" + name + "Changes", null, () => new[] { string.Format("_original{0} = _current{0};", name) }); - var rc = new Method (() => "void", "Reject" + name + "Changes", null, () => new[] { string.Format("{0} = _original{0};", name) }); - var id = new Property(() => "bool", "Is" + name + "Dirty") - .InitGetter(() => new [] { string.Format(prop.IsDirtyText, "_current" + name, "_original" + name) }); - - gr.Members.Add(new MemberGroup - { - Region = "EditableObject support", - Members = { ac, rc, id }, - }); - - prop.Parent.SetTree(); - } - - foreach (Class cl in GetTreeNodes(Model).OfType<Class>()) - { - var props = GetTreeNodes(cl).OfType<Property>().Where(p => p.IsEditable).ToList(); - - if (props.Count > 0) - { - if (props.Any(p => p.IsEditable)) - { - var ctor = GetTreeNodes(cl) - .OfType<Method>() - .FirstOrDefault(m => m.Name == cl.Name && m.ParameterBuilders.Count == 0); - - if (ctor == null) - { - ctor = new Method(null, cl.Name); - cl.Members.Insert(0, ctor); - } - - ctor.BodyBuilders.Add(() => new [] { "AcceptChanges();" }); - } - - var maxLen = props.Max(p => p.Name.Trim().Length); - - var ac = new Method(() => "void", "AcceptChanges") { IsVirtual = true }; - var rc = new Method(() => "void", "RejectChanges") { IsVirtual = true }; - var id = new Property(() => "bool", "IsDirty") { IsAuto = false, HasSetter = false, IsVirtual = true }; - - ac.BodyBuilders.Add(() => new [] - { - "BeforeAcceptChanges();", - "" - }); - rc.BodyBuilders.Add(() => new [] - { - "BeforeRejectChanges();", - "" - }); - id.GetBodyBuilders.Add(() => new [] { "return" }); - - foreach (var p in props) - { - var name = p.Name.Trim(); - - ac.BodyBuilders.Add(() => new [] { string.Format("Accept{0}Changes();", name) }); - rc.BodyBuilders.Add(() => new [] { string.Format("Reject{0}Changes();", name) }); - id.GetBodyBuilders.Add(() => new [] { string.Format("\tIs{0}Dirty{1} ||", name, LenDiff(maxLen, name)) }); - } - - ac.BodyBuilders.Add(() => new[] - { - "", - "AfterAcceptChanges();" - }); - rc.BodyBuilders.Add(() => new[] - { - "", - "AfterRejectChanges();" - }); - var getBody = id.BuildGetBody().ToArray(); - getBody[getBody.Length - 1] = getBody[getBody.Length - 1].Trim(' ' , '|') + ";"; - id.GetBodyBuilders.Clear(); - id.GetBodyBuilders.Add(() => getBody); - - cl.Members.Add(new MemberGroup - { - Region = "EditableObject support", - Members = - { - new MemberGroup - { - IsCompact = true, - Members = - { - new Method(() => "void", "BeforeAcceptChanges") { AccessModifier = AccessModifier.Partial }, - new Method(() => "void", "AfterAcceptChanges") { AccessModifier = AccessModifier.Partial }, - } - }, - ac, - new MemberGroup - { - IsCompact = true, - Members = - { - new Method(() => "void", "BeforeRejectChanges") { AccessModifier = AccessModifier.Partial }, - new Method(() => "void", "AfterRejectChanges") { AccessModifier = AccessModifier.Partial }, - } - }, - rc, - id - }, - }); - - if (!cl.Interfaces.Contains("IEditableObject")) - { - if (!Model.Usings.Contains("System.ComponentModel")) - Model.Usings.Add("System.ComponentModel"); - - cl.Interfaces.Add("IEditableObject"); - - cl.Members.Add(new MemberGroup - { - Region = "IEditableObject support", - Members = - { - new MemberGroup - { - IsCompact = true, - Members = - { - new Field (() => "bool", "_isEditing") { AccessModifier = AccessModifier.Private }, - new Property(() => "bool", " IsEditing").InitGetter(() => new [] { "_isEditing" }), - } - }, - new MemberGroup - { - IsCompact = true, - Members = - { - new Method(() => "void", "BeginEdit", null, () => new[] { "AcceptChanges();", "_isEditing = true;" }) { IsVirtual = true }, - new Method(() => "void", "CancelEdit", null, () => new[] { "_isEditing = false;", "RejectChanges();", }) { IsVirtual = true }, - new Method(() => "void", "EndEdit", null, () => new[] { "_isEditing = false;", "AcceptChanges();", }) { IsVirtual = true }, - } - }, - } - }); - } - } - - cl.SetTree(); - } -} - -partial class Property -{ - public bool IsEditable; - public string IsDirtyText = "{0} != {1}"; -} - -class EditableProperty : Property -{ - public EditableProperty() - { - IsEditable = true; - } - - public EditableProperty(string type, string name) - : base(() => type, name, null, null) - { - IsEditable = true; - } -} -#> diff --git a/src/Migrator/LinqToDB.Templates/Humanizer.ttinclude b/src/Migrator/LinqToDB.Templates/Humanizer.ttinclude deleted file mode 100644 index 17be091..0000000 --- a/src/Migrator/LinqToDB.Templates/Humanizer.ttinclude +++ /dev/null @@ -1,15 +0,0 @@ -<# -/* -To use this extension you should: -1) Reference Humanizer NuGet package into your project -2) Include Humanizer.ttinclude -3) Reference assembly like <_#@ assembly name="$(SolutionDir)\packages\Humanizer.Core.2.2.0\lib\netstandard1.0\Humanizer.dll" #_> -*/ -#> -<#@ import namespace="Humanizer" #> -<# - NormalizeNames = true; - ToPlural = s => s.Pluralize (inputIsKnownToBeSingular: false); - ToSingular = s => s.Singularize(inputIsKnownToBePlural: false); - ToValidName = (s, r) => s.Pascalize(); -#> diff --git a/src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.SqlTypes.Tools.ttinclude b/src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.SqlTypes.Tools.ttinclude deleted file mode 100644 index 05a8e66..0000000 --- a/src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.SqlTypes.Tools.ttinclude +++ /dev/null @@ -1,3 +0,0 @@ -<#@ assembly name="$(LinqToDBT4SqlServerToolsDirectory)Microsoft.SqlServer.Types.dll" #> -<#@ include file="LinqToDB.Tools.ttinclude" #> -<#@ include file="LinqToDB.SqlServer.SqlTypes.ttinclude" #> diff --git a/src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.Tools.ttinclude b/src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.Tools.ttinclude deleted file mode 100644 index fc678e1..0000000 --- a/src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.Tools.ttinclude +++ /dev/null @@ -1,2 +0,0 @@ -<#@ include file="LinqToDB.Tools.ttinclude" #> -<#@ include file="LinqToDB.SqlServer.ttinclude" #> diff --git a/src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.ttinclude b/src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.ttinclude deleted file mode 100644 index 29047c2..0000000 --- a/src/Migrator/LinqToDB.Templates/LinqToDB.SqlServer.ttinclude +++ /dev/null @@ -1,144 +0,0 @@ -<#@ include file="LinqToDB.ttinclude" #> -<# - { - GenerateProcedureDbType = p => p.DataType == "Structured" && p.SchemaType != null; - - var afterGenerateLinqToDBModel = AfterGenerateLinqToDBModel; - AfterGenerateLinqToDBModel = () => - { - afterGenerateLinqToDBModel(); - DoGenerateSqlServerFreeText(); - }; - - var buildColumnComparison = BuildColumnComparison; - BuildColumnComparison = (c, padding1, padding2, last) => - { - if (c.BuildType() == "SqlHierarchyId") - return string.Format("\t(bool)(t.{0}{1} == {0}{3}){2}", c.MemberName, padding1, last ? ");" : " &&", last ? "" : padding2); - else - return buildColumnComparison(c, padding1, padding2, last); - }; - } -#> -<#+ -bool GenerateSqlServerFreeText = true; // Defines whether to generate extensions for Free Text search, or not - -void DoGenerateSqlServerFreeText() -{ - if (!GenerateSqlServerFreeText) - return; - - Model.Usings.Add("System.Collections.Generic"); - Model.Usings.Add("System.Linq.Expressions"); - Model.Usings.Add("System.Reflection"); - Model.Usings.Add("LinqToDB"); - Model.Usings.Add("LinqToDB.DataProvider.SqlServer"); - Model.Usings.Add("LinqToDB.Extensions"); - - DataContextObject.Members.Add( - new MemberGroup - { - Region = "FreeTextTable", - Members = - { - new Class("FreeTextKey", - new MemberGroup - { - IsCompact = true, - Members = - { - new Field(() => "T", "Key"), - new Field(() => "int", "Rank") - } - }) - { - GenericArguments = { "T" }, - IsPartial = false - }, - - new Field(() => "MethodInfo", "_freeTextTableMethod1") - { - AccessModifier = AccessModifier.Private, - IsStatic = true, - InitValue = "typeof(" + DataContextObject.Name + ").GetMethod(\"FreeTextTable\", new Type[] { typeof(string), typeof(string) })" - }, - - new Method(() => "ITable<FreeTextKey<TKey>>", "FreeTextTable", - new Func<string>[] { () => "string field", () => "string text" }, - () => new[] - { - "return this.GetTable<FreeTextKey<TKey>>(", - " this,", - " _freeTextTableMethod1,", - " field,", - " text);", - }) - { - GenericArguments = new List<string>() { "TTable", "TKey" }, - Attributes = { new Attribute("FreeTextTableExpression") } - }, - - new Field(() => "MethodInfo", "_freeTextTableMethod2") - { - AccessModifier = AccessModifier.Private, - IsStatic = true, - InitValue = Environment.NewLine + - " typeof(" + DataContextObject.Name + ").GetMethods()" + Environment.NewLine + - " .Where(m => m.Name == \"FreeTextTable\" && m.IsGenericMethod && m.GetParameters().Length == 2)" + Environment.NewLine + - " .Where(m => m.GetParameters()[0].ParameterType.IsGenericTypeEx() && m.GetParameters()[0].ParameterType.GetGenericTypeDefinition() == typeof(Expression<>))" + Environment.NewLine + - " .Where(m => m.GetParameters()[1].ParameterType == typeof(string))" + Environment.NewLine + - " .Single()" - }, - - new Method(() => "ITable<FreeTextKey<TKey>>", "FreeTextTable", - new Func<string>[] { () => "Expression<Func<TTable,string>> fieldSelector", () => "string text" }, - () => new[] - { - "return this.GetTable<FreeTextKey<TKey>>(", - " this,", - " _freeTextTableMethod2,", - " fieldSelector,", - " text);", - }) - { - GenericArguments = { "TTable", "TKey" }, - Attributes = { new Attribute("FreeTextTableExpression") } - }, - } - } - ); -} - -LinqToDB.Data.DataConnection GetSqlServerConnection(string connectionString) -{ - return LinqToDB.DataProvider.SqlServer.SqlServerTools.CreateDataConnection(connectionString); -} - -LinqToDB.Data.DataConnection GetSqlServerConnection(string server, string database) -{ - return GetSqlServerConnection(string.Format("Data Source={0};Database={1};Integrated Security=SSPI", server, database)); -} - -LinqToDB.Data.DataConnection GetSqlServerConnection(string server, string database, string user, string password) -{ - return GetSqlServerConnection(string.Format("Server={0};Database={1};User Id={2};Password={3};", server, database, user, password)); -} - -void LoadSqlServerMetadata(string connectionString) -{ - using (var dataConnection = GetSqlServerConnection(connectionString)) - LoadMetadata(dataConnection); -} - -void LoadSqlServerMetadata(string server, string database) -{ - using (var dataConnection = GetSqlServerConnection(server, database)) - LoadMetadata(dataConnection); -} - -void LoadSqlServerMetadata(string server, string database, string user, string password) -{ - using (var dataConnection = GetSqlServerConnection(server, database, user, password)) - LoadMetadata(dataConnection); -} -#> diff --git a/src/Migrator/LinqToDB.Templates/LinqToDB.Tools.ttinclude b/src/Migrator/LinqToDB.Templates/LinqToDB.Tools.ttinclude deleted file mode 100644 index d804bb8..0000000 --- a/src/Migrator/LinqToDB.Templates/LinqToDB.Tools.ttinclude +++ /dev/null @@ -1 +0,0 @@ -<#@ assembly name="$(LinqToDBT4ToolsDirectory)linq2db.dll" #> diff --git a/src/Migrator/LinqToDB.Templates/LinqToDB.ttinclude b/src/Migrator/LinqToDB.Templates/LinqToDB.ttinclude deleted file mode 100644 index 0aa897a..0000000 --- a/src/Migrator/LinqToDB.Templates/LinqToDB.ttinclude +++ /dev/null @@ -1,1044 +0,0 @@ -<#@ assembly name="System.Data" #> -<#@ import namespace="System.Data" #> -<#@ import namespace="LinqToDB.Data" #> -<#@ import namespace="System.Text" #> -<#@ include file="DataModel.ttinclude" #> -<# - if (BaseDataContextClass == null) - BaseDataContextClass = "LinqToDB.Data.DataConnection"; -#> -<#+ -Action BeforeGenerateLinqToDBModel = () => {}; -Action AfterGenerateLinqToDBModel = () => {}; - -Func<Table,MemberBase> GenerateProviderSpecificTable = t => null; -Func<Parameter, bool> GenerateProcedureDbType = p => false; - -bool GenerateObsoleteAttributeForAliases = false; -bool GenerateFindExtensions = true; -bool IsCompactColumns = true; -bool IsCompactColumnAliases = true; -bool GenerateDataTypes = false; -bool? GenerateLengthProperty = null; -bool? GeneratePrecisionProperty = null; -bool? GenerateScaleProperty = null; -bool GenerateDbTypes = false; -bool GenerateSchemaAsType = false; -bool GenerateViews = true; -bool GenerateProcedureResultAsList = false; -bool PrefixTableMappingWithSchema = true; -string SchemaNameSuffix = "Schema"; -string SchemaDataContextTypeName = "DataContext"; - -Dictionary<string,string> SchemaNameMapping = new Dictionary<string,string>(); - -Func<string,string,IEnumerable<Method>> GetConstructors = (conf, name) => GetConstructorsImpl(conf, name); - -Func<Column, string, string, bool, string> BuildColumnComparison = (c, padding1, padding2, last) => -{ - return string.Format("\tt.{0}{1} == {0}{3}{2}", c.MemberName, padding1, last ? ");" : " &&", last ? "" : padding2); -}; - -static IEnumerable<Method> GetConstructorsImpl(string defaultConfiguration, string name) -{ - if (defaultConfiguration == null) - yield return new Method((Func<string>)null, name); - else - yield return new Method((Func<string>)null, name) { AfterSignature = { ": base(" + ToStringLiteral(defaultConfiguration) + ")" } }; - yield return new Method((Func<string>)null, name, new Func<string>[] { () => "string configuration" }) { AfterSignature = { ": base(configuration)" } }; -} - -void GenerateTypesFromMetadata() -{ - BeforeGenerateLinqToDBModel(); - - Model.Usings.Add("LinqToDB"); - Model.Usings.Add("LinqToDB.Mapping"); - - if (NamespaceName == null) - NamespaceName = "DataModel"; - - string schemaName; - - var schemas = - ( - from t in Tables.Values - where GenerateSchemaAsType && t.Schema != null && !t.TableSchema.IsDefaultSchema - group t by t.Schema into gr - orderby gr.Key - let typeName = SchemaNameMapping.TryGetValue(gr.Key, out schemaName) ? schemaName : gr.Key - select new - { - Name = gr.Key, - TypeName = typeName + SchemaNameSuffix, - PropertyName = typeName, - Props = new MemberGroup { IsCompact = true }, - Aliases = new MemberGroup { IsCompact = true, Region = "Alias members" }, - TableExtensions = new MemberGroup { Region = "Table Extensions" }, - Type = new Class(typeName + SchemaNameSuffix) { IsStatic = true }, - Tables = gr.ToList(), - DataContext = new Class(SchemaDataContextTypeName), - Procedures = new MemberGroup(), - Functions = new MemberGroup(), - TableFunctions = new MemberGroup { Region = "Table Functions" }, - } - ).ToDictionary(t => t.Name); - - var procSchemas = - ( - from p in Procedures.Values - where GenerateSchemaAsType && p.Schema != null && !p.IsDefaultSchema && !schemas.ContainsKey(p.Schema) - group p by p.Schema into gr - orderby gr.Key - let typeName = SchemaNameMapping.TryGetValue(gr.Key, out schemaName) ? schemaName : gr.Key - select new - { - Name = gr.Key, - TypeName = typeName + SchemaNameSuffix, - PropertyName = typeName, - Props = new MemberGroup { IsCompact = true }, - Aliases = new MemberGroup { IsCompact = true, Region = "Alias members" }, - TableExtensions = new MemberGroup { Region = "Table Extensions" }, - Type = new Class(typeName + SchemaNameSuffix) { IsStatic = true }, - Tables = new List<Table>(), - DataContext = new Class(SchemaDataContextTypeName), - Procedures = new MemberGroup(), - Functions = new MemberGroup(), - TableFunctions = new MemberGroup { Region = "Table Functions" }, - } - ).ToDictionary(s => s.Name); - - foreach(var schema in procSchemas) - schemas.Add(schema.Key, schema.Value); - - var defProps = new MemberGroup { IsCompact = true }; - var defAliases = new MemberGroup { IsCompact = true, Region = "Alias members" }; - var defTableExtensions = new MemberGroup { }; - - if (schemas.Count > 0) - { - var body = new List<Func<IEnumerable<string>>>(); - - var schemaGroup = new MemberGroup { Region = "Schemas" }; - var schemaMembers = new MemberGroup { IsCompact = true }; - - var maxLen1 = schemas.Values.Max(schema => schema.PropertyName.Trim().Length); - var maxLen2 = schemas.Values.Max(schema => schema.TypeName. Trim().Length); - - foreach (var schema in schemas.Values) - { - schemaMembers.Members.Add(new Property(() => schema.TypeName + "." + SchemaDataContextTypeName, schema.PropertyName)); - body.Add(() => new string[] { - schema.PropertyName + LenDiff(maxLen1, schema.PropertyName) + - " = new " + schema.TypeName + "." + LenDiff(maxLen2, schema.TypeName) + - SchemaDataContextTypeName + "(this);"}); - } - - schemaGroup.Members.Add(schemaMembers); - schemaGroup.Members.Add(new Method(() => "void", "InitSchemas", new Func<string>[0], body.ToArray())); - - DataContextObject.Members.Add(schemaGroup); - } - - if (GenerateConstructors) - { - foreach (var c in GetConstructors(DefaultConfiguration, DataContextObject.Name)) - { - if (c.BodyBuilders.Count > 0) - c.BodyBuilders.Add(() => new[] { "" }); - - if (schemas.Count > 0) - c.BodyBuilders.Add(() => new[] { "InitSchemas();" }); - - c.BodyBuilders.Add(() => new [] {"InitDataContext();", "InitMappingSchema();" }); - - DataContextObject.Members.Add(c); - } - } - - DataContextObject.Members.Add(new MemberGroup - { - IsCompact = true, - Members = - { - new Method(() => "void", "InitDataContext" ) { AccessModifier = AccessModifier.Partial }, - new Method(() => "void", "InitMappingSchema") { AccessModifier = AccessModifier.Partial } - } - }); - - if (Tables.Count > 0) - DataContextObject.Members.Insert(0, defProps); - - foreach (var schema in schemas.Values) - { - schema.Type.Members.Add(schema.DataContext); - schema.DataContext.Members.Insert(0, schema.Props); - - schema.DataContext.Members.Add(new Field (() => "IDataContext", "_dataContext") { AccessModifier = AccessModifier.Private, IsReadonly = true }); - schema.DataContext.Members.Add(new Method(() => null, schema.DataContext.Name, new Func<string>[] { () => "IDataContext dataContext" }, () => new[] { "_dataContext = dataContext;" })); - - foreach (var t in schema.Tables) - { - t.TypePrefix = schema.TypeName + "."; - } - } - - var associationExtensions = new MemberGroup() {Region = "Associations"}; - - foreach (var t in Tables.Values.OrderBy(tbl => tbl.IsProviderSpecific).ThenBy(tbl => tbl.TypeName)) - { - Action<Class> addType = tp => Model.Types.Add(tp); - var props = defProps; - var aliases = defAliases; - var tableExtensions = defTableExtensions; - - if (t.IsView && !GenerateViews) { - continue; - } - - var schema = t.Schema != null && schemas.ContainsKey(t.Schema) ? schemas[t.Schema] : null; - - if (schema != null) - { - var si = schemas[t.Schema]; - - addType = tp => si.Type.Members.Add(tp); - props = si.Props; - aliases = si.Aliases; - tableExtensions = si.TableExtensions; - } - - MemberBase dcProp = t.IsProviderSpecific ? - GenerateProviderSpecificTable(t) : - new Property( - () => string.Format("ITable<{0}>", t.TypeName), - t.DataContextPropertyName, - () => new[] { string.Format((schema == null ? "this" : "_dataContext") + ".GetTable<{0}>()", t.TypeName) }, - null); - - if (dcProp == null) continue; - - t.DataContextProperty = dcProp; - - props.Members.Add(dcProp); - - Property aProp = null; - - if (t.AliasPropertyName != null && t.AliasPropertyName != t.DataContextPropertyName) - { - aProp = new Property( - () => string.Format("ITable<{0}>", t.TypeName), - t.AliasPropertyName, - () => new[] { t.DataContextPropertyName }, - null); - - if (GenerateObsoleteAttributeForAliases) - aProp.Attributes.Add(new Attribute("Obsolete", ToStringLiteral("Use " + t.DataContextPropertyName + " instead."))); - - aliases.Members.Add(aProp); - } - - var tableAttrs = new List<string>(); - - if (DatabaseName != null) tableAttrs.Add("Database=" + ToStringLiteral(DatabaseName)); - if (t.Schema != null) tableAttrs.Add("Schema=" + ToStringLiteral(t.Schema)); - - tableAttrs.Add((tableAttrs.Count == 0 ? "" : "Name=") + ToStringLiteral(t.TableName)); - - if (t.IsView) - tableAttrs.Add("IsView=true"); - - t.Attributes.Add(new Attribute("Table", tableAttrs.ToArray()) { IsSeparated = true } ); - - var comments = new List<string>(); - - if (!string.IsNullOrWhiteSpace(t.Description)) - { - comments.Add("/ <summary>"); - foreach (var line in t.Description.Split('\n')) - comments.Add("/ " + line.TrimEnd()); - comments.Add("/ </summary>"); - } - - if (comments.Count > 0) - { - t. Comment.AddRange(comments); - dcProp.Comment.AddRange(comments); - - if (aProp != null) - aProp.Comment.AddRange(comments); - } - - var columns = new MemberGroup { IsCompact = IsCompactColumns }; - var columnAliases = new MemberGroup { IsCompact = IsCompactColumnAliases, Region = "Alias members" }; - var nPKs = t.Columns.Values.Count(c => c.IsPrimaryKey); - var allNullable = t.Columns.Values.All (c => c.IsNullable || c.IsIdentity); - var nameMaxLen = t.Columns.Values.Max (c => (int?)(c.MemberName == c.ColumnName - ? 0 - : ToStringLiteral(c.ColumnName).Length)) ?? 0; - var dbTypeMaxLen = t.Columns.Values.Max (c => (int?)(c.ColumnType.Length)) ?? 0; - var dataTypeMaxLen = t.Columns.Values.Where(c => c.DataType != null).Max (c => (int?)(c.DataType.Length)) ?? 0; - var dataTypePrefix = t.Columns.Values.Any (c => c.MemberName == "DataType") ? "LinqToDB." : ""; - - foreach (var c in t.Columns.Values) - { - // Column. - // - var ca = new Attribute("Column"); - var canBeReplaced = true; - - if (c.MemberName != c.ColumnName) - { - var columnNameInAttr = ToStringLiteral(c.ColumnName); - - var space = new string(' ', nameMaxLen - columnNameInAttr.Length); - - ca.Parameters.Add(columnNameInAttr + space); - canBeReplaced = false; - } - else if (nameMaxLen > 0) - { - ca.Parameters.Add(new string(' ', nameMaxLen)); - canBeReplaced = false; - } - - if (GenerateDbTypes) - { - var space = new string(' ', dbTypeMaxLen - c.ColumnType.Length); - - ca.Parameters.Add("DbType=" + ToStringLiteral(c.ColumnType) + space); - canBeReplaced = false; - } - - if (GenerateDataTypes) - { - var space = new string(' ', dataTypeMaxLen - c.DataType.Length); - ca.Parameters.Add("DataType=" + dataTypePrefix + c.DataType + space); - canBeReplaced = false; - } - - if (GenerateDataTypes && !GenerateLengthProperty.HasValue || GenerateLengthProperty == true) - { - if (c.Length != null) ca.Parameters.Add("Length=" + (c.Length == int.MaxValue ? "int.MaxValue" : c.Length.ToString())); - canBeReplaced = false; - } - - if (GenerateDataTypes && !GeneratePrecisionProperty.HasValue || GeneratePrecisionProperty == true) - { - if (c.Precision != null) ca.Parameters.Add("Precision=" + c.Precision); - canBeReplaced = false; - } - - if (GenerateDataTypes && !GenerateScaleProperty.HasValue || GenerateScaleProperty == true) - { - if (c.Scale != null) ca.Parameters.Add("Scale=" + c.Scale); - canBeReplaced = false; - } - - if (c.SkipOnInsert && !c.IsIdentity) - { - ca.Parameters.Add("SkipOnInsert=true"); - canBeReplaced = false; - } - - if (c.SkipOnUpdate && !c.IsIdentity) - { - ca.Parameters.Add("SkipOnUpdate=true"); - canBeReplaced = false; - } - - if (c.IsDiscriminator) - { - ca.Parameters.Add("IsDiscriminator=true"); - canBeReplaced = false; - } - - c.Attributes.Add(ca); - - // PK. - // - if (c.IsPrimaryKey) - { - var pka = new Attribute("PrimaryKey"); - - if (nPKs > 1) - pka.Parameters.Add(c.PrimaryKeyOrder.ToString()); - - if (canBeReplaced) - c.Attributes[0] = pka; - else - c.Attributes.Add(pka); - - canBeReplaced = false; - } - - // Identity. - // - if (c.IsIdentity) - { - var ida = new Attribute("Identity"); - - if (canBeReplaced) - c.Attributes[0] = ida; - else - c.Attributes.Add(ida); - - canBeReplaced = false; - } - - // Nullable. - // - if (c.IsNullable) - c.Attributes.Add(new Attribute((allNullable ? "" : " ") + "Nullable")); - else if (!c.IsIdentity) - c.Attributes.Add(new Attribute("NotNull")); - - var columnComments = new List<string>(); - - if (!string.IsNullOrWhiteSpace(c.Description)) - { - columnComments.Add("/ <summary>"); - foreach (var line in c.Description.Split('\n')) - columnComments.Add("/ " + line.TrimEnd()); - columnComments.Add("/ </summary>"); - } - - if (columnComments.Count > 0) - c.Comment.AddRange(columnComments); - - // End line comment. - // - c.EndLineComment = c.ColumnType; - - SetPropertyValue(c, "IsNotifying", true); - SetPropertyValue(c, "IsEditable", true); - - columns.Members.Add(c); - - // Alias. - // - if (c.AliasName != null && c.AliasName != c.MemberName) - { - var caProp = new Property( - c.TypeBuilder, - c.AliasName, - () => new[] { c.MemberName }, - () => new[] { c.MemberName + " = value;"}); - - caProp.Comment.AddRange(columnComments); - - if (GenerateObsoleteAttributeForAliases) - caProp.Attributes.Add(new Attribute("Obsolete", ToStringLiteral("Use " + c.MemberName + " instead."))); - - caProp.Attributes.Add(new Attribute("ColumnAlias" , ToStringLiteral(c.MemberName))); - - columnAliases.Members.Add(caProp); - } - } - - t.Members.Add(columns); - - if (columnAliases.Members.Count > 0) - t.Members.Add(columnAliases); - - if (GenerateAssociations || GenerateAssociationExtensions) - { - var keys = t.ForeignKeys.Values.ToList(); - - if (!GenerateBackReferences) - keys = keys.Where(k => k.BackReference != null).ToList(); - - if (keys.Count > 0) - { - var associations = new MemberGroup { Region = "Associations" }; - var extensionAssociations = new MemberGroup { Region = t.Name + " Associations"}; - - foreach (var key in keys.OrderBy(k => k.MemberName)) - { - key.Comment.Add("/ <summary>"); - key.Comment.Add("/ " + key.KeyName); - key.Comment.Add("/ </summary>"); - - if (key.AssociationType == AssociationType.OneToMany) - key.TypeBuilder = () => string.Format(OneToManyAssociationType, key.OtherTable.TypePrefix + key.OtherTable.TypeName); - else - key.TypeBuilder = () => key.OtherTable.TypePrefix + key.OtherTable.TypeName; - - var aa = new Attribute("Association"); - - aa.Parameters.Add("ThisKey=" + ToStringLiteral(string.Join(", ", (from c in key.ThisColumns select c.MemberName).ToArray()))); - aa.Parameters.Add("OtherKey=" + ToStringLiteral(string.Join(", ", (from c in key.OtherColumns select c.MemberName).ToArray()))); - aa.Parameters.Add("CanBeNull=" + (key.CanBeNull ? "true" : "false")); - - switch (key.AssociationType) - { - case AssociationType.OneToOne : aa.Parameters.Add("Relationship=Relationship.OneToOne"); break; - case AssociationType.OneToMany : aa.Parameters.Add("Relationship=Relationship.OneToMany"); break; - case AssociationType.ManyToOne : aa.Parameters.Add("Relationship=Relationship.ManyToOne"); break; - } - - if (key.BackReference != null) - { - if (!string.IsNullOrEmpty(key.KeyName)) - aa.Parameters.Add("KeyName=" + ToStringLiteral(key.KeyName)); - if (GenerateBackReferences && !string.IsNullOrEmpty(key.BackReference.MemberName)) - aa.Parameters.Add("BackReferenceName=" + ToStringLiteral(key.BackReference.MemberName)); - } - else - { - aa.Parameters.Add("IsBackReference=true"); - } - - key.Attributes.Add(aa); - - SetPropertyValue(key, "IsNotifying", true); - SetPropertyValue(key, "IsEditable", true); - - associations.Members.Add(key); - - var extension = new Method(() => string.Format("IQueryable<{0}>", key.OtherTable.TypePrefix + key.OtherTable.TypeName), GetAssociationExtensionPluralName(key)); - extension.Name = GetAssociationExtensionPluralName(key); - - extension.ParameterBuilders.Add(() => string.Format("this {0}{1} obj", t.TypePrefix, t.TypeName)); - - extension.ParameterBuilders.Add(() => "IDataContext db"); - extension.Attributes.Add(aa); - extension.IsStatic = true; - - extension.Comment.Add("/ <summary>"); - extension.Comment.Add("/ " + key.KeyName); - extension.Comment.Add("/ </summary>"); - - Func<string> builder = () => - { - var sb = new StringBuilder(); - sb - .Append("return db.GetTable<") - .Append(key.OtherTable.TypePrefix + key.OtherTable.TypeName) - .Append(">().Where(c => "); - for (var i = 0; i < key.OtherColumns.Count; i++) - { - sb.Append("c.") - .Append(key.OtherColumns[i].MemberName) - .Append(" == obj.") - .Append(key.ThisColumns[i].MemberName) - .Append(" && "); - } - sb.Length -= 4; - sb.Append(");"); - - return sb.ToString(); - }; - - extension.BodyBuilders.Add(() => new[] { builder() }); - - extensionAssociations.Members.Add(extension); - - if (key.AssociationType != AssociationType.OneToMany) - { - var single = new Method(() => t.TypePrefix + t.TypeName, GetAssociationExtensionSinglularName(key)); - - single.ParameterBuilders.Add(() => string.Format("this {0}{1} obj", key.OtherTable.TypePrefix, key.OtherTable.TypeName)); - - single.ParameterBuilders.Add(() => "IDataContext db"); - single.Attributes.Add(aa); - single.IsStatic = true; - - single.Comment.Add("/ <summary>"); - single.Comment.Add("/ " + key.KeyName); - single.Comment.Add("/ </summary>"); - - Func<string> builderSingle = () => - { - var sb = new StringBuilder(); - sb - .Append("return db.GetTable<") - .Append(t.TypePrefix + t.TypeName) - .Append(">().Where(c => "); - for (var i = 0; i < key.OtherColumns.Count; i++) - { - sb.Append("c.") - .Append(key.ThisColumns[i].MemberName) - .Append(" == obj.") - .Append(key.OtherColumns[i].MemberName) - .Append(" && "); - } - sb.Length -= 4; - sb.Append(");"); - - return sb.ToString(); - }; - - single.BodyBuilders.Add(() => - { - var sb = new StringBuilder(builderSingle()); - sb.Length -= 1; - - if (key.CanBeNull) - sb.Append(".FirstOrDefault();"); - else - sb.Append(".First();"); - - return new [] { sb.ToString() }; - }); - - extensionAssociations.Members.Add(single); - } - } - - if (GenerateAssociations) - t.Members.Add(associations); - if (GenerateAssociationExtensions) - associationExtensions.Members.Add(extensionAssociations); - } - } - - if (GenerateFindExtensions && nPKs > 0) - { - var PKs = t.Columns.Values.Where(c => c.IsPrimaryKey).ToList(); - var maxNameLen1 = PKs.Max(c => (int?)c.MemberName.Length) ?? 0; - var maxNameLen2 = PKs.Take(nPKs - 1).Max(c => (int?)c.MemberName.Length) ?? 0; - - tableExtensions.Members.Add( - new Method( - () => t.TypeName, - "Find", - new Func<string>[] { () => (string.Format("this ITable<{0}> table", t.TypeName)) } - .Union(PKs.Select(c => (Func<string>)(() => c.BuildType() + " " + c.MemberName))), - () => new[] { "return table.FirstOrDefault(t =>" } - .Union(PKs.SelectMany((c,i) => - { - var ss = new List<string>(); - - if (c.Conditional != null) - ss.Add("#if " + c.Conditional); - - ss.Add(BuildColumnComparison(c, LenDiff(maxNameLen1, c.MemberName), LenDiff(maxNameLen2, c.MemberName), i == nPKs - 1)); - - if (c.Conditional != null) - { - if (ss[1].EndsWith(");")) - { - ss[1] = ss[1].Substring(0, ss[1].Length - 2); - ss.Add("#endif"); - ss.Add("\t\t);"); - } - else - { - ss.Add("#endif"); - } - } - - return ss; - }))) - { - IsStatic = true - }); - } - - addType(t); - - if (!string.IsNullOrWhiteSpace(t.AliasTypeName)) - { - var aClass = new Class(t.AliasTypeName) - { - BaseClass = t.TypeName - }; - - if (comments.Count > 0) - aClass.Comment.AddRange(comments); - - if (GenerateObsoleteAttributeForAliases) - aClass.Attributes.Add(new Attribute("Obsolete", ToStringLiteral("Use " + t.TypeName + " instead."))); - - Model.Types.Add(aClass); - } - } - - if (associationExtensions.Members.Count > 0) - defTableExtensions.Members.Add(associationExtensions); - - if (defAliases.Members.Count > 0) - DataContextObject.Members.Add(defAliases); - - foreach (var schema in schemas.Values) - if (schema.Aliases.Members.Count > 0) - schema.Type.Members.Add(defAliases); - - if (Procedures.Count > 0) - { - Model.Usings.Add("System.Collections.Generic"); - Model.Usings.Add("System.Data"); - Model.Usings.Add("LinqToDB.Data"); - Model.Usings.Add("LinqToDB.Common"); - - if (Procedures.Values.Any(p => p.IsTableFunction)) - Model.Usings.Add("System.Reflection"); - - if (Procedures.Values.Any(p => p.IsAggregateFunction)) - Model.Usings.Add("System.Linq.Expressions"); - - var procs = new MemberGroup(); - var funcs = new MemberGroup(); - var tabfs = new MemberGroup { Region = "Table Functions" }; - - foreach (var p in Procedures.Values.Where( - proc => proc.IsLoaded || proc.IsFunction && !proc.IsTableFunction || - proc.IsTableFunction && proc.ResultException != null - )) - { - Action<MemberGroup> addProcs = tp => procs.Members.Add(tp); - Action<MemberGroup> addFuncs = tp => funcs.Members.Add(tp); - Action<MemberGroup> addTabfs = tp => tabfs.Members.Add(tp); - - var thisDataContext = "this"; - - var schema = p.Schema != null && schemas.ContainsKey(p.Schema) ? schemas[p.Schema] : null; - - if (schema != null) - { - var si = schemas[p.Schema]; - - addProcs = tp => si.Procedures. Members.Add(tp); - addFuncs = tp => si.Functions. Members.Add(tp); - addTabfs = tp => si.TableFunctions.Members.Add(tp); - thisDataContext = "_dataContext"; - } - - var proc = new MemberGroup { Region = p.Name }; - - if (!p.IsFunction) addProcs(proc); - else if (p.IsTableFunction) addTabfs(proc); - else addFuncs(proc); - - if (p.ResultException != null) - { - proc.Errors.Add(p.ResultException.Message); - continue; - } - - proc.Members.Add(p); - - if (p.IsTableFunction) - { - var tableAttrs = new List<string>(); - - if (DatabaseName != null) tableAttrs.Add("Database=" + ToStringLiteral(DatabaseName)); - if (p.Schema != null) tableAttrs.Add("Schema=" + ToStringLiteral(p.Schema)); - - tableAttrs.Add("Name=" + ToStringLiteral(p.ProcedureName)); - - p.Attributes.Add(new Attribute("Sql.TableFunction", tableAttrs.ToArray())); - - p.TypeBuilder = () => "ITable<" + p.ResultTable.TypeName + ">"; - } - else if (p.IsAggregateFunction) - { - p.IsStatic = true; - p.TypeBuilder = () => p.ProcParameters.Single(pr => pr.IsResult).ParameterType; - var paramCount = p.ProcParameters.Count(pr => !pr.IsResult); - p.Attributes.Add(new Attribute("Sql.Function", "Name=" + ToStringLiteral((p.Schema != null ? p.Schema + "." : null) + p.ProcedureName), "ServerSideOnly=true, IsAggregate = true" + (paramCount > 0 ? (", ArgIndices = new[] { " + string.Join(", ", Enumerable.Range(0, p.ProcParameters.Count(pr => !pr.IsResult))) + " }") : null))); - - if (p.IsDefaultSchema || !GenerateSchemaAsType) - p.ParameterBuilders.Add(() => "this IEnumerable<TSource> src"); - else // otherwise function will be generated in nested class, which doesn't support extension methods - p.ParameterBuilders.Add(() => "IEnumerable<TSource> src"); - - foreach (var inp in p.ProcParameters.Where(pr => !pr.IsResult)) - p.ParameterBuilders.Add(() => $"Expression<Func<TSource, {inp.ParameterType}>> " + inp.ParameterName); - - p.Name += "<TSource>"; - } - else if (p.IsFunction) - { - p.IsStatic = true; - p.TypeBuilder = () => p.ProcParameters.Single(pr => pr.IsResult).ParameterType; - p.Attributes.Add(new Attribute("Sql.Function", "Name=" + ToStringLiteral((p.Schema != null ? p.Schema + "." : null) + p.ProcedureName), "ServerSideOnly=true")); - } - else - { - p.IsStatic = true; - p.TypeBuilder = () => p.ResultTable == null - ? "int" - : GenerateProcedureResultAsList - ? "List<" + p.ResultTable.TypeName + ">" - : "IEnumerable<" + p.ResultTable.TypeName + ">"; - - if (p.IsDefaultSchema || !GenerateSchemaAsType) - p.ParameterBuilders.Add(() => "this DataConnection dataConnection"); - else - p.ParameterBuilders.Add(() => "DataConnection dataConnection"); - } - - if (!p.IsAggregateFunction) - foreach (var pr in p.ProcParameters.Where(par => !par.IsResult)) - p.ParameterBuilders.Add(() => string.Format("{0}{1} {2}", - pr.IsOut ? pr.IsIn ? "ref " : "out " : "", pr.ParameterType, pr.ParameterName)); - - if (p.IsTableFunction) - { - p.BodyBuilders.Add(() => new[] - { - string.Format("return " + thisDataContext + ".GetTable<{0}>(this, (MethodInfo)MethodBase.GetCurrentMethod()", p.ResultTable.TypeName) - + (p.ProcParameters.Count == 0 ? ");" : ",") - }); - - for (var idx = 0; idx < p.ProcParameters.Count; idx++) - { - var i = idx; - p.BodyBuilders.Add(() => new []{ "\t" + p.ProcParameters[i].ParameterName + (i + 1 == p.ProcParameters.Count ? ");" : ",") }); - } - } - else if (p.IsFunction) - { - p.BodyBuilders.Add(() => new [] { "throw new InvalidOperationException();" }); - } - else - { - var spName = - SqlBuilder.BuildTableName( - new System.Text.StringBuilder(), - (string)SqlBuilder.Convert(DatabaseName, LinqToDB.SqlProvider.ConvertType.NameToDatabase), - (string)SqlBuilder.Convert(p.Schema, LinqToDB.SqlProvider.ConvertType.NameToSchema), - (string)SqlBuilder.Convert(p.ProcedureName, LinqToDB.SqlProvider.ConvertType.NameToQueryTable) - ).ToString(); - - spName = ToStringLiteral(spName); - - var inputParameters = p.ProcParameters.Where(pp => pp.IsIn). ToList(); - var outputParameters = p.ProcParameters.Where(pp => pp.IsOut). ToList(); - var inOrOutputParameters = p.ProcParameters.Where(pp => pp.IsIn || pp.IsOut).ToList(); - - spName += inOrOutputParameters.Count == 0 - ? (p.ResultTable == null || !GenerateProcedureResultAsList ? ");" : ").ToList();") - : ","; - - var retName = "ret"; - var retNo = 0; - - while (p.ProcParameters.Any(pp => pp.ParameterName == retName)) - retName = "ret" + ++retNo; - - var hasOut = outputParameters.Any(pr => pr.IsOut); - var prefix = hasOut ? "var " + retName + " = " : "return "; - - if (p.ResultTable == null) - p.BodyBuilders.Add(() => new [] { prefix + "dataConnection.ExecuteProc(" + spName }); - else - { - if (p.ResultTable.Columns.Values.Any(c => c.IsDuplicateOrEmpty)) - { - p.BodyBuilders.Add(() => new [] - { - "var ms = dataConnection.MappingSchema;", - "", - prefix + "dataConnection.QueryProc(dataReader =>", - "\tnew " + p.ResultTable.TypeName, - "\t{" - }); - - var n = 0; - var maxNameLen = p.ResultTable.Columns.Values.Max(c => (int?)c.MemberName .Length) ?? 0; - var maxTypeLen = p.ResultTable.Columns.Values.Max(c => (int?)c.BuildType().Length) ?? 0; - - foreach (var c in p.ResultTable.Columns.Values) - { - p.BodyBuilders.Add(() => new [] {string.Format("\t\t{0}{1} = Converter.ChangeTypeTo<{2}>{3}(dataReader.GetValue({4}), ms),", - c.MemberName, LenDiff(maxNameLen, c.MemberName), c.BuildType(), LenDiff(maxTypeLen, c.BuildType()), n++) }); - } - - p.BodyBuilders.Add(() => new [] {"\t},", "\t" + spName }); - } - else - { - p.BodyBuilders.Add(() => new [] { prefix + "dataConnection.QueryProc<" + p.ResultTable.TypeName + ">(" + spName }); - } - } - - var maxLenSchema = inputParameters.Max(pr => (int?)pr.SchemaName. Length) ?? 0; - var maxLenParam = inputParameters.Max(pr => (int?)pr.ParameterName.Length) ?? 0; - var maxLenType = inputParameters.Max(pr => (int?)("DataType." + pr.DataType).Length) ?? 0; - - for (var idx = 0; idx < inOrOutputParameters.Count; idx++) - { - var i = idx; - var pr = inOrOutputParameters[i]; - - p.BodyBuilders.Add(() => - { - var str = string.Format( - !pr.IsIn && pr.IsOut - ? "\tnew DataParameter({0}, null, {3}{4})" - : "\tnew DataParameter({0}, {1}{2}, {3}{4})" + (GenerateProcedureDbType(pr) ? "{{ DbType = {5} }}" : null), - ToStringLiteral(pr.SchemaName), - LenDiff(maxLenSchema, pr.SchemaName), - pr.ParameterName, - LenDiff(maxLenParam, pr.ParameterName), - "DataType." + pr.DataType, - ToStringLiteral(pr.SchemaType)); - - if (pr.IsOut) - { - str += LenDiff(maxLenType, "DataType." + pr.DataType); - str += " { Direction = " + (pr.IsIn ? "ParameterDirection.InputOutput" : "ParameterDirection.Output"); - - if (pr.Size != null && pr.Size.Value != 0) - str += ", Size = " + pr.Size.Value; - - str += " }"; - } - - // we need to call ToList(), because otherwise output parameters will not be updated - // with values. See https://msdn.microsoft.com/en-us/library/ms971497#gazoutas_topic6 - str += i + 1 == inOrOutputParameters.Count - ? ((GenerateProcedureResultAsList || outputParameters.Count > 0) && p.ResultTable != null ? ").ToList();" : ");") - : ","; - - return new [] { str }; - }); - } - - if (hasOut) - { - maxLenSchema = outputParameters.Max(pr => (int?)pr.SchemaName. Length) ?? 0; - maxLenParam = outputParameters.Max(pr => (int?)pr.ParameterName.Length) ?? 0; - maxLenType = outputParameters.Max(pr => (int?)pr.ParameterType.Length) ?? 0; - - p.BodyBuilders.Add(() => new [] { string.Empty }); - - foreach (var pr in p.ProcParameters.Where(_ => _.IsOut)) - { - p.BodyBuilders.Add(() => new [] { string.Format("{0} {1}= Converter.ChangeTypeTo<{2}>{3}(((IDbDataParameter)dataConnection.Command.Parameters[{4}]).{5}Value);", - pr.ParameterName, - LenDiff(maxLenParam, pr.ParameterName), - pr.ParameterType, - LenDiff(maxLenType, pr.ParameterType), - ToStringLiteral(pr.SchemaName), - LenDiff(maxLenSchema, pr.SchemaName)) }); - } - - p.BodyBuilders.Add(() => new [] {"", "return " + retName + ";" }); - } - } - - if (p.ResultTable != null && p.ResultTable.DataContextPropertyName == null) - { - var columns = new MemberGroup { IsCompact = true }; - - foreach (var c in p.ResultTable.Columns.Values) - { - if (c.MemberName != c.ColumnName) - c.Attributes.Add(new Attribute("Column") { Parameters = { ToStringLiteral(c.ColumnName) } }); - columns.Members.Add(c); - } - - p.ResultTable.Members.Add(columns); - proc.Members.Add(p.ResultTable); - } - } - - if (procs.Members.Count > 0) - Model.Types.Add(new Class(DataContextObject.Name + "StoredProcedures", procs) { IsStatic = true }); - - if (funcs.Members.Count > 0) - Model.Types.Add(new Class("SqlFunctions", funcs) { IsStatic = true }); - - if (tabfs.Members.Count > 0) - DataContextObject.Members.Add(tabfs); - - MakeTypeMembersNamesUnique(DataContextObject, "InitDataContext", "InitMappingSchema"); - MakeMembersNamesUnique(Model.Types, "Table"); - foreach (var type in Model.Types.OfType<Class>()) - MakeTypeMembersNamesUnique(type, exceptMethods: new [] { "Find", "InitDataContext", "InitMappingSchema" }); - - foreach (var schema in schemas.Values) - { - if (schema.Procedures.Members.Count > 0) - schema.Type.Members.Add(new Class(DataContextObject.Name + "StoredProcedures", schema.Procedures) { IsStatic = true }); - - if (schema.Functions.Members.Count > 0) - schema.Type.Members.Add(new Class("SqlFunctions", schema.Functions) { IsStatic = true }); - - if (schema.TableFunctions.Members.Count > 0) - schema.DataContext.Members.Add(schema.TableFunctions); - - MakeTypeMembersNamesUnique(schema.DataContext, "InitDataContext", "InitMappingSchema"); - foreach (var type in schema.Type.Members.OfType<Class>()) - MakeTypeMembersNamesUnique(type); - } - } - - if (defTableExtensions.Members.Count > 0) - { - Model.Usings.Add("System.Linq"); - var tableExtensions = new Class("TableExtensions", defTableExtensions) { IsStatic = true }; - Model.Types.Add(tableExtensions); - MakeTypeMembersNamesUnique(tableExtensions, exceptMethods: new [] { "Find" }); - } - - foreach (var schema in schemas.Values) - { - Model.Types.Add(schema.Type); - - if (schema.TableExtensions.Members.Count > 0) - { - Model.Usings.Add("System.Linq"); - schema.Type.Members.Add(schema.TableExtensions); - } - } - - Tables. Clear(); - Procedures.Clear(); - - Model.SetTree(); - - AfterGenerateLinqToDBModel(); -} - -void MakeTypeMembersNamesUnique(Class type, string defaultName = "Member", params string[] exceptMethods) -{ - var reservedNames = new [] { type.Name }; - if (exceptMethods != null && exceptMethods.Length > 0) - reservedNames = reservedNames.Concat(exceptMethods).ToArray(); - - MakeMembersNamesUnique(GetAllClassMembers(type.Members, exceptMethods), defaultName, reservedNames); -} - -void MakeMembersNamesUnique(IEnumerable<IClassMember> members, string defaultName, params string[] reservedNames) -{ - LinqToDB.Common.Utils.MakeUniqueNames( - members, - reservedNames, - m => m is Table tbl ? (tbl.Schema != null && !tbl.IsDefaultSchema && PrefixTableMappingWithSchema ? tbl.Schema + "_" : null) + tbl.Name : (m is TypeBase t ? t.Name : ((MemberBase)m).Name), - (m, newName) => - { - if (m is TypeBase t) - t.Name = newName; - else - ((MemberBase)m).Name = newName; - }, - defaultName); -} - -IEnumerable<IClassMember> GetAllClassMembers(IEnumerable<IClassMember> members, params string[] exceptMethods) -{ - foreach (var member in members) - { - if (member is MemberGroup mg) - foreach (var m in GetAllClassMembers(mg.Members, exceptMethods)) - yield return m; - // constructors don't have own type/flag - else if (member is Method method && (method.BuildType() == null || (exceptMethods != null && exceptMethods.Contains(method.Name)))) - continue; - else - yield return member; - } -} - -// left for backward compatibility -string NormalizeStringName(string name) -{ - return ToStringLiteral(name); -} - -#> diff --git a/src/Migrator/LinqToDB.Templates/MultipleFiles.ttinclude b/src/Migrator/LinqToDB.Templates/MultipleFiles.ttinclude deleted file mode 100644 index 4b43ba0..0000000 --- a/src/Migrator/LinqToDB.Templates/MultipleFiles.ttinclude +++ /dev/null @@ -1,70 +0,0 @@ -<#@ assembly name="System.Core" #> -<#@ assembly name="EnvDTE" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.IO" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="EnvDTE" #> -<#+ -DTE _dte; -DTE DTE => _dte ?? (_dte = (DTE)((IServiceProvider)Host).GetService(typeof(DTE))); - -ProjectItem _templateProjectItem; -ProjectItem TemplateProjectItem => _templateProjectItem ?? (_templateProjectItem = DTE.Solution.FindProjectItem(Host.TemplateFile)); - -readonly Dictionary<string,int> _fileNames = new Dictionary<string,int>(); - -Func<string,string,bool> CompareContent = (s1,s2) => s1 == s2; - -void SaveOutput(string fileName, int fileType = 1) -{ - var dir = Path.GetDirectoryName(Host.TemplateFile); - var output = Path.Combine(dir, fileName); - var newContent = GenerationEnvironment.ToString(); - var oldContent = File.Exists(output) ? File.ReadAllText(output) : ""; - - if (!CompareContent(newContent, oldContent)) - { - if (DTE.SourceControl != null && DTE.SourceControl.IsItemUnderSCC(output) && !DTE.SourceControl.IsItemCheckedOut(output)) - DTE.SourceControl.CheckOutItem(output); - - File.WriteAllText(output, newContent); - } - - GenerationEnvironment.Length = 0; - - _fileNames.Add(output, fileType); -} - -void SyncProject() -{ - var keepFileNames = _fileNames.ToDictionary(f => f.Key); - var projectFiles = new Dictionary<string,ProjectItem>(); - var templateFileName = TemplateProjectItem.FileNames[0]; - var originalFilePrefix = Path.GetFileNameWithoutExtension(templateFileName) + "."; - - foreach (ProjectItem projectItem in TemplateProjectItem.ProjectItems) - { - projectFiles.Add(projectItem.FileNames[0], projectItem); - } - - foreach (var pair in projectFiles) - { - if (!keepFileNames.ContainsKey(pair.Key)) - if (!(Path.GetFileNameWithoutExtension(pair.Key) + ".").StartsWith(originalFilePrefix)) - //if (pair.Key != templateFileName) - pair.Value.Delete(); - } - - // Add missing files to the project. - // - foreach (var fileName in keepFileNames) - { - if (!projectFiles.ContainsKey(fileName.Value.Key)) - if (File.Exists(fileName.Value.Key)) - { - var newItem = TemplateProjectItem.ProjectItems.AddFromFile(fileName.Value.Key); - newItem.Properties.Item("BuildAction").Value = fileName.Value.Value; - } - } -} -#> diff --git a/src/Migrator/LinqToDB.Templates/NotifyDataErrorInfo.ttinclude b/src/Migrator/LinqToDB.Templates/NotifyDataErrorInfo.ttinclude deleted file mode 100644 index 06e72af..0000000 --- a/src/Migrator/LinqToDB.Templates/NotifyDataErrorInfo.ttinclude +++ /dev/null @@ -1,133 +0,0 @@ -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - beforeGenerateModel(); - NotifyDataErrorInfoImpl(); - }; - } -#> -<#+ -void NotifyDataErrorInfoImpl() -{ - foreach (var prop in GetTreeNodes(Model).OfType<Property>().Where(p => p.CustomValidation).ToList()) - { - ITree p = prop.Parent; - - while (!(p is Class) && p != null) - p = p.Parent; - - if (p != null) - { - var cl = (Class)p; - - if (!cl.Interfaces.Contains("INotifyDataErrorInfo")) - { - if (!Model.Usings.Contains("System.ComponentModel")) Model.Usings.Add("System.ComponentModel"); - if (!Model.Usings.Contains("System.Collections")) Model.Usings.Add("System.Collections"); - if (!Model.Usings.Contains("System.Linq")) Model.Usings.Add("System.Linq"); - - cl.Interfaces.Add("INotifyDataErrorInfo"); - - cl.Members.Add(new MemberGroup - { - Region = "INotifyDataErrorInfo support", - Members = - { - new Event(() => "EventHandler<DataErrorsChangedEventArgs>", "ErrorsChanged") - { - IsVirtual = true, - Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } - }, - new Field(() => "Dictionary<string,List<string>>", "_validationErrors") - { - InitValue = "new Dictionary<string,List<string>>()", - AccessModifier = AccessModifier.Private, - IsReadonly = true, - Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } - }, - new Method(() => "void", "AddError", - new Func<string>[] - { - () => "string propertyName", - () => "string error" - }, - () => new[] - { - "List<string> errors;", - "", - "if (!_validationErrors.TryGetValue(propertyName, out errors))", - "{", - "\t_validationErrors[propertyName] = new List<string> { error };", - "}", - "else if (!errors.Contains(error))", - "{", - "\terrors.Add(error);", - "}", - "else", - "\treturn;", - "", - "OnErrorsChanged(propertyName);", - }) - { - AccessModifier = AccessModifier.Public - }, - new Method(() => "void", "RemoveError", - new Func<string>[] - { - () => "string propertyName", - }, - () => new[] - { - "List<string> errors;", - "", - "if (_validationErrors.TryGetValue(propertyName, out errors) && errors.Count > 0)", - "{", - "\t_validationErrors.Clear();", - "\tOnErrorsChanged(propertyName);", - "}", - }) - { - AccessModifier = AccessModifier.Public - }, - new Method(() => "void", "OnErrorsChanged", - new Func<string>[] - { - () => "string propertyName", - }, - () => new[] - { - "if (ErrorsChanged != null)", - "{", - "\tif (System.Windows.Deployment.Current.Dispatcher.CheckAccess())", - "\t\tErrorsChanged(this, new DataErrorsChangedEventArgs(propertyName));", - "\telse", - "\t\tSystem.Windows.Deployment.Current.Dispatcher.BeginInvoke(", - "\t\t\t() => ErrorsChanged(this, new DataErrorsChangedEventArgs(propertyName)));", - "}", - }) - { - AccessModifier = AccessModifier.Protected - }, - new Method(() => "IEnumerable", "GetErrors", - new Func<string>[] - { - () => "string propertyName", - }, - () => new[] - { - "List<string> errors;", - "return propertyName != null && _validationErrors.TryGetValue(propertyName, out errors) ? errors : null;", - }) - { - AccessModifier = AccessModifier.Public - }, - new Property(() => "bool", "HasErrors").InitGetter(() => new [] { "_validationErrors.Values.Any(e => e.Count > 0)" }) - } - }); - } - } - } -} -#> diff --git a/src/Migrator/LinqToDB.Templates/NotifyPropertyChanged.ttinclude b/src/Migrator/LinqToDB.Templates/NotifyPropertyChanged.ttinclude deleted file mode 100644 index 49234e7..0000000 --- a/src/Migrator/LinqToDB.Templates/NotifyPropertyChanged.ttinclude +++ /dev/null @@ -1,382 +0,0 @@ -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - beforeGenerateModel(); - NotifyPropertyChangedImpl(); - }; - - SetPropertyValueAction += (obj,prop,val) => - { - if (prop == "IsNotifying") - obj.IsNotifying = (bool)val; - }; - } -#><#+ -public bool ImplementNotifyPropertyChanging; -public bool SkipNotifyPropertyChangedImplementation = false; - -void NotifyPropertyChangedImpl() -{ - foreach (Property prop in GetTreeNodes(Model).OfType<Property>().Where(p => p.IsNotifying).ToList()) - { - List<IClassMember> parentMembers; - - MemberGroup gr = null; - - if (prop.Parent is Class) - { - var parent = (Class)prop.Parent; - parentMembers = parent.Members; - } - else - { - var parent = (MemberGroup)prop.Parent; - - parent.IsCompact = false; - - parentMembers = parent.Members; - - if (parent.IsPropertyGroup) - gr = parent; - } - - var name = prop.Name.Trim(); - var type = prop.BuildType().Trim(); - - if (gr == null) - { - gr = new MemberGroup - { - Region = name + " : " + type, - Members = { prop }, - IsPropertyGroup = true, - }; - - var index = parentMembers.IndexOf(prop); - - parentMembers.RemoveAt(index); - parentMembers.Insert (index, gr); - } - - if (prop.IsAuto) - { - var field = new Field(() => type, "_" + ToCamelCase(name)) - { - AccessModifier = AccessModifier.Private, - InsertBlankLineAfter = false, - }; - - if (prop.InitValue != null) - field.InitValue = prop.InitValue; - - gr.Members.Insert(0, field); - - prop.Name = " " + name; - prop.TypeBuilder = () => " " + type; - prop.IsAuto = false; - - if (prop.HasGetter) prop.GetBodyBuilders.Add(() => new [] { "return " + field.Name + ";" }); - if (prop.HasSetter) prop.SetBodyBuilders.Add(() => new [] { field.Name + " = value;" }); - } - - var methods = new MemberGroup - { - Region = "INotifyPropertyChanged support", - Members = - { - new Field(() => "const string", "NameOf" + name) - { - InitValue = ToStringLiteral(name), - AccessModifier = AccessModifier.Public, - }, - new Field(() => "PropertyChangedEventArgs", "_" + ToCamelCase(name) + "ChangedEventArgs") - { - InitValue = "new PropertyChangedEventArgs(NameOf" + name + ")", - AccessModifier = AccessModifier.Private, - IsStatic = true, - IsReadonly = true, - }, - new Method(() => "void", "On" + name + "Changed", null, - () => new[] { "OnPropertyChanged(_" + ToCamelCase(name) + "ChangedEventArgs);" }) - { - AccessModifier = AccessModifier.Private - } - } - }; - - gr.Members.Add(methods); - - if (prop.Dependents.Count == 0) - prop.Dependents.Add(name); - - if (ImplementNotifyPropertyChanging) - { - gr.Members.Add(new MemberGroup - { - Region = "INotifyPropertyChanging support", - Members = - { - new Field(() => "PropertyChangingEventArgs", "_" + ToCamelCase(name) + "ChangingEventArgs") - { - InitValue = "new PropertyChangingEventArgs(NameOf" + name + ")", - AccessModifier = AccessModifier.Private, - IsStatic = true, - IsReadonly = true, - }, - new Method(() => "void", "On" + name + "Changing", null, - () => new[] { "OnPropertyChanging(_" + ToCamelCase(name) + "ChangingEventArgs);" }) - { - AccessModifier = AccessModifier.Private - } - } - }); - } - - if (prop.HasSetter) - { - var setBody = prop.BuildSetBody().Select(s => "\t" + s).ToArray(); - prop.SetBodyBuilders.Clear(); - prop.SetBodyBuilders.Add(() => setBody); - - string getValue; - - var getBody = prop.BuildGetBody().ToArray(); - if (getBody.Length == 1 && getBody[0].StartsWith("return")) - { - getValue = getBody[0].Substring("return".Length).Trim(' ', '\t', ';'); - } - else - { - getValue = name; - } - - var insSpaces = setBody.Length > 1; - var n = 0; - - prop.SetBodyBuilders.Insert(n++, () => new [] {"if (" + getValue + " != value)", "{" }); - - if (ImplementNotifyPropertyChanging) - { - foreach (var dp in prop.Dependents) - prop.SetBodyBuilders.Insert(n++, () => new [] { "\tOn" + dp + "Changing();" }); - prop.SetBodyBuilders.Insert(n++, () => new [] { "" }); - } - - prop.SetBodyBuilders.Insert(n++, () => new [] { "\tBefore" + name + "Changed(value);" }); - - if (insSpaces) - { - prop.SetBodyBuilders.Insert(3, () => new [] { "" }); - prop.SetBodyBuilders.Add(() => new [] { "" }); - } - - prop.SetBodyBuilders.Add(() => new [] { "\tAfter" + name + "Changed();" }); - prop.SetBodyBuilders.Add(() => new [] { "" }); - - foreach (var dp in prop.Dependents) - prop.SetBodyBuilders.Add(() => new [] { "\tOn" + dp + "Changed();" }); - - prop.SetBodyBuilders.Add(() => new [] { "}" }); - - methods.Members.Insert(0, new MemberGroup - { - IsCompact = true, - Members = - { - new Method(() => "void", "Before" + name + "Changed", new Func<string>[] { () => type + " newValue" }) { AccessModifier = AccessModifier.Partial }, - new Method(() => "void", "After" + name + "Changed") { AccessModifier = AccessModifier.Partial }, - } - }); - } - - prop.Parent.SetTree(); - - ITree p = prop.Parent; - - while (!(p is Class) && p != null) - p = p.Parent; - - if (p != null) - { - var cl = (Class)p; - - if (!SkipNotifyPropertyChangedImplementation && !cl.Interfaces.Contains("INotifyPropertyChanged")) - { - if (!Model.Usings.Contains("System.ComponentModel")) - Model.Usings.Add("System.ComponentModel"); - - cl.Interfaces.Add("INotifyPropertyChanged"); - - cl.Members.Add(new MemberGroup - { - Region = "INotifyPropertyChanged support", - Members = - { - new Event(() => "PropertyChangedEventHandler", "PropertyChanged") - { - IsVirtual = true, - Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } - }, - new Method(() => "void", "OnPropertyChanged", new Func<string>[] { () => "string propertyName" }, () => OnPropertyChangedBody) - { - AccessModifier = AccessModifier.Protected - }, - new Method(() => "void", "OnPropertyChanged", new Func<string>[] { () => "PropertyChangedEventArgs arg" }, () => OnPropertyChangedArgBody) - { - AccessModifier = AccessModifier.Protected - }, - } - }); - } - - if (ImplementNotifyPropertyChanging && !cl.Interfaces.Contains("INotifyPropertyChanging")) - { - if (!Model.Usings.Contains("System.ComponentModel")) - Model.Usings.Add("System.ComponentModel"); - - cl.Interfaces.Add("INotifyPropertyChanging"); - - cl.Members.Add(new MemberGroup - { - Region = "INotifyPropertyChanging support", - Members = - { - new Event(() => "PropertyChangingEventHandler", "PropertyChanging") - { - IsVirtual = true, - Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } - }, - new Method(() => "void", "OnPropertyChanging", new Func<string>[] { () => "string propertyName" }, () => OnPropertyChangingBody) - { - AccessModifier = AccessModifier.Protected - }, - new Method(() => "void", "OnPropertyChanging", new Func<string>[] { () => "PropertyChangingEventArgs arg" }, () => OnPropertyChangingArgBody) - { - AccessModifier = AccessModifier.Protected - }, - } - }); - } - } - } -} - -public string[] OnPropertyChangedBody = new[] -{ - "var propertyChanged = PropertyChanged;", - "", - "if (propertyChanged != null)", - "{", - "#if SILVERLIGHT", - "\tif (System.Windows.Deployment.Current.Dispatcher.CheckAccess())", - "\t\tpropertyChanged(this, new PropertyChangedEventArgs(propertyName));", - "\telse", - "\t\tSystem.Windows.Deployment.Current.Dispatcher.BeginInvoke(", - "\t\t\t() =>", - "\t\t\t{", - "\t\t\t\tvar pc = PropertyChanged;", - "\t\t\t\tif (pc != null)", - "\t\t\t\t\tpc(this, new PropertyChangedEventArgs(propertyName));", - "\t\t\t});", - "#else", - "\tpropertyChanged(this, new PropertyChangedEventArgs(propertyName));", - "#endif", - "}", -}; - -public string[] OnPropertyChangedArgBody = new[] -{ - "var propertyChanged = PropertyChanged;", - "", - "if (propertyChanged != null)", - "{", - "#if SILVERLIGHT", - "\tif (System.Windows.Deployment.Current.Dispatcher.CheckAccess())", - "\t\tpropertyChanged(this, arg);", - "\telse", - "\t\tSystem.Windows.Deployment.Current.Dispatcher.BeginInvoke(", - "\t\t\t() =>", - "\t\t\t{", - "\t\t\t\tvar pc = PropertyChanged;", - "\t\t\t\tif (pc != null)", - "\t\t\t\t\tpc(this, arg);", - "\t\t\t});", - "#else", - "\tpropertyChanged(this, arg);", - "#endif", - "}", -}; - -public string[] OnPropertyChangingBody = new[] -{ - "var propertyChanging = PropertyChanging;", - "", - "if (propertyChanging != null)", - "{", - "#if SILVERLIGHT", - "\tif (System.Windows.Deployment.Current.Dispatcher.CheckAccess())", - "\t\tpropertyChanging(this, new PropertyChangingEventArgs(propertyName));", - "\telse", - "\t\tSystem.Windows.Deployment.Current.Dispatcher.BeginInvoke(", - "\t\t\t() =>", - "\t\t\t{", - "\t\t\t\tvar pc = PropertyChanging;", - "\t\t\t\tif (pc != null)", - "\t\t\t\t\tpc(this, new PropertyChangingEventArgs(propertyName));", - "\t\t\t});", - "#else", - "\tpropertyChanging(this, new PropertyChangingEventArgs(propertyName));", - "#endif", - "}", -}; - -public string[] OnPropertyChangingArgBody = new[] -{ - "var propertyChanging = PropertyChanging;", - "", - "if (propertyChanging != null)", - "{", - "#if SILVERLIGHT", - "\tif (System.Windows.Deployment.Current.Dispatcher.CheckAccess())", - "\t\tpropertyChanging(this, arg);", - "\telse", - "\t\tSystem.Windows.Deployment.Current.Dispatcher.BeginInvoke(", - "\t\t\t() =>", - "\t\t\t{", - "\t\t\t\tvar pc = PropertyChanging;", - "\t\t\t\tif (pc != null)", - "\t\t\t\t\tpc(this, arg);", - "\t\t\t});", - "#else", - "\tpropertyChanging(this, arg);", - "#endif", - "}", -}; - -partial class Property -{ - public bool IsNotifying; - public List<string> Dependents = new List<string>(); -} - -class NotifyingProperty : Property -{ - public NotifyingProperty() - { - IsNotifying = true; - } - - public NotifyingProperty(string type, string name, params string[] dependents) - : base(() => type, name, null, null) - { - IsNotifying = true; - - if (dependents.Length == 0) - Dependents.Add(name); - else - Dependents.AddRange(dependents); - } -} -#> diff --git a/src/Migrator/LinqToDB.Templates/ObsoleteAttributes.ttinclude b/src/Migrator/LinqToDB.Templates/ObsoleteAttributes.ttinclude deleted file mode 100644 index b95b0d8..0000000 --- a/src/Migrator/LinqToDB.Templates/ObsoleteAttributes.ttinclude +++ /dev/null @@ -1,100 +0,0 @@ -<# - { - var beforeGenerateLinqToDBModel = BeforeGenerateLinqToDBModel; - var afterGenerateLinqToDBModel = AfterGenerateLinqToDBModel; - - var obsoleteTables = new List<Tuple<string,string,string>>(); - - BeforeGenerateLinqToDBModel = () => - { - beforeGenerateLinqToDBModel(); - - foreach (var table in Tables.Values) - { - var idx = table.Description.IndexOf("[Obsolete"); - - if (idx >= 0) - { - var idx2 = table.Description.IndexOf(']', idx); - - if (idx2 > idx) - { - var text = table.Description.Substring(idx + 1, idx2 - idx - 1); - var attr = new Attribute(text); - var info = Tuple.Create(table.Schema, table.Name, text); - - if (obsoleteTables.All(a => a != info)) - obsoleteTables.Add(info); - table.Attributes.Add(attr); - table.Description = table.Description.Substring(0, idx) + table.Description.Substring(idx2 + 1); - } - } - - foreach (var c in table.Columns.Values) - { - idx = c.Description.IndexOf("[Obsolete"); - - if (idx >= 0) - { - var idx2 = c.Description.IndexOf(']', idx); - - if (idx2 > idx) - { - var attr = new Attribute(c.Description.Substring(idx + 1, idx2 - idx - 1)); - - c.Attributes.Add(attr); - c.Description = c.Description.Substring(0, idx) + c.Description.Substring(idx2 + 1); - } - } - } - } - }; - - AfterGenerateLinqToDBModel = () => - { - foreach (var tableInfo in obsoleteTables) - { - var schema = tableInfo.Item1; - var name = tableInfo.Item2; - var text = tableInfo.Item3; - var obsoleteAttr = new Attribute(text); - - foreach (var cm in GetTreeNodes(Model) - .OfType<MemberBase>() - .Where(t => t.BuildType() != null) - .Where(t => t.BuildType() == name || t.BuildType().Contains("<" + name + ">"))) - { - // check schema - - if (cm.Parent != null && cm.Parent.Parent != null) - { - var parent = cm.Parent.Parent; - - if (parent is Table) - { - var table = (Table)parent; - - if (schema == table.Schema) - if (cm.Attributes.All(a => a.Name != text)) - cm.Attributes.Add(obsoleteAttr); - } - else if (parent is Class) - { - var cls = (Class)parent; - - bool parentClassIncludesSchemaName = cls.Name.Equals(schema + "Schema", StringComparison.InvariantCultureIgnoreCase); - bool classIsForDefaultSchema = cls.Name == DataContextName; - bool isExtensionMethod = cls.Parent is Namespace || cls.Name == "TableExtensions"; - - if (classIsForDefaultSchema || parentClassIncludesSchemaName || isExtensionMethod) - if (cm.Attributes.All(a => a.Name != text)) - cm.Attributes.Add(obsoleteAttr); - } - } - } - } - - afterGenerateLinqToDBModel(); - }; - } -#> diff --git a/src/Migrator/LinqToDB.Templates/PluralizationService.ttinclude b/src/Migrator/LinqToDB.Templates/PluralizationService.ttinclude deleted file mode 100644 index 2bed1d6..0000000 --- a/src/Migrator/LinqToDB.Templates/PluralizationService.ttinclude +++ /dev/null @@ -1,185 +0,0 @@ -<#@ assembly name="System.Data.Entity.Design" #> -<#@ import namespace="System.Data.Entity.Design.PluralizationServices" #> -<# - { - ToPlural = Pluralization.ToPlural; - ToSingular = Pluralization.ToSingular; - } -#> -<#+ -static class Pluralization -{ - public static string CultureInfo = "en"; - - static PluralizationService _service; - - public static Dictionary<string,string> Dictionary = new Dictionary<string,string> - { - { "access", "accesses" }, { "afterlife", "afterlives" }, { "alga", "algae" }, - { "alumna", "alumnae" }, { "alumnus", "alumni" }, { "analysis", "analyses" }, - { "antenna", "antennae" }, { "appendix", "appendices" }, { "axis", "axes" }, - { "bacillus", "bacilli" }, { "basis", "bases" }, { "Bedouin", "Bedouin" }, - { "cactus", "cacti" }, { "calf", "calves" }, { "cherub", "cherubim" }, - { "child", "children" }, { "cod", "cod" }, { "cookie", "cookies" }, - { "criterion", "criteria" }, { "curriculum", "curricula" }, { "data", "data" }, - { "deer", "deer" }, { "diagnosis", "diagnoses" }, { "die", "dice" }, - { "dormouse", "dormice" }, { "elf", "elves" }, { "elk", "elk" }, - { "erratum", "errata" }, { "esophagus", "esophagi" }, { "fauna", "faunae" }, - { "fish", "fish" }, { "flora", "florae" }, { "focus", "foci" }, - { "foot", "feet" }, { "formula", "formulae" }, { "fundus", "fundi" }, - { "fungus", "fungi" }, { "genie", "genii" }, { "genus", "genera" }, - { "goose", "geese" }, { "grouse", "grouse" }, { "hake", "hake" }, - { "half", "halves" }, { "headquarters", "headquarters" }, { "hippo", "hippos" }, - { "hippopotamus", "hippopotami" }, { "hoof", "hooves" }, { "housewife", "housewives" }, - { "hypothesis", "hypotheses" }, { "index", "indices" }, { "info", "info" }, - { "jackknife", "jackknives" }, - { "knife", "knives" }, { "labium", "labia" }, { "larva", "larvae" }, - { "leaf", "leaves" }, { "life", "lives" }, { "loaf", "loaves" }, - { "louse", "lice" }, { "magus", "magi" }, { "man", "men" }, - { "memorandum", "memoranda" }, { "midwife", "midwives" }, { "millennium", "millennia" }, - { "moose", "moose" }, { "mouse", "mice" }, { "nebula", "nebulae" }, - { "neurosis", "neuroses" }, { "nova", "novas" }, { "nucleus", "nuclei" }, - { "oesophagus", "oesophagi" }, { "offspring", "offspring" }, { "ovum", "ova" }, - { "ox", "oxen" }, { "papyrus", "papyri" }, { "passerby", "passersby" }, - { "penknife", "penknives" }, { "person", "people" }, { "phenomenon", "phenomena" }, - { "placenta", "placentae" }, { "pocketknife", "pocketknives" }, { "process", "processes" }, - { "pupa", "pupae" }, { "radius", "radii" }, { "reindeer", "reindeer" }, - { "retina", "retinae" }, { "rhinoceros", "rhinoceros" }, { "roe", "roe" }, - { "salmon", "salmon" }, { "scarf", "scarves" }, { "self", "selves" }, - { "seraph", "seraphim" }, { "series", "series" }, { "sheaf", "sheaves" }, - { "sheep", "sheep" }, { "shelf", "shelves" }, { "species", "species" }, - { "spectrum", "spectra" }, { "status", "status" }, { "stimulus", "stimuli" }, - { "stratum", "strata" }, { "supernova", "supernovas" }, { "swine", "swine" }, - { "terminus", "termini" }, { "thesaurus", "thesauri" }, { "thesis", "theses" }, - { "thief", "thieves" }, { "trout", "trout" }, { "vulva", "vulvae" }, - { "wife", "wives" }, { "wildebeest", "wildebeest" }, { "wolf", "wolves" }, - { "woman", "women" }, { "yen", "yen" }, - }; - - static string GetLastWord(string str) - { - if (string.IsNullOrWhiteSpace(str)) - return string.Empty; - - var i = str.Length - 1; - var isLower = char.IsLower(str[i]); - - while (i > 0 && char.IsLetter(str[i - 1]) && char.IsLower(str[i - 1]) == isLower) - i--; - - return str.Substring(isLower && i > 0 && char.IsLetter(str[i - 1]) ? i - 1 : i); - } - - public static string ToPlural(string str) - { - if (_service == null) - _service = PluralizationService.CreateService(System.Globalization.CultureInfo.GetCultureInfo(CultureInfo)); - - var word = GetLastWord(str); - - string newWord; - - if (!Dictionary.TryGetValue(word.ToLower(), out newWord)) - newWord = _service.IsPlural(word) ? word : _service.Pluralize(word); - - if (string.Compare(word, newWord, true) != 0) - { - if (char.IsUpper(word[0])) - newWord = char.ToUpper(newWord[0]) + newWord.Substring(1, newWord.Length - 1).ToLower(); - - return word == str ? newWord : str.Substring(0, str.Length - word.Length) + newWord; - } - - return str; - } - - public static string ToSingular(string str) - { - if (_service == null) - _service = PluralizationService.CreateService(System.Globalization.CultureInfo.GetCultureInfo(CultureInfo)); - - var word = GetLastWord(str); - - var newWord = - Dictionary - .Where(dic => string.Compare(dic.Value, word, true) == 0) - .Select(dic => dic.Key) - .FirstOrDefault() - ?? - (_service.IsSingular(word) ? word : _service.Singularize(word)); - - if (string.Compare(word, newWord, true) != 0) - { - if (char.IsUpper(word[0])) - newWord = char.ToUpper(newWord[0]) + newWord.Substring(1, newWord.Length - 1); - - return word == str ? newWord : str.Substring(0, str.Length - word.Length) + newWord; - } - - return str; - } - - static string GetLastWordVersion1(string str) - { - if (string.IsNullOrWhiteSpace(str)) - return string.Empty; - - var i = str.Length - 1; - var isLower = char.IsLower(str[i]); - - while (i > 0 && char.IsLower(str[i-1]) == isLower) - i--; - - return str.Substring(isLower && i > 0 ? i - 1 : i); - } - - public static string ToPluralVersion1(string str) - { - if (_service == null) - _service = PluralizationService.CreateService(System.Globalization.CultureInfo.GetCultureInfo(CultureInfo)); - - var word = GetLastWordVersion1(str); - - string newWord; - - if (!Dictionary.TryGetValue(word.ToLower(), out newWord)) - newWord = _service.IsPlural(word) ? word : _service.Pluralize(word); - - if (string.Compare(word, newWord, true) != 0) - { - if (char.IsUpper(word[0])) - newWord = char.ToUpper(newWord[0]) + newWord.Substring(1, newWord.Length - 1); - - return word == str ? newWord : str.Substring(0, str.Length - word.Length) + newWord; - } - - return str; - } - - public static string ToSingularVersion1(string str) - { - if (_service == null) - _service = PluralizationService.CreateService(System.Globalization.CultureInfo.GetCultureInfo(CultureInfo)); - - var word = GetLastWordVersion1(str); - - var newWord = - Dictionary - .Where(dic => string.Compare(dic.Value, word, true) == 0) - .Select(dic => dic.Key) - .FirstOrDefault() - ?? - (_service.IsSingular(word) ? word : _service.Singularize(word)); - - if (string.Compare(word, newWord, true) != 0) - { - if (char.IsUpper(word[0])) - newWord = char.ToUpper(newWord[0]) + newWord.Substring(1, newWord.Length - 1); - - return word == str ? newWord : str.Substring(0, str.Length - word.Length) + newWord; - } - - return str; - } -} -#> diff --git a/src/Migrator/LinqToDB.Templates/T4Model.ttinclude b/src/Migrator/LinqToDB.Templates/T4Model.ttinclude deleted file mode 100644 index d164aae..0000000 --- a/src/Migrator/LinqToDB.Templates/T4Model.ttinclude +++ /dev/null @@ -1,1564 +0,0 @@ -<#@ assembly name="System.Core" #> -<#@ import namespace="System" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Text" #> -<#+ -static Action<GeneratedTextTransformation,string> WriteComment = (tt,s) => tt.WriteLine("//{0}", s); - -Action BeforeGenerateModel = () => {}; - -bool GenerateProcedureErrors = true; - -void GenerateModel() -{ - Model.SetTree(); - - if (GenerationEnvironment.Length > 0 && GenerationEnvironment.ToString().Trim().Length == 0) - GenerationEnvironment.Length = 0; - - WriteComment(this, "---------------------------------------------------------------------------------------------------"); - WriteComment(this, " <auto-generated>"); - WriteComment(this, " This code was generated by T4Model template for T4 (https://github.com/linq2db/linq2db)."); - WriteComment(this, " Changes to this file may cause incorrect behavior and will be lost if the code is regenerated."); - WriteComment(this, " </auto-generated>"); - WriteComment(this, "---------------------------------------------------------------------------------------------------"); - - WriteLine(""); - WriteLine("#pragma warning disable 1591"); - WriteLine(""); - - BeforeGenerateModel(); - - Model.Render(this); - - WriteLine(""); - WriteLine("#pragma warning restore 1591"); - -} - -void Trim() -{ - var arr = new[] { '\r', '\n', ' ' }; - while (GenerationEnvironment.Length > 0 && arr.Contains(GenerationEnvironment[GenerationEnvironment.Length - 1])) - GenerationEnvironment.Length--; - - WriteLine(""); -} - -static Action<GeneratedTextTransformation,string> WriteUsing = (tt,s) => tt.WriteLine("using {0};", s); - -void RenderUsings(List<string> usings) -{ - var q = - from ns in usings.Distinct() - group ns by ns.Split('.')[0]; - - var groups = - (from ns in q where ns.Key == "System" select ns).Concat - (from ns in q where ns.Key != "System" orderby ns.Key select ns); - - foreach (var gr in groups) - { - foreach (var ns in from s in gr orderby s select s) - WriteUsing(this, ns); - - WriteLine(""); - } - - Trim(); -} - -// Base data types. -// -public interface ITree -{ - ITree Parent { get; set; } - IEnumerable<ITree> GetNodes(); - void SetTree(); -} - -ModelSource Model = new ModelSource(); - -public partial class ModelSource : ITree -{ - public int CurrentNamespace = 0; - - public List<string> Usings = new List<String> { "System" }; - public List<Namespace> Namespaces = new List<Namespace> { new Namespace() }; - - public Namespace Namespace { get { return Namespaces[CurrentNamespace]; } } - public List<TypeBase> Types { get { return Namespaces[CurrentNamespace].Types; } } - - public virtual void Render(GeneratedTextTransformation tt) - { - tt.RenderUsings(Usings); - tt.WriteLine(""); - - foreach (var nm in Namespaces) - { - nm.Render(tt); - tt.WriteLine(""); - } - - tt.Trim(); - } - - public ITree Parent { get; set; } - public IEnumerable<ITree> GetNodes() { return Namespaces; } - - public void SetTree() - { - foreach (var ch in GetNodes()) - { - ch.Parent = this; - ch.SetTree(); - } - } -} - -static Action<GeneratedTextTransformation,string> WriteBeginNamespace = (tt,s) => { tt.WriteLine("namespace {0}", s); tt.WriteLine("{"); }; -static Action<GeneratedTextTransformation> WriteEndNamespace = tt => tt.WriteLine("}"); - -public partial class Namespace : ITree -{ - public string Name; - public List<TypeBase> Types = new List<TypeBase>(); - public List<string> Usings = new List<string>(); - - public virtual void Render(GeneratedTextTransformation tt) - { - if (!string.IsNullOrEmpty(Name)) - { - WriteBeginNamespace(tt, Name); - tt.PushIndent("\t"); - } - - tt.RenderUsings(Usings); - - foreach (var t in Types) - { - t.Render(tt); - tt.WriteLine(""); - } - - tt.Trim(); - - if (!string.IsNullOrEmpty(Name)) - { - tt.PopIndent(); - WriteEndNamespace(tt); - } - } - - public ITree Parent { get; set; } - public IEnumerable<ITree> GetNodes() { return Types; } - - public void SetTree() - { - foreach (var ch in GetNodes()) - { - ch.Parent = this; - ch.SetTree(); - } - } -} - -public interface IClassMember : ITree -{ -} - -public enum AccessModifier -{ - Public, - Protected, - Internal, - Private, - Partial -} - -public abstract partial class TypeBase : IClassMember -{ - public AccessModifier AccessModifier = AccessModifier.Public; - public string Name; - public bool IsPartial = true; - public List<string> Comment = new List<string>(); - public List<Attribute> Attributes = new List<Attribute>(); - public string Conditional; - - public abstract void Render(GeneratedTextTransformation tt); - - protected virtual void BeginConditional(GeneratedTextTransformation tt) - { - if (Conditional != null) - { - tt.RemoveSpace(); - tt.WriteLine("#if " + Conditional); - tt.WriteLine(""); - } - } - - protected virtual void EndConditional(GeneratedTextTransformation tt) - { - if (Conditional != null) - { - tt.RemoveSpace(); - tt.WriteLine(""); - tt.RemoveSpace(); - tt.WriteLine("#endif"); - } - } - - public ITree Parent { get; set; } - public abstract IEnumerable<ITree> GetNodes(); - public abstract void SetTree (); -} - -static Action<GeneratedTextTransformation,Class> WriteBeginClass = (tt,cl) => -{ - tt.Write(cl.AccessModifier.ToString().ToLower() + " "); - if (cl.IsStatic) tt.Write("static "); - if (cl.IsPartial) tt.Write("partial ", cl.Name); - tt.Write("class {0}{1}", cl.Name, cl.GenericArguments.Count > 0 ? $"<{string.Join(", ", cl.GenericArguments)}>" : string.Empty); - - if (!string.IsNullOrEmpty(cl.BaseClass) || cl.Interfaces.Count > 0) - { - var arr = new[] { cl.BaseClass }.Concat(cl.Interfaces) - .Where(n => n != null) - .ToArray(); - - tt.Write(" : "); - tt.Write(string.Join(", ", arr)); - } - - tt.WriteLine(""); - tt.WriteLine("{"); -}; - -static Action<GeneratedTextTransformation> WriteEndClass = tt => tt.WriteLine("}"); - -public partial class Class : TypeBase -{ - public string BaseClass; - public List<string> GenericArguments = new List<string>(); - public bool IsStatic = false; - public List<string> Interfaces = new List<string>(); - public List<IClassMember> Members = new List<IClassMember>(); - - public Class() - { - } - - public Class(string name, params IClassMember[] members) - { - Name = name; - Members.AddRange(members); - } - - public override void Render(GeneratedTextTransformation tt) - { - BeginConditional(tt); - - foreach (var c in Comment) - tt.WriteLine("//" + c); - - if (Attributes.Count > 0) - { - var aa = Attributes.Where(a => !a.IsSeparated).ToList(); - - if (aa.Count > 0) - { - tt.Write("["); - - for (var i = 0; i < aa.Count; i++) - { - if (i > 0) SkipSpacesAndInsert(tt, ", "); - aa[i].Render(tt); - } - - tt.WriteLine("]"); - } - - aa = Attributes.Where(a => a.IsSeparated).ToList(); - - foreach (var a in aa) - { - tt.Write("["); - a.Render(tt); - tt.WriteLine("]"); - } - } - - WriteBeginClass(tt, this); - tt.PushIndent("\t"); - - foreach (var cm in Members) - { - if (cm is MemberBase) - { - var m = (MemberBase)cm; - - if (!(m is MemberGroup)) - m.BeginConditional(tt, false); - - foreach (var c in m.Comment) - WriteComment(tt, c); - - if (m.Attributes.Count > 0) - { - var q = - from a in m.Attributes - group a by a.Conditional ?? ""; - - foreach (var g in q) - { - if (g.Key.Length > 0) - { - tt.RemoveSpace(); - tt.WriteLine("#if " + g.Key); - } - - var attrs = g.ToList(); - - tt.Write("["); - - for (var i = 0; i < attrs.Count; i++) - { - if (i > 0) SkipSpacesAndInsert(tt, ", "); - attrs[i].Render(tt); - } - - tt.WriteLine("]"); - - if (g.Key.Length > 0) - { - tt.RemoveSpace(); - tt.WriteLine("#endif"); - } - } - } - - m.Render(tt, false); - if (m.InsertBlankLineAfter) - tt.WriteLine(""); - - if (!(m is MemberGroup)) - m.EndConditional(tt, false); - } - else if (cm is TypeBase) - { - var t = (TypeBase)cm; - - t.Render(tt); - tt.WriteLine(""); - } - } - - tt.Trim(); - - tt.PopIndent(); - WriteEndClass(tt); - - EndConditional(tt); - } - - public override IEnumerable<ITree> GetNodes() - { - return Members; - } - - public override void SetTree() - { - foreach (var ch in GetNodes()) - { - ch.Parent = this; - ch.SetTree(); - } - } -} - -public abstract partial class MemberBase : IClassMember -{ - public string ID; - public AccessModifier AccessModifier = AccessModifier.Public; - public string Name; - public Func<string> TypeBuilder; - public List<string> Comment = new List<string>(); - public string EndLineComment; - public List<Attribute> Attributes = new List<Attribute>(); - public bool InsertBlankLineAfter = true; - public string Conditional; - - public int AccessModifierLen; - public int ModifierLen; - public int TypeLen; - public int NameLen; - public int ParamLen; - public int BodyLen; - - public string Type - { - get { return TypeBuilder?.Invoke(); } - set { TypeBuilder = () => value; } - } - - public string BuildType() { return TypeBuilder?.Invoke(); } - - public virtual int CalcModifierLen() { return 0; } - public abstract int CalcBodyLen (); - public virtual int CalcParamLen () { return 0; } - public abstract void Render (GeneratedTextTransformation tt, bool isCompact); - - public virtual void BeginConditional(GeneratedTextTransformation tt, bool isCompact) - { - if (Conditional != null) - { - tt.RemoveSpace(); - tt.WriteLine("#if " + Conditional); - if (!isCompact) - tt.WriteLine(""); - } - } - - public virtual void EndConditional(GeneratedTextTransformation tt, bool isCompact) - { - if (Conditional != null) - { - tt.RemoveSpace(); - tt.WriteLine("#endif"); - if (!isCompact) - tt.WriteLine(""); - } - } - - public ITree Parent { get; set; } - public virtual IEnumerable<ITree> GetNodes() { return Enumerable.Empty<ITree>(); } - public virtual void SetTree () {} -} - -static Action<GeneratedTextTransformation,string> BeginRegion = (tt,s) => { tt.WriteLine("#region {0}", s); }; -static Action<GeneratedTextTransformation> EndRegion = (tt) => { tt.WriteLine("#endregion"); }; - -public partial class MemberGroup : MemberBase -{ - public string Region; - public bool IsCompact; - public bool IsPropertyGroup; - public List<IClassMember> Members = new List<IClassMember>(); - public List<string> Errors = new List<string>(); - - public override int CalcBodyLen() { return 0; } - - public override void Render(GeneratedTextTransformation tt, bool isCompact) - { - if (!string.IsNullOrEmpty(Region)) - { - BeginRegion(tt, Region); - tt.WriteLine(""); - } - - BeginConditional(tt, isCompact); - - if (Errors.Count > 0 && tt.GenerateProcedureErrors) - { - tt.RemoveSpace(); - WriteComment(tt, " Use 'GenerateProcedureErrors=false' to disable errors."); - foreach (var error in Errors) - { - tt.Error(error); - - foreach (var e in error.Split('\n')) - { - tt.RemoveSpace(); - tt.WriteLine("#error " + e.Trim('\r')); - } - } - - tt.WriteLine(""); - } - - if (IsCompact) - { - var allMembers = GetTreeNodes(this).OfType<MemberBase>().Where(m => !(m is MemberGroup)).ToList(); - - if (allMembers.Count > 0) - { - int max = allMembers.Max(m => m.AccessModifier.ToString().Length); - foreach (var m in allMembers) - m.AccessModifierLen = max; - - max = allMembers.Max(m => m.CalcModifierLen()); - foreach (var m in allMembers) - m.ModifierLen = max; - - max = allMembers.Max(m => (m.BuildType() ?? "").Length); - foreach (var m in allMembers) - m.TypeLen = max; - - var notHasGetter = allMembers.OfType<Property>().Any(m => m.IsAuto && !m.HasGetter); - var notHasSetter = allMembers.OfType<Property>().Any(m => m.IsAuto && !m.HasSetter); - - foreach (var p in allMembers.OfType<Property>()) - { - if (notHasGetter) p.GetterLen = 13; - if (notHasSetter) p.SetterLen = 13; - } - - max = allMembers.Max(m => m.Name.Length); - foreach (var m in allMembers) - m.NameLen = max; - - max = allMembers.Max(m => m.CalcParamLen()); - foreach (var m in allMembers) - m.ParamLen = max; - - max = allMembers.Max(m => m.CalcBodyLen()); - foreach (var m in allMembers) - m.BodyLen = max; - - var members = - ( - from m in allMembers - select new - { - m, - attrs = - ( - from a in m.Attributes - group a by a.Name into gr - select gr.Select((a,i) => new { a, name = a.Name + "." + i }).ToList() into s - from a in s - select a - ).ToList() - } - ).ToList(); - - var attrWeight = - ( - from m in members - from a in m.attrs - group a by a.name into gr - select new { gr.Key, Count = gr.Count() } - ).ToDictionary(a => a.Key, a => a.Count); - - var q = - from m in members - where m.attrs.Count > 0 - select new { m, w = m.attrs.Sum(aa => attrWeight[aa.name]) } into m - orderby m.w descending - select m.m; - - var attrs = new List<string>(); - - foreach (var m in q) - { - var list = m.attrs.Select(a => a.name).ToList(); - - if (attrs.Count == 0) - attrs.AddRange(list); - else - { - for (var i = 0; i < list.Count; i++) - { - var nm = list[i]; - - if (!attrs.Contains(nm)) - { - for (var j = i + 1; j < list.Count; j++) - { - var idx = attrs.IndexOf(list[j]); - - if (idx >= 0) - { - attrs.Insert(idx, nm); - break; - } - } - } - - if (!attrs.Contains(nm)) - attrs.Add(nm); - } - } - } - - var mms = members.Select(m => - { - var arr = new Attribute[attrs.Count]; - - foreach (var a in m.attrs) - arr[attrs.IndexOf(a.name)] = a.a; - - return new { m.m, attrs = arr.ToList() }; - }).ToList(); - - var idxs = Enumerable.Range(0, attrs.Count).Select(_ => new List<int>()).ToList(); - - for (var i = 0; i < mms.Count; i++) - for (var j = 0; j < mms[i].attrs.Count; j++) - if (mms[i].attrs[j] != null) - idxs[j].Add(i); - - var toRemove = new List<int>(); - - for (int i = 1; i < idxs.Count; i++) - { - for (int j = 0; j < i; j++) - { - if (idxs[j] == null) - continue; - - if (idxs[i].Intersect(idxs[j]).Count() == 0) - { - foreach (var m in mms) - { - if (m.attrs[i] != null) - { - m.attrs[j] = m.attrs[i]; - m.attrs[i] = null; - } - } - - idxs[j].AddRange(idxs[i]); - idxs[i] = null; - toRemove.Add(i); - break; - } - } - - } - - foreach (var n in toRemove.OrderByDescending(i => i)) - foreach (var m in mms) - m.attrs.RemoveAt(n); - - var lens = new int[attrs.Count - toRemove.Count]; - - foreach (var m in mms) - { - for (var i = 0; i < m.attrs.Count; i++) - { - var a = m.attrs[i]; - - if (a != null) - { - var len = a.Name.Length; - - if (a.Parameters.Count >= 0) - len += a.Parameters.Sum(p => 2 + p.Length); - - lens[i] = Math.Max(lens[i], len); - } - } - } - - foreach (var m in allMembers) - { - if (!(m is MemberGroup)) - m.BeginConditional(tt, IsCompact); - - foreach (var c in m.Comment) - WriteComment(tt, c); - - if (attrs.Count > 0) - { - var ma = mms.First(mr => mr.m == m); - - if (m.Attributes.Count > 0) - { - tt.Write("["); - - for (var i = 0; i < ma.attrs.Count; i++) - { - var a = ma.attrs[i]; - - if (a == null) - { - tt.WriteSpaces(lens[i]); - if (i + 1 < ma.attrs.Count) - tt.Write(" "); - } - else - { - var len = tt.GenerationEnvironment.Length; - a.Render(tt); - len = (tt.GenerationEnvironment.Length - len); - - var commaAdded = false; - - for (var j = i + 1; j < ma.attrs.Count; j++) - { - if (ma.attrs[j] != null) - { - SkipSpacesAndInsert(tt, ", "); - commaAdded = true; - break; - } - } - - if (i + 1 < ma.attrs.Count && !commaAdded) - tt.Write(" "); - - tt.WriteSpaces(lens[i] - len); - } - } - - tt.Write("] "); - } - else - { - tt.WriteSpaces(lens.Sum() + ma.attrs.Count * 2 + 1); - } - } - - m.Render(tt, true); - - if (!IsCompact) - tt.WriteLine(""); - - if (!(m is MemberGroup)) - m.EndConditional(tt, IsCompact); - } - } - } - else - { - foreach (var cm in Members) - { - if (cm is MemberBase) - { - var m = (MemberBase)cm; - - if (!(m is MemberGroup)) - m.BeginConditional(tt, IsCompact); - - foreach (var c in m.Comment) - WriteComment(tt, c); - - if (m.Attributes.Count > 0) - { - var q = - from a in m.Attributes - group a by a.Conditional ?? ""; - - foreach (var g in q) - { - if (g.Key.Length > 0) - { - tt.RemoveSpace(); - tt.WriteLine("#if " + g.Key); - } - - var attrs = g.ToList(); - - var aa = attrs.Where(a => !a.IsSeparated).ToList(); - - if (aa.Count > 0) - { - tt.Write("["); - - for (var i = 0; i < aa.Count; i++) - { - if (i > 0) tt.Write(", "); - aa[i].Render(tt); - } - - tt.WriteLine("]"); - } - - aa = attrs.Where(a => a.IsSeparated).ToList(); - - foreach (var a in aa) - { - tt.Write("["); - a.Render(tt); - tt.WriteLine("]"); - } - - if (g.Key.Length > 0) - { - tt.RemoveSpace(); - tt.WriteLine("#endif"); - } - } - } - - m.Render(tt, false); - - if (m.InsertBlankLineAfter) - tt.WriteLine(""); - - if (!(m is MemberGroup)) - m.EndConditional(tt, IsCompact); - } - else if (cm is TypeBase) - { - var t = (TypeBase)cm; - - t.Render(tt); - tt.WriteLine(""); - } - } - } - - tt.Trim(); - - EndConditional(tt, isCompact); - - if (!string.IsNullOrEmpty(Region)) - { - tt.WriteLine(""); - EndRegion(tt); - } - } - - public override IEnumerable<ITree> GetNodes() { return Members; } - - public override void SetTree() - { - foreach (var ch in GetNodes()) - { - ch.Parent = this; - ch.SetTree(); - } - } -} - -static Action<GeneratedTextTransformation,Field> WriteField = (tt,f) => -{ - var am = f.AccessModifier.ToString().ToLower(); - var mdf = - (f.IsStatic ? " static" : "") + - (f.IsReadonly ? " readonly" : "") ; - - tt.Write("{0}{1}{2}{3} {4}{5} {6}", - am, LenDiff(f.AccessModifierLen, am), - mdf, LenDiff(f.ModifierLen, mdf), - f.BuildType(), LenDiff(f.TypeLen, f.BuildType()), - f.Name); - - if (f.InitValue != null) - { - tt.Write(" = {0}", f.InitValue); - } - - tt.Write(";"); - - if (!string.IsNullOrEmpty(f.EndLineComment)) - { - tt.WriteSpaces(f.NameLen - f.Name.Length + f.BodyLen + f.ParamLen - 1); - tt.Write(" "); - WriteComment(tt, " " + f.EndLineComment); - } - else - tt.WriteLine(""); -}; - -public partial class Field : MemberBase -{ - public bool IsStatic; - public bool IsReadonly; - public string InitValue; - - public Field() - { - } - - public Field(Func<string> typeBuilder, string name) - { - TypeBuilder = typeBuilder; - Name = name; - } - - public override int CalcModifierLen() - { - return - (IsStatic ? " static". Length : 0) + - (IsReadonly ? " readonly".Length : 0) ; - } - - public override int CalcBodyLen() { return InitValue == null ? 1 : 4 + InitValue.Length; } - - public override void Render(GeneratedTextTransformation tt, bool isCompact) - { - WriteField(tt, this); - } -} - -static Action<GeneratedTextTransformation,Event> WriteEvent = (tt,m) => -{ - var am = m.AccessModifier.ToString().ToLower(); - var mdf = - (m.IsStatic ? " static" : "") + - (m.IsVirtual ? " virtual" : "") + - " event"; - - tt.Write("{0}{1}{2}{3} {4}{5} {6};", - am, LenDiff(m.AccessModifierLen, am), - mdf, LenDiff(m.ModifierLen, mdf), - m.BuildType(), LenDiff(m.TypeLen, m.BuildType()), - m.Name); - - if (!string.IsNullOrEmpty(m.EndLineComment)) - { - tt.WriteSpaces(m.NameLen - m.Name.Length + m.BodyLen + m.ParamLen - 1); - tt.Write(" "); - WriteComment(tt, " " + m.EndLineComment); - } - else - tt.WriteLine(""); -}; - -public partial class Event : MemberBase -{ - public bool IsStatic; - public bool IsVirtual; - - public Event() - { - } - - public Event(Func<string> typeBuilder, string name) - { - TypeBuilder = typeBuilder; - Name = name; - } - - public override int CalcModifierLen() - { - return - (IsStatic ? " static". Length : 0) + - (IsVirtual ? " virtual".Length : 0) + - " event".Length; - } - - public override int CalcBodyLen() { return 1; } - - public override void Render(GeneratedTextTransformation tt, bool isCompact) - { - WriteEvent(tt, this); - } -} - -static Action<GeneratedTextTransformation,Property,bool> WriteProperty = (tt,p,compact) => -{ - var am = p.AccessModifier.ToString().ToLower(); -// var mdf = p.IsVirtual ? " virtual" : ""; - var mdf = p.IsAbstract ? " abstract" : p.IsVirtual ? " virtual" : p.IsOverride ? " override" : p.IsStatic ? " static" : ""; - - tt.Write("{0}{1}{2}{3} {4}{5} {6}", - am, LenDiff(p.AccessModifierLen, am), - mdf, LenDiff(p.ModifierLen, mdf), - p.BuildType(), LenDiff(p.TypeLen, p.BuildType()), - p.Name); - - Action writeComment = () => - { - if (!string.IsNullOrEmpty(p.EndLineComment)) - { - tt.Write(" "); - WriteComment(tt, " " + p.EndLineComment); - } - else - tt.WriteLine(""); - }; - - if (p.IsAuto) - { - tt.Write(LenDiff(p.NameLen + p.ParamLen, p.Name)); - - var len = tt.GenerationEnvironment.Length; - - tt.Write(" { "); - - if (!p.HasGetter) - tt.Write("private "); - else if (p.GetterLen == 13) - tt.Write(" "); - tt.Write("get; "); - - if (!p.HasSetter) - tt.Write("private "); - else if (p.SetterLen == 13) - tt.Write(" "); - tt.Write("set; "); - - tt.Write("}"); - - if (!string.IsNullOrEmpty(p.EndLineComment)) - tt.WriteSpaces(p.BodyLen - (tt.GenerationEnvironment.Length - len)); - writeComment(); - } - else - { - if (compact) - { - tt.Write(LenDiff(p.NameLen + p.ParamLen, p.Name)); - - var len = tt.GenerationEnvironment.Length; - - tt.Write(" { "); - - if (p.HasGetter) - { - tt.Write("get { "); - foreach (var t in p.BuildGetBody()) - tt.Write("{0} ", t); - tt.Write("} "); - } - - if (p.HasSetter) - { - tt.Write("set { "); - foreach (var t in p.BuildSetBody()) - tt.Write("{0} ", t); - tt.Write("} "); - } - - tt.Write("}"); - - if (!string.IsNullOrEmpty(p.EndLineComment)) - tt.WriteSpaces(p.BodyLen - (tt.GenerationEnvironment.Length - len)); - writeComment(); - } - else - { - writeComment(); - - tt.WriteLine("{"); - tt.PushIndent("\t"); - - if (p.HasGetter) - { - var getBody = p.BuildGetBody().ToArray(); - if (getBody.Length == 1) - { - tt.WriteLine("get {{ {0} }}", getBody[0]); - } - else - { - tt.WriteLine("get"); - tt.WriteLine("{"); - tt.PushIndent("\t"); - - foreach (var t in getBody) - tt.WriteLine(t); - - tt.PopIndent(); - tt.WriteLine("}"); - } - } - - if (p.HasSetter) - { - var setBody = p.BuildSetBody().ToArray(); - if (setBody.Length == 1) - { - tt.WriteLine("set {{ {0} }}", setBody[0]); - } - else - { - tt.WriteLine("set"); - tt.WriteLine("{"); - tt.PushIndent("\t"); - - foreach (var t in setBody) - tt.WriteLine(t); - - tt.PopIndent(); - tt.WriteLine("}"); - } - } - - tt.PopIndent(); - tt.WriteLine("}"); - } - } -}; - -public partial class Property : MemberBase -{ - public bool IsAuto = true; - public string InitValue; - public bool IsVirtual; - public bool IsOverride; - public bool IsAbstract; - public bool IsStatic; - public bool HasGetter = true; - public bool HasSetter = true; - public List<Func<IEnumerable<string>>> GetBodyBuilders = new List<Func<IEnumerable<string>>>(); - public List<Func<IEnumerable<string>>> SetBodyBuilders = new List<Func<IEnumerable<string>>>(); - - public int GetterLen = 5; - public int SetterLen = 5; - - public Property() - { - } - - public Property(Func<string> typeBuilder, string name, Func<IEnumerable<string>> getBodyBuilder = null, Func<IEnumerable<string>> setBodyBuilder = null) - { - TypeBuilder = typeBuilder; - Name = name; - - InitBody(getBodyBuilder, setBodyBuilder); - } - - public override int CalcModifierLen() - { - return IsVirtual ? " virtual".Length : 0; - } - - public override int CalcBodyLen() - { - if (IsAuto) - return 4 + GetterLen + SetterLen; // ' { get; set; }' - - var len = " {".Length; - - if (HasGetter) - { - len += " get {".Length; - foreach (var t in BuildGetBody()) - len += 1 + t.Length; - len += " }".Length; - } - - if (HasSetter) - { - len += " set {".Length; - foreach (var t in BuildSetBody()) - len += 1 + t.Length; - len += " }".Length; - } - - len += " }".Length; - - return len; - } - - public override void Render(GeneratedTextTransformation tt, bool isCompact) - { - if (!IsAuto && HasGetter) - { - var getBody = BuildGetBody().ToArray(); - if (getBody.Length == 1) - { - var t = getBody[0]; - - if (!t.StartsWith("return")) - { - t = "return " + t; - - if (!t.EndsWith(";")) - t += ";"; - - GetBodyBuilders.Clear(); - GetBodyBuilders.Add(() => new [] { t }); - } - } - } - - WriteProperty(tt, this, isCompact); - } - - public Property InitBody(Func<IEnumerable<string>> getBodyBuilder = null, Func<IEnumerable<string>> setBodyBuilder = null) - { - IsAuto = getBodyBuilder == null && setBodyBuilder == null; - - if (getBodyBuilder != null) GetBodyBuilders.Add(getBodyBuilder); - if (setBodyBuilder != null) SetBodyBuilders.Add(setBodyBuilder); - - if (!IsAuto) - { - HasGetter = getBodyBuilder != null; - HasSetter = setBodyBuilder != null; - } - - return this; - } - - public Property InitGetter(Func<IEnumerable<string>> getBodyBuilder) - { - return InitBody(getBodyBuilder, null); - } - - public IEnumerable<string> BuildGetBody() - { - return GetBodyBuilders.SelectMany(builder => builder?.Invoke() ?? Array.Empty<string>()); - } - - public IEnumerable<string> BuildSetBody() - { - return SetBodyBuilders.SelectMany(builder => builder?.Invoke() ?? Array.Empty<string>()); - } -} - -static Action<GeneratedTextTransformation,Method,bool> WriteMethod = (tt,m,compact) => -{ - var am1 = m.AccessModifier.ToString().ToLower(); - var len1 = m.AccessModifierLen; - var am2 = ""; - var len2 = 0; - var mdf = m.IsAbstract ? " abstract" : m.IsVirtual ? " virtual" : m.IsOverride ? " override" : m.IsStatic ? " static" : ""; - var mlen = m.ModifierLen; - - if (am1 == "partial" && mdf.Length > 0) - { - am2 = " " + am1; len2 = len1 + 1; - am1 = ""; len1 = 0; - mdf = mdf.Trim(); - mlen--; - } - - tt.Write("{0}{1}{2}{3}{4}{5}{6}{7}{8} {9}{10}", - am1, LenDiff(len1, am1), - mdf, LenDiff(mlen, mdf), - am2, LenDiff(len2, am2), - m.BuildType() == null ? "" : " ", - m.BuildType(), LenDiff(m.TypeLen, m.BuildType() ?? ""), - m.Name, - m.GenericArguments.Count > 0 ? $"<{string.Join(", ", m.GenericArguments)}>" : string.Empty); - - Action writeComment = () => - { - if (!string.IsNullOrEmpty(m.EndLineComment)) - { - tt.Write(" "); - WriteComment(tt, " " + m.EndLineComment); - } - else - tt.WriteLine(""); - }; - - Action writeParams = () => - { - tt.Write("("); - - for (int i = 0; i < m.ParameterBuilders.Count; i++) - { - if (i > 0) - tt.Write(", "); - tt.Write(m.ParameterBuilders[i]()); - } - - tt.Write(")"); - }; - - if (compact) - { - tt.Write(LenDiff(m.NameLen, m.Name)); - - var len = tt.GenerationEnvironment.Length; - - writeParams(); - - foreach (var s in m.AfterSignature) - { - tt.Write(" "); - tt.Write(s); - } - - len = tt.GenerationEnvironment.Length - len; - - if (m.IsAbstract || m.AccessModifier == AccessModifier.Partial) - { - tt.Write(";"); - len = 0; - } - else - { - tt.WriteSpaces(m.ParamLen - len); - - len = tt.GenerationEnvironment.Length; - - tt.Write(" {"); - - foreach (var t in m.BuildBody()) - tt.Write(" {0}", t); - - tt.Write(" }"); - } - - if (!string.IsNullOrEmpty(m.EndLineComment)) - tt.WriteSpaces(m.BodyLen - (tt.GenerationEnvironment.Length - len)); - writeComment(); - } - else - { - writeParams (); - writeComment(); - - tt.PushIndent("\t"); - foreach (var s in m.AfterSignature) - tt.WriteLine(s); - tt.PopIndent(); - - tt.WriteLine("{"); - tt.PushIndent("\t"); - - foreach (var t in m.BuildBody()) - { - if (t.Length > 1 && t[0] == '#') - { - tt.RemoveSpace(); - } - - tt.WriteLine(t); - } - - tt.PopIndent(); - tt.WriteLine("}"); - } -}; - -public partial class Method : MemberBase -{ - public bool IsAbstract; - public bool IsVirtual; - public bool IsOverride; - public bool IsStatic; - public List<string> GenericArguments = new List<string>(); - public List<string> AfterSignature = new List<string>(); - public List<Func<string>> ParameterBuilders = new List<Func<string>>(); - public List<Func<IEnumerable<string>>> BodyBuilders = new List<Func<IEnumerable<string>>>(); - - public Method() - { - } - - public Method(Func<string> typeBuilder, string name, IEnumerable<Func<string>> parameterBuilders = null, params Func<IEnumerable<string>>[] bodyBuilders) - { - TypeBuilder = typeBuilder; - Name = name; - - if (parameterBuilders != null) ParameterBuilders.AddRange(parameterBuilders); - if (bodyBuilders != null) BodyBuilders.AddRange(bodyBuilders); - } - - public static Method Create(string type, string name, IEnumerable<string> parameters = null, IEnumerable<string> body = null) - { - return new Method( - () => type, - name, - parameters?.Select<string,Func<string>>((string p) => () => p), - body?.Select<string,Func<IEnumerable<string>>>(p => () => new[] { p }).ToArray()); - } - - public IEnumerable<string> BuildBody() - { - return BodyBuilders.SelectMany(builder => builder?.Invoke() ?? Array.Empty<string>()); - } - - public override int CalcModifierLen() - { - return - IsAbstract ? " abstract".Length : - IsVirtual ? " virtual".Length : - IsStatic ? " static".Length : 0; - } - - public override int CalcBodyLen() - { - if (IsAbstract || AccessModifier == AccessModifier.Partial) - return 1; - - var len = " {".Length; - - foreach (var t in BuildBody()) - len += 1 + t.Length; - - len += " }".Length; - - return len; - } - - public override int CalcParamLen() - { - return ParameterBuilders.Sum(p => p().Length + 2); - } - - public override void Render(GeneratedTextTransformation tt, bool isCompact) - { - WriteMethod(tt, this, isCompact); - } -} - -static Action<GeneratedTextTransformation,Attribute> WriteAttribute = (tt,a) => -{ - tt.Write(a.Name); - - if (a.Parameters.Count > 0) - { - tt.Write("("); - - for (var i = 0; i < a.Parameters.Count; i++) - { - if (i > 0) - if (a.Parameters[i - 1].All(c => c == ' ')) - tt.Write(" "); - else - SkipSpacesAndInsert(tt, ", "); - tt.Write(a.Parameters[i]); - } - - SkipSpacesAndInsert(tt, ")"); - } -}; - -public partial class Attribute -{ - public string Name; - public List<string> Parameters = new List<string>(); - public string Conditional; - public bool IsSeparated; - - public Attribute() - { - } - - public Attribute(string name, params string[] ps) - { - Name = name; - Parameters.AddRange(ps); - } - - public virtual void Render(GeneratedTextTransformation tt) - { - WriteAttribute(tt, this); - } -} - -// Helpers. -// - -Func<string,string> ToPlural = s => s + "s"; -Func<string,string> ToSingular = s => s; - -static string LenDiff(int max, string str) -{ - var s = ""; - - while (max-- > str.Length) - s += " "; - - return s; -} - -public void WriteSpaces(int len) -{ - while (len-- > 0) - Write(" "); -} - -void RemoveSpace() -{ - Write(" "); - - while (GenerationEnvironment.Length > 0 && - (GenerationEnvironment[GenerationEnvironment.Length - 1] == ' ' || - GenerationEnvironment[GenerationEnvironment.Length - 1] == '\t')) - GenerationEnvironment.Length--; -} - -public static IEnumerable<ITree> GetTreeNodes(ITree parent) -{ - foreach (var node in parent.GetNodes()) - { - yield return node; - - foreach (var grandNode in GetTreeNodes(node)) - yield return grandNode; - } -} - -public static ITree FindNode(ITree parent, Func<ITree,bool> func) -{ - foreach (var node in parent.GetNodes()) - { - if (func(node)) - return node; - - var n = FindNode(node, func); - - if (n != null) - return n; - } - - return null; -} - -static void SkipSpacesAndInsert(GeneratedTextTransformation tt, string value) -{ - var l = tt.GenerationEnvironment.Length; - - for (; l > 0 && tt.GenerationEnvironment[l - 1] == ' '; l--) - { - } - - tt.GenerationEnvironment.Insert(l, value); -} - - -string ToCamelCase(string name) -{ - var n = 0; - - foreach (var c in name) - { - if (char.IsUpper(c)) - n++; - else - break; - } - - if (n == 0) - return name; - - if (n == name.Length) - return name.ToLower(); - - n = Math.Max(1, n - 1); - - return name.Substring(0, n).ToLower() + name.Substring(n); -} - -event Action<Property,string,object> SetPropertyValueAction; - -void SetPropertyValue(Property propertyObject, string propertyName, object value) -{ - if (SetPropertyValueAction != null) - SetPropertyValueAction(propertyObject, propertyName, value); -} - -static string ToStringLiteral(string value) -{ - if (value == null) - return "null"; - - var sb = new StringBuilder("\""); - - foreach (var chr in value) - { - switch (chr) - { - case '\t': sb.Append("\\t"); break; - case '\n': sb.Append("\\n"); break; - case '\r': sb.Append("\\r"); break; - case '\\': sb.Append("\\\\"); break; - case '"' : sb.Append("\\\""); break; - case '\0': sb.Append("\\0"); break; - case '\u0085': - case '\u2028': - case '\u2029': - sb.Append($"\\u{(ushort)chr:X4}"); break; - default: sb.Append(chr); break; - } - } - - sb.Append('"'); - - return sb.ToString(); -} - -#> diff --git a/src/Migrator/LinqToDB.Templates/Validation.ttinclude b/src/Migrator/LinqToDB.Templates/Validation.ttinclude deleted file mode 100644 index 45a7e84..0000000 --- a/src/Migrator/LinqToDB.Templates/Validation.ttinclude +++ /dev/null @@ -1,189 +0,0 @@ -<# - { - var beforeGenerateModel = BeforeGenerateModel; - BeforeGenerateModel = () => - { - beforeGenerateModel(); - ValidationImpl(); - }; - } -#> -<#+ -void ValidationImpl() -{ - foreach (Class cl in GetTreeNodes(Model).OfType<Class>()) - { - var validationGroup = new MemberGroup - { - Region = "Validation", - }; - - var props = GetTreeNodes(cl).OfType<Property>().Where(p => p.CustomValidation).ToList(); - - if (props.Count > 0) - { - if (!Model.Usings.Contains("System.Collections.Generic")) - Model.Usings.Add("System.Collections.Generic"); - - var isValid = new Method(() => "bool", "IsValid", new Func<string>[] { () => cl.Name + " obj" }) { IsStatic = true }; - var validator = new Class("CustomValidator", isValid) { IsStatic = true, }; - var partialGroup = new MemberGroup { IsCompact = true }; - - validationGroup.Members.Add(new Field(() => "int", "_isValidCounter") { Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } }); - validationGroup.Members.Add(validator); - validationGroup.Members.Add(partialGroup); - - isValid.BodyBuilders.Add(() => new [] - { - "try", - "{", - "\tobj._isValidCounter++;", - "" - }); - - var ret = "\treturn "; - - for (var idx = 0; idx < props.Count; idx++) - { - var i = idx; - var p = props[i]; - - var name = p.Name.Trim(); - var mname = "Validate" + name; - - cl.Attributes.Add( - new Attribute("CustomValidation", - "typeof(" + cl.Name + ".CustomValidator)", - ToStringLiteral(mname)) - { - IsSeparated = true - }); - - isValid.BodyBuilders.Add(() => new [] { - "\tvar flag" + i + " = ValidationResult.Success == " + mname + "(obj, obj." + name + ");" }); - - ret += (i == 0 ? "" : " || ") + "flag" + i; - - var validate = new Method(() => "ValidationResult", mname, - new Func<string>[] { () => cl.Name + " obj", () => p.BuildType().Trim() + " value" }) { IsStatic = true }; - - validate.BodyBuilders.Add(() => new [] - { - "var list = new List<ValidationResult>();", - "", - "Validator.TryValidateProperty(", - "\tvalue,", - "\tnew ValidationContext(obj, null, null) { MemberName = NameOf" + name + " }, list);", - "", - "obj." + mname + "(value, list);", - "", - "if (list.Count > 0)", - "{", - "\tforeach (var result in list)", - "\t\tforeach (var name in result.MemberNames)", - "\t\t\tobj.AddError(name, result.ErrorMessage);", - "", - "\treturn list[0];", - "}", - "", - "obj.RemoveError(NameOf" + name + ");", - "", - "return ValidationResult.Success;" - }); - - validator.Members.Add(validate); - - partialGroup.Members.Add(new Method( - () => "void", - mname, - new Func<string>[] - { - () => p.BuildType().Trim() + " value", - () => "List<ValidationResult> validationResults", - }) - { - AccessModifier = AccessModifier.Partial, - }); - } - - isValid.BodyBuilders.Add(() => new [] - { - "", - ret + ";", - "}", - "finally", - "{", - "\tobj._isValidCounter--;", - "}" - }); - } - - props = GetTreeNodes(cl).OfType<Property>().Where(p => p.ValidateProperty && p.HasSetter).ToList(); - - if (props.Count > 0) - { - foreach (var p in props) - { - var setBody = p.BuildSetBody().ToList(); - if (setBody.Count > 0) - setBody.Insert(0, ""); - - setBody.Insert(0, "if (_validationLockCounter == 0)"); - setBody.Insert(1, "{"); - - if (p.CustomValidation) - { - setBody.Insert(2, "\tvar validationResult = CustomValidator.Validate" + p.Name.Trim() + "(this, value);"); - setBody.Insert(3, "\tif (validationResult != ValidationResult.Success)"); - setBody.Insert(4, "\t\tthrow new ValidationException(validationResult, null, null);"); - setBody.Insert(5, "}"); - } - else - { - setBody.Insert(2, "\tValidator.ValidateProperty("); - setBody.Insert(3, "\t\tvalue,"); - setBody.Insert(4, string.Format("\t\tnew ValidationContext(this, null, null) {{ MemberName = NameOf{0} }});", p.Name.Trim())); - setBody.Insert(5, "}"); - } - - p.SetBodyBuilders.Clear(); - p.SetBodyBuilders.Add(() => setBody.ToArray()); - } - - validationGroup.Members.Add(new Field(() => "int", "_validationLockCounter") - { - AccessModifier = AccessModifier.Private, - InitValue = "0", - Attributes = { new Attribute("field : NonSerialized") { Conditional = "!SILVERLIGHT" } } - }); - - validationGroup.Members.Add(new Method (() => "void", "LockValidation", null, () => new[] { "_validationLockCounter++;" })); - validationGroup.Members.Add(new Method (() => "void", "UnlockValidation", null, () => new[] { "_validationLockCounter--;" })); - } - - if (validationGroup.Members.Count > 0) - { - if (!Model.Usings.Contains("System.ComponentModel.DataAnnotations")) - Model.Usings.Add("System.ComponentModel.DataAnnotations"); - - cl.Members.Add(validationGroup); - cl.SetTree(); - } - } -} - -partial class Property -{ - public bool CustomValidation; - public bool ValidateProperty; - - public bool Validate - { - set - { - CustomValidation = value; - ValidateProperty = value; - } - } -} -#> diff --git a/src/Migrator/Migrations/Migration201907011352ProjectApi.cs b/src/Migrator/Migrations/Migration201907011352ProjectApi.cs deleted file mode 100644 index 602669d..0000000 --- a/src/Migrator/Migrations/Migration201907011352ProjectApi.cs +++ /dev/null @@ -1,145 +0,0 @@ -using FluentMigrator; -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201907011352)] - public class Migration201907011352ProjectApi : FluentMigrator.Migration - { - public override void Down() - { - #region Foreign Keys - Delete.ForeignKey() - .FromTable("Resources").ForeignColumn("TypeId") - .ToTable("ResourceTypes").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("SubProjects").ForeignColumn("ProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("SubProjects").ForeignColumn("SubProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("ProjectResource").ForeignColumn("ResourceId") - .ToTable("Resources").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("ProjectResource").ForeignColumn("ProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("ProjectRoles").ForeignColumn("ProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("ProjectRoles").ForeignColumn("UserId") - .ToTable("Users").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("ProjectRoles").ForeignColumn("RoleId") - .ToTable("Roles").PrimaryColumn("Id"); - #endregion - - #region Tables - Delete.Table("ResourceTypes"); - Delete.Table("Projects"); - Delete.Table("Users"); - Delete.Table("Roles"); - Delete.Table("Resources"); - Delete.Table("SubProjects"); - Delete.Table("ProjectResource"); - Delete.Table("ProjectRoles"); - #endregion - } - - public override void Up() - { - #region Independent Tables - Create.Table("ResourceTypes") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("DisplayName").AsString(50).NotNullable(); - - Create.Table("Projects") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("DisplayName").AsString(200).NotNullable() - .WithColumn("Description").AsString(1000).NotNullable() - .WithColumn("Organization").AsString(50).NotNullable(); - - - Create.Table("Users") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid); - - Create.Table("Roles") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("DisplayName").AsString(50).NotNullable() - .WithColumn("Description").AsString(50).NotNullable(); - - Insert.IntoTable("Roles").Row(new { DisplayName = "Owner", Description = "Owner of the project." }); - Insert.IntoTable("Roles").Row(new { DisplayName = "Member", Description = "Member of the project." }); - #endregion - - #region Resources - Create.Table("Resources") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("Url").AsString(200).NotNullable() - .WithColumn("ExternalId").AsString(200).NotNullable() - .WithColumn("TypeId").AsGuid().NotNullable(); - - Create.ForeignKey() - .FromTable("Resources").ForeignColumn("TypeId") - .ToTable("ResourceTypes").PrimaryColumn("Id"); - #endregion - - #region SubProjects - Create.Table("SubProjects") - .WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("ProjectId").AsGuid().NotNullable() - .WithColumn("SubProjectId").AsGuid().NotNullable(); - - Create.ForeignKey() - .FromTable("SubProjects").ForeignColumn("ProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - - Create.ForeignKey() - .FromTable("SubProjects").ForeignColumn("SubProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - #endregion - - #region ProjectResource - Create.Table("ProjectResource") - .WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("ResourceId").AsGuid().NotNullable() - .WithColumn("ProjectId").AsGuid().NotNullable(); - - Create.ForeignKey() - .FromTable("ProjectResource").ForeignColumn("ResourceId") - .ToTable("Resources").PrimaryColumn("Id"); - - Create.ForeignKey() - .FromTable("ProjectResource").ForeignColumn("ProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - #endregion - - #region ProjectRoles - Create.Table("ProjectRoles") - .WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("ProjectId").AsGuid().NotNullable() - .WithColumn("UserId").AsGuid().NotNullable() - .WithColumn("RoleId").AsGuid().NotNullable(); - - Create.ForeignKey() - .FromTable("ProjectRoles").ForeignColumn("ProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - - Create.ForeignKey() - .FromTable("ProjectRoles").ForeignColumn("UserId") - .ToTable("Users").PrimaryColumn("Id"); - - Create.ForeignKey() - .FromTable("ProjectRoles").ForeignColumn("RoleId") - .ToTable("Roles").PrimaryColumn("Id"); - #endregion - } - } -} diff --git a/src/Migrator/Migrations/Migration201907081510EnhanceProjectApi.cs b/src/Migrator/Migrations/Migration201907081510EnhanceProjectApi.cs deleted file mode 100644 index 2a2d66e..0000000 --- a/src/Migrator/Migrations/Migration201907081510EnhanceProjectApi.cs +++ /dev/null @@ -1,29 +0,0 @@ -using FluentMigrator; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201907081510)] - public class Migration201907081510EnhanceProjectApi : FluentMigrator.Migration - { - public override void Down() - { - Delete.Column("StartDate").FromTable("Projects"); - Delete.Column("EndDate").FromTable("Projects"); - Delete.Column("Keywords").FromTable("Projects"); - } - - public override void Up() - { - Alter.Table("Projects") - .AddColumn("StartDate").AsDateTime().WithDefault(SystemMethods.CurrentDateTime) - .AddColumn("EndDate").AsDateTime() - .AddColumn("Keywords").AsString(1000); - } - } -} diff --git a/src/Migrator/Migrations/Migration201907100900UserProfilesApi.cs b/src/Migrator/Migrations/Migration201907100900UserProfilesApi.cs deleted file mode 100644 index 5c4c2f9..0000000 --- a/src/Migrator/Migrations/Migration201907100900UserProfilesApi.cs +++ /dev/null @@ -1,91 +0,0 @@ -using FluentMigrator; -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201907100900)] - public class Migration201907100900UserProfilesApi : FluentMigrator.Migration - { - public override void Down() - { - #region Foreign Keys - Delete.ForeignKey() - .FromTable("GroupMemberships").ForeignColumn("UserId") - .ToTable("Users").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("GroupMemberships").ForeignColumn("GroupId") - .ToTable("Groups").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("ExternalIds").ForeignColumn("UserId") - .ToTable("Users").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("ExternalIds").ForeignColumn("ResourceTypeId") - .ToTable("ExternalAuthenticators").PrimaryColumn("Id"); - #endregion - - #region Tables - Delete.Table("Groups"); - Delete.Table("GroupMemberships"); - Delete.Table("ExternalAuthenticators"); - Delete.Table("ExternalIds"); - #endregion - - #region Columns - Delete.Column("EmailAddress").FromTable("Users"); - Delete.Column("DisplayName").FromTable("Users"); - #endregion - } - - public override void Up() - { - #region Existing Tables - Alter.Table("Users") - .AddColumn("EmailAddress").AsString(255).NotNullable() - .AddColumn("DisplayName").AsString(255).NotNullable(); - #endregion - - #region Independent Tables - Create.Table("Groups") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("DisplayName").AsString(255).NotNullable(); - - Create.Table("ExternalAuthenticators") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("DisplayName").AsString(50).NotNullable(); - #endregion - - #region GroupMemberships - Create.Table("GroupMemberships") - .WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("GroupId").AsGuid().NotNullable() - .WithColumn("UserId").AsGuid().NotNullable(); - - Create.ForeignKey() - .FromTable("GroupMemberships").ForeignColumn("UserId") - .ToTable("Users").PrimaryColumn("Id"); - - Create.ForeignKey() - .FromTable("GroupMemberships").ForeignColumn("GroupId") - .ToTable("Groups").PrimaryColumn("Id"); - #endregion - - #region ExternalIds - Create.Table("ExternalIds") - .WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("UserId").AsGuid().NotNullable() - .WithColumn("ResourceTypeId").AsGuid().NotNullable() - .WithColumn("ExternalId").AsString(255); - - Create.ForeignKey() - .FromTable("ExternalIds").ForeignColumn("UserId") - .ToTable("Users").PrimaryColumn("Id"); - - Create.ForeignKey() - .FromTable("ExternalIds").ForeignColumn("ResourceTypeId") - .ToTable("ExternalAuthenticators").PrimaryColumn("Id"); - #endregion - } - } -} diff --git a/src/Migrator/Migrations/Migration201908071616RdsResource.cs b/src/Migrator/Migrations/Migration201908071616RdsResource.cs deleted file mode 100644 index 1ef22fa..0000000 --- a/src/Migrator/Migrations/Migration201908071616RdsResource.cs +++ /dev/null @@ -1,19 +0,0 @@ -using FluentMigrator; -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201908071616)] - public class Migration201908071616RdsResource : FluentMigrator.Migration - { - public override void Down() - { - Delete.FromTable("ResourceTypes").Row(new { DisplayName = "rds" }); - } - - public override void Up() - { - - Insert.IntoTable("ResourceTypes").Row(new { DisplayName = "rds" }); - } - } -} diff --git a/src/Migrator/Migrations/Migration201908121401GitlabResource.cs b/src/Migrator/Migrations/Migration201908121401GitlabResource.cs deleted file mode 100644 index 0105abc..0000000 --- a/src/Migrator/Migrations/Migration201908121401GitlabResource.cs +++ /dev/null @@ -1,18 +0,0 @@ -using FluentMigrator; -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201908121401)] - public class Migration201908121401GitlabResource : FluentMigrator.Migration - { - public override void Down() - { - Delete.FromTable("ResourceTypes").Row(new { DisplayName = "gitlab" }); - } - - public override void Up() - { - Insert.IntoTable("ResourceTypes").Row(new { DisplayName = "gitlab" }); - } - } -} diff --git a/src/Migrator/Migrations/Migration201908231520ResourceDisplayName.cs b/src/Migrator/Migrations/Migration201908231520ResourceDisplayName.cs deleted file mode 100644 index 1791b8e..0000000 --- a/src/Migrator/Migrations/Migration201908231520ResourceDisplayName.cs +++ /dev/null @@ -1,18 +0,0 @@ -using FluentMigrator; -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201908231520)] - public class Migration201908231520ResourceDisplayName : FluentMigrator.Migration - { - public override void Down() - { - Delete.Column("DisplayName").FromTable("Resources"); - } - - public override void Up() - { - Alter.Table("Resources").AddColumn("DisplayName").AsString(200).Nullable(); - } - } -} diff --git a/src/Migrator/Migrations/Migration201908290941ORCiD.cs b/src/Migrator/Migrations/Migration201908290941ORCiD.cs deleted file mode 100644 index 62cb990..0000000 --- a/src/Migrator/Migrations/Migration201908290941ORCiD.cs +++ /dev/null @@ -1,22 +0,0 @@ -using FluentMigrator; -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201908290941)] - public class Migration201908290941ORCiD : FluentMigrator.Migration - { - public override void Down() - { - Rename.Column("ExternalAuthenticatorId").OnTable("ExternalIds").To("ResourceTypeId"); - - Delete.FromTable("ExternalAuthenticators").Row(new { DisplayName = "ORCiD" }); - } - - public override void Up() - { - Rename.Column("ResourceTypeId").OnTable("ExternalIds").To("ExternalAuthenticatorId"); - - Insert.IntoTable("ExternalAuthenticators").Row(new { DisplayName = "ORCiD" }); - } - } -} diff --git a/src/Migrator/Migrations/Migration201909111125ProjectEnhancement.cs b/src/Migrator/Migrations/Migration201909111125ProjectEnhancement.cs deleted file mode 100644 index 706dc92..0000000 --- a/src/Migrator/Migrations/Migration201909111125ProjectEnhancement.cs +++ /dev/null @@ -1,111 +0,0 @@ -using FluentMigrator; -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201909111125)] - public class Migration201909111125ProjectEnhancement : FluentMigrator.Migration - { - public override void Down() - { - #region Foreign Keys - Delete.ForeignKey() - .FromTable("ProjectDiscipline").ForeignColumn("DisciplineId") - .ToTable("Disciplines").PrimaryColumn("Id"); - Delete.ForeignKey() - .FromTable("ProjectDiscipline").ForeignColumn("ProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("ProjectInstitute").ForeignColumn("InstituteId") - .ToTable("Institutes").PrimaryColumn("Id"); - Delete.ForeignKey() - .FromTable("ProjectInstitute").ForeignColumn("ProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("Projects").ForeignColumn("VisibilityId") - .ToTable("Visibilities").PrimaryColumn("Id"); - #endregion - - Delete.Column("DisplayName").FromTable("Projects"); - Delete.Column("PrincipleInvestigators").FromTable("Projects"); - Delete.Column("GrantId").FromTable("Projects"); - - Alter.Table("Projects").AlterColumn("Description").AsString(1000).NotNullable(); - - Rename.Column("ProjectName").OnTable("Projects").To("DisplayName"); - - Delete.Column("VisibilityId").FromTable("Projects"); - - Delete.Table("ProjectDiscipline"); - Delete.Table("Disciplines"); - Delete.Table("ProjectInstitute"); - Delete.Table("Institutes"); - Delete.Table("Visibilities"); - - Alter.Table("Projects").AddColumn("Organization").AsString(50).Nullable(); - } - - public override void Up() - { - Rename.Column("DisplayName").OnTable("Projects").To("ProjectName"); - - Delete.Column("Organization").FromTable("Projects"); - - Alter.Table("Projects").AlterColumn("Description").AsString(5000).NotNullable(); - - Alter.Table("Projects").AddColumn("DisplayName").AsString(25).Nullable(); - Alter.Table("Projects").AddColumn("PrincipleInvestigators").AsString(500).Nullable(); - Alter.Table("Projects").AddColumn("GrantId").AsString(500).Nullable(); - - Create.Table("Disciplines") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("DisplayName").AsString(200).NotNullable() - .WithColumn("Url").AsString(200).NotNullable(); - - Create.Table("ProjectDiscipline") - .WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("DisciplineId").AsGuid().NotNullable() - .WithColumn("ProjectId").AsGuid().NotNullable(); - - Create.ForeignKey() - .FromTable("ProjectDiscipline").ForeignColumn("DisciplineId") - .ToTable("Disciplines").PrimaryColumn("Id"); - Create.ForeignKey() - .FromTable("ProjectDiscipline").ForeignColumn("ProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - - Create.Table("Institutes") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("DisplayName").AsString(200).NotNullable() - .WithColumn("IKZ").AsString(20).NotNullable(); - - Create.Table("ProjectInstitute") - .WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("InstituteId").AsGuid().NotNullable() - .WithColumn("ProjectId").AsGuid().NotNullable(); - - Create.ForeignKey() - .FromTable("ProjectInstitute").ForeignColumn("InstituteId") - .ToTable("Institutes").PrimaryColumn("Id"); - Create.ForeignKey() - .FromTable("ProjectInstitute").ForeignColumn("ProjectId") - .ToTable("Projects").PrimaryColumn("Id"); - - Alter.Table("Projects").AddColumn("VisibilityId").AsGuid().Nullable(); - - Create.Table("Visibilities") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("DisplayName").AsString(50).NotNullable(); - - Insert.IntoTable("Visibilities").Row(new { DisplayName = "Project Members" }); - Insert.IntoTable("Visibilities").Row(new { DisplayName = "Public" }); - - Create.ForeignKey() - .FromTable("Projects").ForeignColumn("VisibilityId") - .ToTable("Visibilities").PrimaryColumn("Id"); - - Alter.Column("Keywords").OnTable("Projects").AsString(1000).Nullable(); - } - } -} diff --git a/src/Migrator/Migrations/Migration201909160919UserEnhancement.cs b/src/Migrator/Migrations/Migration201909160919UserEnhancement.cs deleted file mode 100644 index 1a915ea..0000000 --- a/src/Migrator/Migrations/Migration201909160919UserEnhancement.cs +++ /dev/null @@ -1,20 +0,0 @@ -using FluentMigrator; -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201909160919)] - public class Migration201909160919UserEnhancement : FluentMigrator.Migration - { - public override void Down() - { - Delete.Column("Givenname").FromTable("Users"); - Delete.Column("Surname").FromTable("Users"); - } - - public override void Up() - { - Alter.Table("Users").AddColumn("Givenname").AsString(200).Nullable(); - Alter.Table("Users").AddColumn("Surname").AsString(200).Nullable(); - } - } -} diff --git a/src/Migrator/Migrations/Migration201909190938ResourceEnhancement.cs b/src/Migrator/Migrations/Migration201909190938ResourceEnhancement.cs deleted file mode 100644 index abd59cf..0000000 --- a/src/Migrator/Migrations/Migration201909190938ResourceEnhancement.cs +++ /dev/null @@ -1,102 +0,0 @@ -using FluentMigrator; -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201909190938)] - public class Migration201909190938ResourceEnhancement : FluentMigrator.Migration - { - public override void Down() - { - #region Foreign Keys - Delete.ForeignKey() - .FromTable("ResourceDiscipline").ForeignColumn("DisciplineId") - .ToTable("Disciplines").PrimaryColumn("Id"); - Delete.ForeignKey() - .FromTable("ResourceDiscipline").ForeignColumn("ResourceId") - .ToTable("Resources").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("Resources").ForeignColumn("VisibilityId") - .ToTable("Visibilities").PrimaryColumn("Id"); - - Delete.ForeignKey() - .FromTable("Resources").ForeignColumn("LicenseId") - .ToTable("Licenses").PrimaryColumn("Id"); - #endregion - - Delete.Column("DisplayName").FromTable("Resources"); - - Rename.Column("ResourceName").OnTable("Resources").To("DisplayName"); - - Delete.Column("VisibilityId").FromTable("Resources"); - Delete.Column("LicenseId").FromTable("Resources"); - Delete.Column("Keywords").FromTable("Resources"); - Delete.Column("UsageRights").FromTable("Resources"); - Delete.Column("ResourceTypeOptionId").FromTable("Resources"); - - Alter.Table("Resources") - .AddColumn("Url").AsString(200).Nullable() - .AddColumn("ExternalId").AsString(200).Nullable(); - - Delete.Table("ResourceDiscipline"); - Delete.Table("Licenses"); - Delete.Table("RDSResourceType"); - Delete.Table("GitlabResourceType"); - } - - public override void Up() - { - Rename.Column("DisplayName").OnTable("Resources").To("ResourceName"); - - Alter.Table("Resources").AddColumn("DisplayName").AsString(25).Nullable(); - - Create.Table("ResourceDiscipline") - .WithColumn("RelationId").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("DisciplineId").AsGuid().NotNullable() - .WithColumn("ResourceId").AsGuid().NotNullable(); - - Create.ForeignKey() - .FromTable("ResourceDiscipline").ForeignColumn("DisciplineId") - .ToTable("Disciplines").PrimaryColumn("Id"); - Create.ForeignKey() - .FromTable("ResourceDiscipline").ForeignColumn("ResourceId") - .ToTable("Resources").PrimaryColumn("Id"); - - Alter.Table("Resources").AddColumn("VisibilityId").AsGuid().Nullable(); - - Create.ForeignKey() - .FromTable("Resources").ForeignColumn("VisibilityId") - .ToTable("Visibilities").PrimaryColumn("Id"); - - Alter.Table("Resources").AddColumn("LicenseId").AsGuid().Nullable(); - - Create.Table("Licenses") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("DisplayName").AsString(50).NotNullable(); - - Create.ForeignKey() - .FromTable("Resources").ForeignColumn("LicenseId") - .ToTable("Licenses").PrimaryColumn("Id"); - - Alter.Table("Resources").AddColumn("Keywords").AsString(1000).Nullable(); - Alter.Table("Resources").AddColumn("UsageRights").AsString(200).Nullable(); - - Create.Table("RDSResourceType") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("BucketName").AsString(63).NotNullable() - .WithColumn("AccessKey").AsString(200).Nullable() - .WithColumn("SecretKey").AsString(200).Nullable(); - - Create.Table("GitlabResourceType") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("RepositoryNumber").AsInt32().NotNullable() - .WithColumn("RepositoryUrl").AsString(500).NotNullable() - .WithColumn("Token").AsString(100).NotNullable(); - - Alter.Table("Resources").AddColumn("ResourceTypeOptionId").AsGuid().Nullable(); - - Delete.Column("ExternalId").FromTable("Resources"); - Delete.Column("Url").FromTable("Resources"); - } - } -} diff --git a/src/Migrator/Migrations/Migration201910021300ResourceDescription.cs b/src/Migrator/Migrations/Migration201910021300ResourceDescription.cs deleted file mode 100644 index 5c602ee..0000000 --- a/src/Migrator/Migrations/Migration201910021300ResourceDescription.cs +++ /dev/null @@ -1,18 +0,0 @@ -using FluentMigrator; -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201910021300)] - public class Migration201910021300ResourceDescription : FluentMigrator.Migration - { - public override void Down() - { - Delete.Column("Description").FromTable("Resources"); - } - - public override void Up() - { - Alter.Table("Resources").AddColumn("Description").AsString(5000).Nullable(); - } - } -} diff --git a/src/Migrator/Migrations/Migration201910161154InstitutesDisciplines.cs b/src/Migrator/Migrations/Migration201910161154InstitutesDisciplines.cs deleted file mode 100644 index b4e6e6e..0000000 --- a/src/Migrator/Migrations/Migration201910161154InstitutesDisciplines.cs +++ /dev/null @@ -1,78 +0,0 @@ -using FluentMigrator; -using System; -using System.IO; -using System.Reflection; -using System.Xml; -using System.Xml.Linq; - -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201910161154)] - public class Migration201910161154InstitutesDisciplines : FluentMigrator.Migration - { - public override void Down() - { - HandleInstitute((obj) => Delete.FromTable("Institutes").Row(obj)); - HandleDiscipline((obj) => Delete.FromTable("Disciplines").Row(obj)); - } - - public override void Up() - { - HandleInstitute((obj) => Insert.IntoTable("Institutes").Row(obj)); - HandleDiscipline((obj) => Insert.IntoTable("Disciplines").Row(obj)); - } - - private void HandleInstitute(Action<object> action) - { - var assembly = Assembly.GetExecutingAssembly(); - var resourceName = "Coscine.Database.Migration.Assets.Institutes.csv"; - using (var stream = assembly.GetManifestResourceStream(resourceName)) - using (var reader = new StreamReader(stream)) - { - while (!reader.EndOfStream) - { - var line = reader.ReadLine(); - if (line.Contains(",")) - { - var values = line.Split(','); - if (values[0].Trim() != "" && values[1].Trim() != "") - { - action.Invoke(new { IKZ = values[0].Trim(), DisplayName = values[1].Trim() }); - } - } - } - } - } - - private void HandleDiscipline(Action<object> action) - { - var assembly = Assembly.GetExecutingAssembly(); - var resourceName = "Coscine.Database.Migration.Assets.dfg_structure.rdf"; - using (var stream = assembly.GetManifestResourceStream(resourceName)) - using (XmlReader reader = XmlReader.Create(stream)) - { - reader.MoveToContent(); - XNamespace skosNameSpace = "http://www.w3.org/2004/02/skos/core#"; - XNamespace rdfNameSpace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element) - { - if (reader.Name == "skos:Concept") - { - XElement el = (XElement) XNode.ReadFrom(reader); - var notation = el.Element(skosNameSpace + "notation"); - if (int.TryParse(notation.Value, out int val) && notation.Value.Length == 3) - { - var url = el.Attribute(rdfNameSpace + "about").Value; - action.Invoke(new { DisplayName = el.Element(skosNameSpace + "prefLabel").Value, Url = url }); - } - } - } - } - } - - } - } -} diff --git a/src/Migrator/Migrations/Migration201910241600ResourceMetadata.cs b/src/Migrator/Migrations/Migration201910241600ResourceMetadata.cs deleted file mode 100644 index 2690a4b..0000000 --- a/src/Migrator/Migrations/Migration201910241600ResourceMetadata.cs +++ /dev/null @@ -1,20 +0,0 @@ -using FluentMigrator; -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201910241600)] - public class Migration201910241600ResourceMetadata : FluentMigrator.Migration - { - public override void Down() - { - Delete.Column("ApplicationProfile").FromTable("Resources"); - Delete.Column("FixedValues").FromTable("Resources"); - } - - public override void Up() - { - Alter.Table("Resources").AddColumn("ApplicationProfile").AsString(500).Nullable(); - Alter.Table("Resources").AddColumn("FixedValues").AsString(5000).Nullable(); - } - } -} diff --git a/src/Migrator/Migrations/Migration201911040900EnglishDFG.cs b/src/Migrator/Migrations/Migration201911040900EnglishDFG.cs deleted file mode 100644 index 225deb0..0000000 --- a/src/Migrator/Migrations/Migration201911040900EnglishDFG.cs +++ /dev/null @@ -1,122 +0,0 @@ -using FluentMigrator; -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Xml; -using System.Xml.Linq; - -#region DupFinder Exclusion -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201911040900)] - public class Migration201911040900EnglishDFG : FluentMigrator.Migration - { - public override void Down() - { - Delete.Column("DisplayNameDe").FromTable("Disciplines"); - Delete.Column("DisplayNameEn").FromTable("Disciplines"); - Alter.Table("Disciplines").AddColumn("DisplayName").AsString(200).Nullable(); - HandleDisciplineEnDown(); - } - - public override void Up() - { - Delete.Column("DisplayName").FromTable("Disciplines"); - Alter.Table("Disciplines").AddColumn("DisplayNameDe").AsString(200).Nullable(); - Alter.Table("Disciplines").AddColumn("DisplayNameEn").AsString(200).Nullable(); - HandleDisciplineEnUp(); - } - - private void HandleDisciplineEnUp() - { - var assembly = Assembly.GetExecutingAssembly(); - var resourceName = "Coscine.Database.Migration.Assets.dfg_structure.rdf"; - using (var stream = assembly.GetManifestResourceStream(resourceName)) - using (XmlReader reader = XmlReader.Create(stream)) - { - reader.MoveToContent(); - XNamespace skosNameSpace = "http://www.w3.org/2004/02/skos/core#"; - XNamespace rdfNameSpace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element) - { - if (reader.Name == "skos:Concept") - { - XElement el = (XElement) XNode.ReadFrom(reader); - var notation = el.Element(skosNameSpace + "notation"); - if (int.TryParse(notation.Value, out int val) && notation.Value.Length == 3) - { - var url = el.Attribute(rdfNameSpace + "about").Value; - var digits = el.Element(skosNameSpace + "notation").Value; - var displayNames = el.Elements(skosNameSpace + "prefLabel"); - var displayNameDe = "Keine Angabe" + " " + digits; - var displayNameEn = "No Information" + " " + digits; - - foreach (var displayName in displayNames) - { - if (displayName.Attribute(XNamespace.Xml + "lang").Value.Equals("de")) - { - displayNameDe = displayName.Value + " " + digits; - } - else if (displayName.Attribute(XNamespace.Xml + "lang").Value.Equals("en")) - { - displayNameEn = displayName.Value + " " + digits; - } - } - - Update.Table("Disciplines").Set(new { DisplayNameDe = displayNameDe, DisplayNameEn = displayNameEn }).Where(new { Url = url }); - } - } - } - } - } - - } - - - private void HandleDisciplineEnDown() - { - var assembly = Assembly.GetExecutingAssembly(); - var resourceName = "Coscine.Database.Migration.Assets.dfg_structure.rdf"; - using (var stream = assembly.GetManifestResourceStream(resourceName)) - using (XmlReader reader = XmlReader.Create(stream)) - { - reader.MoveToContent(); - XNamespace skosNameSpace = "http://www.w3.org/2004/02/skos/core#"; - XNamespace rdfNameSpace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element) - { - if (reader.Name == "skos:Concept") - { - XElement el = (XElement)XNode.ReadFrom(reader); - var notation = el.Element(skosNameSpace + "notation"); - if (int.TryParse(notation.Value, out int val) && notation.Value.Length == 3) - { - var url = el.Attribute(rdfNameSpace + "about").Value; - var digits = el.Element(skosNameSpace + "notation").Value; - var displayNames = el.Elements(skosNameSpace + "prefLabel"); - var displayNameDe = "Keine Angabe"; - - foreach(var displayName in displayNames) - { - if (displayName.Attribute(XNamespace.Xml + "lang").Value.Equals("de")) - { - displayNameDe = displayName.Value; - } - } - Update.Table("Disciplines").Set(new { DisplayName = displayNameDe }).Where(new { Url = url }); - } - } - } - } - } - - } - } -} -#endregion \ No newline at end of file diff --git a/src/Migrator/Migrations/Migration201911121400Logging.cs b/src/Migrator/Migrations/Migration201911121400Logging.cs deleted file mode 100644 index e18931a..0000000 --- a/src/Migrator/Migrations/Migration201911121400Logging.cs +++ /dev/null @@ -1,39 +0,0 @@ -using FluentMigrator; -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Xml; -using System.Xml.Linq; - -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201911121400)] - public class Migration201911121400Logging : FluentMigrator.Migration - { - public override void Down() - { - Delete.Table("Log"); - } - - public override void Up() - { - Create.Table("Log") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("ServerTimestamp").AsDateTime().WithDefault(SystemMethods.CurrentDateTime).Nullable() - .WithColumn("ClientTimestamp").AsDateTime().WithDefault(SystemMethods.CurrentDateTime).Nullable() - .WithColumn("LogLevel").AsString(20).Nullable() - .WithColumn("Message").AsString(500).Nullable() - .WithColumn("Stacktrace").AsString(8000).Nullable() - .WithColumn("UserId").AsGuid().Nullable() - .WithColumn("URI").AsString(500).Nullable() - .WithColumn("Server").AsString(200).Nullable() - .WithColumn("CorrolationId").AsGuid().Nullable() - .WithColumn("Status").AsString(200).Nullable() - .WithColumn("Source").AsString(200).Nullable(); - - } - - } -} \ No newline at end of file diff --git a/src/Migrator/Migrations/Migration201912060900BucketApplication.cs b/src/Migrator/Migrations/Migration201912060900BucketApplication.cs deleted file mode 100644 index 91a2123..0000000 --- a/src/Migrator/Migrations/Migration201912060900BucketApplication.cs +++ /dev/null @@ -1,52 +0,0 @@ -using FluentMigrator; -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Xml; -using System.Xml.Linq; - -#region DupFinder Exclusion -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201912060900)] - public class Migration201912060900BucketApplication : FluentMigrator.Migration - { - public override void Down() - { - // update the resource type table - Delete.FromTable("ResourceTypes").Row(new { DisplayName = "rds" }); - Update.Table("ResourceTypes").Set(new { DisplayName = "rds" }).Where(new { DisplayName = "s3" }); - - // deletion of the table - Delete.Table("RDSResourceType"); - - // renaming of the s3resource table - Rename.Table("S3ResourceType").To("RDSResourceType"); - Execute.Sql("EXEC sp_rename 'DF_S3ResourceType_Id','DF_RDSResourceType_Id', 'object'"); - Execute.Sql("EXEC sp_rename N'PK_S3ResourceType', 'PK_RDSResourceType', 'object';"); - } - - - public override void Up() - { - // update the resource type table - Update.Table("ResourceTypes").Set(new { DisplayName = "s3" }).Where(new { DisplayName = "rds" }); - Insert.IntoTable("ResourceTypes").Row(new { DisplayName = "rds" }); - - // renaming of the rdsresource table - Rename.Table("RDSResourceType").To("S3ResourceType"); - Execute.Sql("EXEC sp_rename 'DF_RDSResourceType_Id','DF_S3ResourceType_Id', 'object'"); - Execute.Sql("EXEC sp_rename N'PK_RDSResourceType', 'PK_S3ResourceType', 'object';"); - - // creation of the new table - Create.Table("RDSResourceType") - .WithColumn("Id").AsGuid().PrimaryKey().WithDefault(SystemMethods.NewGuid) - .WithColumn("BucketName").AsString(63).NotNullable() - .WithColumn("Size").AsInt32().Nullable(); - } - - } -} -#endregion \ No newline at end of file diff --git a/src/Migrator/Migrations/Migration201912091553ShibbolethAddition.cs b/src/Migrator/Migrations/Migration201912091553ShibbolethAddition.cs deleted file mode 100644 index dab570b..0000000 --- a/src/Migrator/Migrations/Migration201912091553ShibbolethAddition.cs +++ /dev/null @@ -1,33 +0,0 @@ -using FluentMigrator; -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Xml; -using System.Xml.Linq; - -#region DupFinder Exclusion -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(201912091553)] - public class Migration201912091553ShibbolethAddition : FluentMigrator.Migration - { - public override void Down() - { - Delete.FromTable("ExternalAuthenticators").Row(new { DisplayName = "Shibboleth" }); - - Delete.Column("Entitlement").FromTable("Users"); - Delete.Column("Organization").FromTable("Users"); - } - - public override void Up() - { - Insert.IntoTable("ExternalAuthenticators").Row(new { DisplayName = "Shibboleth" }); - - Alter.Table("Users").AddColumn("Entitlement").AsString(200).Nullable(); - Alter.Table("Users").AddColumn("Organization").AsString(200).Nullable(); - } - } -} -#endregion \ No newline at end of file diff --git a/src/Migrator/Migrations/Migration202001071100ExtendLogging.cs b/src/Migrator/Migrations/Migration202001071100ExtendLogging.cs deleted file mode 100644 index 2d61b3b..0000000 --- a/src/Migrator/Migrations/Migration202001071100ExtendLogging.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentMigrator; -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Xml; -using System.Xml.Linq; - -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(202001071100)] - public class Migration202001071100ExtendLogging : FluentMigrator.Migration - { - public override void Down() - { - Alter.Column("Message").OnTable("Log").AsString(500).Nullable(); - } - - public override void Up() - { - Alter.Column("Message").OnTable("Log").AsString(Int32.MaxValue).Nullable(); - } - - } -} \ No newline at end of file diff --git a/src/Migrator/Migrations/Migration202001131100ResourceCreator.cs b/src/Migrator/Migrations/Migration202001131100ResourceCreator.cs deleted file mode 100644 index d798914..0000000 --- a/src/Migrator/Migrations/Migration202001131100ResourceCreator.cs +++ /dev/null @@ -1,27 +0,0 @@ -using FluentMigrator; -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Xml; -using System.Xml.Linq; - -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(202001131100)] - public class Migration202001131100ResourceCreator : FluentMigrator.Migration - { - public override void Down() - { - Delete.Column("Creator").FromTable("Resources"); - } - - public override void Up() - { - Alter.Table("Resources") - .AddColumn("Creator").AsGuid().Nullable(); - } - - } -} \ No newline at end of file diff --git a/src/Migrator/Migrations/Migration202001270800ResourceFlags.cs b/src/Migrator/Migrations/Migration202001270800ResourceFlags.cs deleted file mode 100644 index 57ba0db..0000000 --- a/src/Migrator/Migrations/Migration202001270800ResourceFlags.cs +++ /dev/null @@ -1,27 +0,0 @@ -using FluentMigrator; -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Xml; -using System.Xml.Linq; - -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(202001270800)] - public class Migration202001270800ResourceFlags : FluentMigrator.Migration - { - public override void Down() - { - Delete.Column("Enabled").FromTable("ResourceTypes"); - } - - public override void Up() - { - Alter.Table("ResourceTypes") - .AddColumn("Enabled").AsBoolean().WithDefaultValue(true); - } - - } -} \ No newline at end of file diff --git a/src/Migrator/Migrations/Migration202002041409ProjectDeletedColumn.cs b/src/Migrator/Migrations/Migration202002041409ProjectDeletedColumn.cs deleted file mode 100644 index 525eb5e..0000000 --- a/src/Migrator/Migrations/Migration202002041409ProjectDeletedColumn.cs +++ /dev/null @@ -1,24 +0,0 @@ -using FluentMigrator; - -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(202002041409)] - public class Migration202002041409ProjectDeletedColumn : FluentMigrator.Migration - { - public override void Down() - { - Delete.Column("Deleted") - .FromTable("Projects"); - } - - public override void Up() - { - Alter.Table("Projects") - .AddColumn("Deleted") - .AsBoolean() - .NotNullable() - .WithDefaultValue(false); - } - } -} diff --git a/src/Migrator/Migrations/Migration202002101300MoreLicenses.cs b/src/Migrator/Migrations/Migration202002101300MoreLicenses.cs deleted file mode 100644 index cbc1282..0000000 --- a/src/Migrator/Migrations/Migration202002101300MoreLicenses.cs +++ /dev/null @@ -1,62 +0,0 @@ -using FluentMigrator; -using System; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Xml; -using System.Xml.Linq; - -#region DupFinder Exclusion -namespace Coscine.Database.Migration.Migrations -{ - //yyyymmddhhmm - [Migration(202002101300)] - public class Migration202002101300MoreLicenses : FluentMigrator.Migration - { - public override void Down() - { - Delete.FromTable("Licenses").AllRows(); - } - - public override void Up() - { - HandleLicensesUp(); - } - - private void HandleLicensesUp() - { - var assembly = Assembly.GetExecutingAssembly(); - var resourceName = "Coscine.Database.Migration.Assets.Licenses.rdf"; - using (var stream = assembly.GetManifestResourceStream(resourceName)) - using (XmlReader reader = XmlReader.Create(stream)) - { - reader.MoveToContent(); - XNamespace rdfNameSpace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; - XNamespace rdfsNameSpace = "http://www.w3.org/2000/01/rdf-schema#"; - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element) - { - if (reader.Name == "rdf:Description") - { - XElement el = (XElement)XNode.ReadFrom(reader); - var displayName = ""; - var displayNames = el.Elements(rdfsNameSpace + "label"); - - foreach (var currentDisplayName in displayNames) - { - if (currentDisplayName.Attribute(XNamespace.Xml + "lang").Value.Equals("en")) - { - displayName = currentDisplayName.Value; - } - } - Insert.IntoTable("Licenses").Row(new { DisplayName = displayName }); - } - } - } - } - - } - } -} -#endregion \ No newline at end of file diff --git a/src/Migrator/Migrator.cs b/src/Migrator/Migrator.cs deleted file mode 100644 index c1de6be..0000000 --- a/src/Migrator/Migrator.cs +++ /dev/null @@ -1,90 +0,0 @@ -using Coscine.Configuration; -using FluentMigrator.Runner; -using Microsoft.Extensions.DependencyInjection; - -namespace Coscine.Database.Migration -{ - public class Migrator - { - // Format: Data Source={DBSERVER};Database={DATABASENAME};User Id={USER};Password={PASSWORD}; - private const string DbDataSourceKey = "coscine/global/db_data_source"; - private const string DbNameKey = "coscine/global/db_name"; - private const string DbUserIdKey = "coscine/global/db_user_id"; - private const string DbPasswordKey = "coscine/global/db_password"; - - private readonly IConfiguration _configuration; - private ServiceProvider _serviceProvider; - - public Migrator(System.Reflection.Assembly targetAssembly) - { - _configuration = new ConsulConfiguration(); - SetServiceProvider(targetAssembly, GetDbConnectionString()); - } - - private void SetServiceProvider(System.Reflection.Assembly targetAssembly, string dbConnectionString) - { - var serviceProvider = new ServiceCollection() - // Registration of all FluentMigrator-specific services - .AddFluentMigratorCore() - // Configure the runner - .ConfigureRunner( - builder => builder - // Use SQLServer - .AddSqlServer() - // The SQLServer connection string TODO: make configurable (via consul) - .WithGlobalConnectionString(dbConnectionString) - // Specify the assembly with the migrations - .ScanIn(targetAssembly).For.Migrations() - // Specify the assembly with the embedded resouces - .ScanIn(targetAssembly).For.EmbeddedResources()) - - // Enable logging to console in the FluentMigrator way - .AddLogging(lb => lb.AddFluentMigratorConsole()) - .BuildServiceProvider(); - - _serviceProvider = serviceProvider; - } - - public string GetDbConnectionString() - { - var dbDataSource = _configuration.GetString(DbDataSourceKey); - var dbDatabase = _configuration.GetString(DbNameKey); - var dbUserId = _configuration.GetString(DbUserIdKey); - var dbPassword = _configuration.GetString(DbPasswordKey); - return $"Data Source={dbDataSource}; Database={dbDatabase}; User Id={dbUserId}; Password={dbPassword};"; - } - - public void MigrateUp() - { - // Put the database update into a scope to ensure - // that all resources will be disposed. - using (var scope = _serviceProvider.CreateScope()) - { - // Instantiate the runner - var runner = scope.ServiceProvider.GetRequiredService<IMigrationRunner>(); - - // Execute the migrations - runner.MigrateUp(); - } - } - - public void RollBack(int steps) - { - using (var scope = _serviceProvider.CreateScope()) - { - var runner = scope.ServiceProvider.GetRequiredService<IMigrationRunner>(); - runner.Rollback(steps); - } - } - - // Currently not in use - internal void MigrateDown(FluentMigrator.IMigration targetMigration) - { - using (var scope = _serviceProvider.CreateScope()) - { - var runner = scope.ServiceProvider.GetRequiredService<IMigrationRunner>(); - runner.Down(targetMigration); - } - } - } -} diff --git a/src/Migrator/Migrator.csproj b/src/Migrator/Migrator.csproj deleted file mode 100644 index d0f8563..0000000 --- a/src/Migrator/Migrator.csproj +++ /dev/null @@ -1,212 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="..\packages\linq2db.SqlServer.2.6.4\build\linq2db.SqlServer.props" Condition="Exists('..\packages\linq2db.SqlServer.2.6.4\build\linq2db.SqlServer.props')" /> - <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{A48A255E-D08A-4336-B481-266DEBFABDE9}</ProjectGuid> - <OutputType>Exe</OutputType> - <RootNamespace>Coscine.Database.Migration</RootNamespace> - <AssemblyName>Migrator</AssemblyName> - <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> - <NuGetPackageImportStamp> - </NuGetPackageImportStamp> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="Consul, Version=0.7.2.6, Culture=neutral, PublicKeyToken=20a6ad9a81df1d95, processorArchitecture=MSIL"> - <HintPath>..\packages\Consul.0.7.2.6\lib\net45\Consul.dll</HintPath> - </Reference> - <Reference Include="Coscine.Configuration, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL"> - <HintPath>..\packages\Coscine.Configuration.1.4.0\lib\net461\Coscine.Configuration.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.3.1.3\lib\net461\FluentMigrator.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Abstractions, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Abstractions.3.1.3\lib\net461\FluentMigrator.Abstractions.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Extensions.SqlAnywhere, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Extensions.SqlAnywhere.3.1.3\lib\net461\FluentMigrator.Extensions.SqlAnywhere.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Extensions.SqlServer, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Extensions.SqlServer.3.1.3\lib\net461\FluentMigrator.Extensions.SqlServer.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.3.1.3\lib\net461\FluentMigrator.Runner.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.Core, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.Core.3.1.3\lib\net461\FluentMigrator.Runner.Core.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.Db2, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.Db2.3.1.3\lib\net461\FluentMigrator.Runner.Db2.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.Firebird, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.Firebird.3.1.3\lib\net461\FluentMigrator.Runner.Firebird.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.Hana, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.Hana.3.1.3\lib\net461\FluentMigrator.Runner.Hana.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.Jet, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.Jet.3.1.3\lib\net461\FluentMigrator.Runner.Jet.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.MySql, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.MySql.3.1.3\lib\net461\FluentMigrator.Runner.MySql.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.Oracle, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.Oracle.3.1.3\lib\net461\FluentMigrator.Runner.Oracle.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.Postgres, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.Postgres.3.1.3\lib\net461\FluentMigrator.Runner.Postgres.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.Redshift, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.Redshift.3.1.3\lib\net461\FluentMigrator.Runner.Redshift.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.SqlAnywhere, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.SqlAnywhere.3.1.3\lib\net461\FluentMigrator.Runner.SqlAnywhere.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.SQLite, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.SQLite.3.1.3\lib\net461\FluentMigrator.Runner.SQLite.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.SqlServer, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.SqlServer.3.1.3\lib\net461\FluentMigrator.Runner.SqlServer.dll</HintPath> - </Reference> - <Reference Include="FluentMigrator.Runner.SqlServerCe, Version=3.1.3.0, Culture=neutral, PublicKeyToken=aacfc7de5acabf05, processorArchitecture=MSIL"> - <HintPath>..\packages\FluentMigrator.Runner.SqlServerCe.3.1.3\lib\net461\FluentMigrator.Runner.SqlServerCe.dll</HintPath> - </Reference> - <Reference Include="linq2db, Version=2.6.4.0, Culture=neutral, PublicKeyToken=e41013125f9e410a, processorArchitecture=MSIL"> - <HintPath>..\packages\linq2db.2.6.4\lib\net46\linq2db.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Extensions.Configuration.Abstractions.2.0.1\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Extensions.DependencyInjection, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Extensions.Logging, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Extensions.Logging.2.0.1\lib\netstandard2.0\Microsoft.Extensions.Logging.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.0.1\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Extensions.Options, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Extensions.Options.2.0.1\lib\netstandard2.0\Microsoft.Extensions.Options.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Extensions.Primitives, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Extensions.Primitives.2.0.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.ComponentModel.Annotations, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> - <HintPath>..\packages\System.ComponentModel.Annotations.4.4.1\lib\net461\System.ComponentModel.Annotations.dll</HintPath> - </Reference> - <Reference Include="System.ComponentModel.DataAnnotations" /> - <Reference Include="System.Configuration" /> - <Reference Include="System.Core" /> - <Reference Include="System.Net.Http.WebRequest" /> - <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.4.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath> - </Reference> - <Reference Include="System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> - <HintPath>..\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll</HintPath> - <Private>True</Private> - <Private>True</Private> - </Reference> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Data" /> - <Reference Include="System.Net.Http" /> - <Reference Include="System.Xml" /> - </ItemGroup> - <ItemGroup> - <Compile Include="Migrations\Migration201907011352ProjectApi.cs" /> - <Compile Include="Migrations\Migration201907081510EnhanceProjectApi.cs" /> - <Compile Include="Migrations\Migration201910021300ResourceDescription.cs" /> - <Compile Include="Migrations\Migration201909190938ResourceEnhancement.cs" /> - <Compile Include="Migrations\Migration201909111125ProjectEnhancement.cs" /> - <Compile Include="Migrations\Migration201909160919UserEnhancement.cs" /> - <Compile Include="Migrations\Migration201908290941ORCiD.cs" /> - <Compile Include="Migrations\Migration201908121401GitlabResource.cs" /> - <Compile Include="Migrations\Migration201908071616RdsResource.cs" /> - <Compile Include="Migrations\Migration201907100900UserProfilesApi.cs" /> - <Compile Include="Migrations\Migration201908231520ResourceDisplayName.cs" /> - <Compile Include="Migrations\Migration201910161154InstitutesDisciplines.cs" /> - <Compile Include="Migrations\Migration201910241600ResourceMetadata.cs" /> - <Compile Include="Migrations\Migration201911040900EnglishDFG.cs" /> - <Compile Include="Migrations\Migration201912060900BucketApplication.cs" /> - <Compile Include="Migrations\Migration201912091553ShibbolethAddition.cs" /> - <Compile Include="Migrations\Migration201911121400Logging.cs" /> - <Compile Include="Migrations\Migration202001071100ExtendLogging.cs" /> - <Compile Include="Migrations\Migration202001131100ResourceCreator.cs" /> - <Compile Include="Migrations\Migration202001270800ResourceFlags.cs" /> - <Compile Include="Migrations\Migration202002041409ProjectDeletedColumn.cs" /> - <Compile Include="Migrations\Migration202002101300MoreLicenses.cs" /> - <Compile Include="Migrator.cs" /> - <Compile Include="Program.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <None Include="App.config" /> - <EmbeddedResource Include="Assets\Licenses.rdf" /> - <EmbeddedResource Include="Assets\dfg_structure.rdf" /> - <EmbeddedResource Include="Assets\Institutes.csv" /> - <None Include="LinqToDB.Templates\DataAnnotations.ttinclude" /> - <None Include="LinqToDB.Templates\DataModel.ttinclude" /> - <None Include="LinqToDB.Templates\EditableObject.ttinclude" /> - <None Include="LinqToDB.Templates\Humanizer.ttinclude" /> - <None Include="LinqToDB.Templates\LinqToDB.SqlServer.SqlTypes.Tools.ttinclude" /> - <None Include="LinqToDB.Templates\LinqToDB.SqlServer.Tools.ttinclude" /> - <None Include="LinqToDB.Templates\LinqToDB.SqlServer.ttinclude" /> - <None Include="LinqToDB.Templates\LinqToDB.Tools.ttinclude" /> - <None Include="LinqToDB.Templates\LinqToDB.ttinclude" /> - <None Include="LinqToDB.Templates\MultipleFiles.ttinclude" /> - <None Include="LinqToDB.Templates\NotifyDataErrorInfo.ttinclude" /> - <None Include="LinqToDB.Templates\NotifyPropertyChanged.ttinclude" /> - <None Include="LinqToDB.Templates\ObsoleteAttributes.ttinclude" /> - <None Include="LinqToDB.Templates\PluralizationService.ttinclude" /> - <None Include="LinqToDB.Templates\T4Model.ttinclude" /> - <None Include="LinqToDB.Templates\Validation.ttinclude" /> - <None Include="packages.config" /> - </ItemGroup> - <ItemGroup> - <Content Include="LinqToDB.Templates\CopyMe.SqlServer.tt.txt" /> - </ItemGroup> - <ItemGroup /> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <Import Project="..\packages\FluentMigrator.Runner.SqlServerCe.3.1.3\build\netstandard2.0\FluentMigrator.Runner.SqlServerCe.targets" Condition="Exists('..\packages\FluentMigrator.Runner.SqlServerCe.3.1.3\build\netstandard2.0\FluentMigrator.Runner.SqlServerCe.targets')" /> - <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> - <PropertyGroup> - <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> - </PropertyGroup> - <Error Condition="!Exists('..\packages\FluentMigrator.Runner.SqlServerCe.3.1.3\build\netstandard2.0\FluentMigrator.Runner.SqlServerCe.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\FluentMigrator.Runner.SqlServerCe.3.1.3\build\netstandard2.0\FluentMigrator.Runner.SqlServerCe.targets'))" /> - <Error Condition="!Exists('..\packages\linq2db.SqlServer.2.6.4\build\linq2db.SqlServer.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\linq2db.SqlServer.2.6.4\build\linq2db.SqlServer.props'))" /> - </Target> - <PropertyGroup> - <PostBuildEvent> - </PostBuildEvent> - </PropertyGroup> -</Project> \ No newline at end of file diff --git a/src/Migrator/Program.cs b/src/Migrator/Program.cs deleted file mode 100644 index b99fcc7..0000000 --- a/src/Migrator/Program.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; - -namespace Coscine.Database.Migration -{ - public class Program - { - private const string Instruction = - "possible actions: \n" + - "--migrate_up\n" + - "--roll_back <number of roll back steps>"; - - public static void Main(string[] args) - { - if (args.Length == 0) - { - PrintHelp(); - } - else - { - var targetAssembly = typeof(Program).Assembly; - var migrator = new Migrator(targetAssembly); - - switch (args[0]) - { - case "--migrate_up": - try - { - migrator.MigrateUp(); - } - catch (Exception e) - { - Console.WriteLine("Something went wrong trying to migrate up."); - Console.WriteLine("Error Log: " + e); - } - break; - - case "--roll_back": - if (args.Length < 2) - { - Console.WriteLine("Invalid number of arguments provided for --roll_back (2)."); - break; - } - - if (int.TryParse(args[1], out var steps)) - { - try - { - migrator.RollBack(steps); - } - catch (Exception e) - { - Console.WriteLine("Something went wrong trying to roll back."); - Console.WriteLine("Error Message: " + e); - } - } - else - { - - Console.WriteLine("Argument missing or invalid. Please enter the number of steps to roll back!"); - } - - break; - - default: - Console.WriteLine("A invalid input was provided."); - PrintHelp(); - break; - } - } - - } - - private static void PrintHelp() - { - Console.WriteLine("These are the possible actions:"); - Console.WriteLine(Instruction); - } - } -} \ No newline at end of file diff --git a/src/Migrator/Properties/AssemblyInfo.cs b/src/Migrator/Properties/AssemblyInfo.cs deleted file mode 100644 index 92b59b4..0000000 --- a/src/Migrator/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated by Cake. -// </auto-generated> -//------------------------------------------------------------------------------ -using System.Reflection; - -[assembly: AssemblyTitle("Migrator")] -[assembly: AssemblyDescription("Migrator is a part of the CoScInE group.")] -[assembly: AssemblyCompany("IT Center, RWTH Aachen University")] -[assembly: AssemblyProduct("Migrator")] -[assembly: AssemblyVersion("1.15.0")] -[assembly: AssemblyFileVersion("1.15.0")] -[assembly: AssemblyInformationalVersion("1.15.0-topic-632-projec0003")] -[assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")] - diff --git a/src/Migrator/packages.config b/src/Migrator/packages.config deleted file mode 100644 index 5d93f96..0000000 --- a/src/Migrator/packages.config +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<packages> - <package id="Consul" version="0.7.2.6" targetFramework="net461" /> - <package id="Coscine.Configuration" version="1.4.0" targetFramework="net461" /> - <package id="FluentMigrator" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Abstractions" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Console" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Extensions.SqlAnywhere" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Extensions.SqlServer" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.Core" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.Db2" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.Firebird" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.Hana" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.Jet" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.MySql" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.Oracle" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.Postgres" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.Redshift" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.SqlAnywhere" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.SQLite" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.SqlServer" version="3.1.3" targetFramework="net461" /> - <package id="FluentMigrator.Runner.SqlServerCe" version="3.1.3" targetFramework="net461" /> - <package id="linq2db" version="2.6.4" targetFramework="net461" /> - <package id="linq2db.SqlServer" version="2.6.4" targetFramework="net461" /> - <package id="Microsoft.Extensions.Configuration.Abstractions" version="2.0.1" targetFramework="net461" /> - <package id="Microsoft.Extensions.DependencyInjection" version="2.0.0" targetFramework="net461" /> - <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.0.0" targetFramework="net461" /> - <package id="Microsoft.Extensions.Logging" version="2.0.1" targetFramework="net461" /> - <package id="Microsoft.Extensions.Logging.Abstractions" version="2.0.1" targetFramework="net461" /> - <package id="Microsoft.Extensions.Options" version="2.0.1" targetFramework="net461" /> - <package id="Microsoft.Extensions.Primitives" version="2.0.0" targetFramework="net461" /> - <package id="System.ComponentModel.Annotations" version="4.4.1" targetFramework="net461" /> - <package id="System.Runtime.CompilerServices.Unsafe" version="4.4.0" targetFramework="net461" /> - <package id="System.ValueTuple" version="4.4.0" targetFramework="net461" /> -</packages> \ No newline at end of file -- GitLab