diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 7b1d1701..00000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -riderefcore \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 9b9c32f6..b7756898 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -29,10 +29,6 @@ apply { plugin("com.jetbrains.rdgen") } -dependencies { - testImplementation("org.testng:testng:7.7.0") -} - val riderPluginId: String by project val dotnetPluginId: String by project val productVersion: String by project @@ -142,7 +138,7 @@ intellij { tasks { wrapper { - gradleVersion = "8.2.1" + gradleVersion = "8.3" distributionType = Wrapper.DistributionType.ALL distributionUrl = "https://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-${gradleVersion}-all.zip" } @@ -228,8 +224,6 @@ tasks { } patchPluginXml { - sinceBuild.set("233.0") - untilBuild.set("233.*") val latestChangelog = try { changelog.getUnreleased() } catch (_: MissingVersionException) { @@ -256,8 +250,8 @@ tasks { runIde { // For statistics: - jvmArgs("-Xmx1500m", "-Didea.is.internal=true", "-Dfus.internal.test.mode=true") -// jvmArgs("-Xmx1500m") + // jvmArgs("-Xmx1500m", "-Didea.is.internal=true", "-Dfus.internal.test.mode=true") + jvmArgs("-Xmx1500m") } test { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a79..033e24c4 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 303d301b..e30b3419 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-8.2.1-all.zip +distributionUrl=https\://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-8.3-all.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 9e75d96c..04d137e3 100755 --- a/gradlew +++ b/gradlew @@ -221,10 +221,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. diff --git a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/cli/api/ManagementCommandFactory.kt b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/cli/api/ManagementCommandFactory.kt index 5f0b1230..f82e19bf 100644 --- a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/cli/api/ManagementCommandFactory.kt +++ b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/cli/api/ManagementCommandFactory.kt @@ -4,6 +4,7 @@ import com.intellij.openapi.components.Service import com.intellij.openapi.components.service import com.intellij.openapi.project.Project import com.jetbrains.rider.plugins.efcore.EfCoreUiBundle +import com.jetbrains.rider.plugins.efcore.cli.api.models.DotnetEfVersion import com.jetbrains.rider.plugins.efcore.cli.execution.CliCommand import com.jetbrains.rider.plugins.efcore.cli.execution.CliCommandPresentationInfo @@ -13,16 +14,32 @@ class ManagementCommandFactory(private val intellijProject: Project) { fun getInstance(project: Project) = project.service() } - fun installEfCoreTools(): CliCommand { + fun installGlobalTools(version: DotnetEfVersion? = null): CliCommand { val presentation = CliCommandPresentationInfo( - EfCoreUiBundle.message("install.dotnet.tool.presentable.name"), + EfCoreUiBundle.message("install.global.dotnet.tool.presentable.name"), EfCoreUiBundle.message("ef.core.global.tools.have.been.successfully.installed")) - return DotnetCliCommandBuilder(presentation, intellijProject, "tool", "install").apply { - add("--ignore-failed-sources") - addNamed("--add-source", "https://api.nuget.org/v3/index.json") + return prepareToolInstallCommand(presentation).apply { add("--global") add("dotnet-ef") }.build() } + + fun installLocalTools(version: DotnetEfVersion? = null): CliCommand { + val presentation = CliCommandPresentationInfo( + EfCoreUiBundle.message("install.local.dotnet.tool.presentable.name"), + EfCoreUiBundle.message("ef.core.local.tools.have.been.successfully.installed")) + + return prepareToolInstallCommand(presentation).apply { + add("dotnet-ef") + addNamedNullable("--version", version.toString()) + }.build() + } + + private fun prepareToolInstallCommand(presentation: CliCommandPresentationInfo) = + DotnetCliCommandBuilder(presentation, intellijProject, "tool", "install").apply { + add("--ignore-failed-sources") + add("--create-manifest-if-needed") + addNamed("--add-source", "https://api.nuget.org/v3/index.json") + } } \ No newline at end of file diff --git a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/cli/execution/CliCommand.kt b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/cli/execution/CliCommand.kt index 30c6ca79..32c3b554 100644 --- a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/cli/execution/CliCommand.kt +++ b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/cli/execution/CliCommand.kt @@ -2,7 +2,7 @@ package com.jetbrains.rider.plugins.efcore.cli.execution import com.intellij.execution.configurations.GeneralCommandLine -open class CliCommand( +data class CliCommand( val dotnetPath: String, val commandLine: GeneralCommandLine, val presentationInfo: CliCommandPresentationInfo diff --git a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/eftools/InstallDotnetEfAction.kt b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/eftools/InstallDotnetEfAction.kt index 8c04f025..82a759bb 100644 --- a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/eftools/InstallDotnetEfAction.kt +++ b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/eftools/InstallDotnetEfAction.kt @@ -12,7 +12,7 @@ class InstallDotnetEfAction : AnAction(EfCoreUiBundle.message("action.install.te override fun actionPerformed(actionEvent: AnActionEvent) { val project = actionEvent.project ?: return val executor = PreferredCommandExecutorProvider.getInstance(project).getExecutor() - val command = ManagementCommandFactory.getInstance(project).installEfCoreTools() + val command = ManagementCommandFactory.getInstance(project).installGlobalTools() project.lifetime.launchBackground { executor.execute(command) } diff --git a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/migrations/add/AddMigrationDialogWrapper.kt b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/migrations/add/AddMigrationDialogWrapper.kt index ce67ac04..0606d386 100644 --- a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/migrations/add/AddMigrationDialogWrapper.kt +++ b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/migrations/add/AddMigrationDialogWrapper.kt @@ -1,6 +1,7 @@ package com.jetbrains.rider.plugins.efcore.features.migrations.add import com.intellij.openapi.project.Project +import com.intellij.openapi.ui.TextFieldWithBrowseButton import com.intellij.ui.components.JBTextField import com.intellij.ui.dsl.builder.AlignX import com.intellij.ui.dsl.builder.Panel @@ -17,6 +18,7 @@ import com.jetbrains.rider.plugins.efcore.features.shared.dialog.DialogCommand import com.jetbrains.rider.plugins.efcore.ui.AnyInputDocumentListener import com.jetbrains.rider.plugins.efcore.ui.textFieldForRelativeFolder import org.jetbrains.annotations.NonNls +import org.jetbrains.annotations.TestOnly import java.io.File import java.util.* @@ -31,8 +33,6 @@ class AddMigrationDialogWrapper( intellijProject, selectedProjectId ) { - private val migrationsCommandFactory by lazy { MigrationsCommandFactory.getInstance(intellijProject) } - // // Internal data private val migrationProjectFolder = observable("").withLogger("migrationProjectFolder") @@ -43,6 +43,12 @@ class AddMigrationDialogWrapper( // Validation private val validator = AddMigrationValidator(dataCtx) + @TestOnly + internal var migrationNameComponent: JBTextField? = null + + @TestOnly + internal var migrationsFolderComponent: TextFieldWithBrowseButton? = null + // // Constructor init { @@ -80,6 +86,7 @@ class AddMigrationDialogWrapper( .focused() .applyToComponent { setupInitialMigrationNameListener(this) + migrationNameComponent = this } } } @@ -93,6 +100,7 @@ class AddMigrationDialogWrapper( .validationOnInput(validator.migrationsOutputFolderValidation()) .validationOnApply(validator.migrationsOutputFolderValidation()) .applyToComponent { + migrationsFolderComponent = this dataCtx.migrationsProject.afterChange { isEnabled = it != null } } } diff --git a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/shared/dialog/CommonDialogWrapper.kt b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/shared/dialog/CommonDialogWrapper.kt index b3596757..ba11fbc5 100644 --- a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/shared/dialog/CommonDialogWrapper.kt +++ b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/features/shared/dialog/CommonDialogWrapper.kt @@ -2,6 +2,7 @@ package com.jetbrains.rider.plugins.efcore.features.shared.dialog import com.intellij.openapi.components.service import com.intellij.openapi.project.Project +import com.intellij.openapi.ui.ComboBox import com.intellij.openapi.ui.DialogPanel import com.intellij.ui.components.JBCheckBox import com.intellij.ui.dsl.builder.AlignX @@ -29,6 +30,7 @@ import com.jetbrains.rider.plugins.efcore.ui.items.* import com.jetbrains.rider.plugins.efcore.ui.localize import com.jetbrains.rider.plugins.efcore.ui.simpleExpandableTextField import org.jetbrains.annotations.NonNls +import org.jetbrains.annotations.TestOnly import java.awt.event.ActionEvent import java.util.* import javax.swing.AbstractAction @@ -37,8 +39,8 @@ import javax.swing.JComponent @Suppress("MemberVisibilityCanBePrivate") abstract class CommonDialogWrapper( - protected val dataCtx: TContext, - protected val efCoreVersion: DotnetEfVersion, + val dataCtx: TContext, + val efCoreVersion: DotnetEfVersion, dialogTitle: String, protected val intellijProject: Project, private val selectedProjectId: UUID?, @@ -79,6 +81,22 @@ abstract class CommonDialogWrapper( // UI protected lateinit var panel: DialogPanel + @TestOnly + internal var migrationsProjectComponent: ComboBox? = null + + @TestOnly + internal var startupProjectComponent: ComboBox? = null + + @TestOnly + internal var dbContextComponent: ComboBox? = null + + @TestOnly + internal var targetFrameworkComponent: ComboBox? = null + + @TestOnly + internal var buildConfigurationComponent: ComboBox? = null + + // // Constructor init { @@ -231,6 +249,11 @@ abstract class CommonDialogWrapper( } } + @TestOnly + internal fun requestPanel(): DialogPanel { + return panel + } + // // UI override fun createCenterPanel(): JComponent = @@ -283,6 +306,7 @@ abstract class CommonDialogWrapper( iconComboBox(migrationsProjectView, availableMigrationsProjectsView) .validationOnInput(validator.migrationsProjectValidation()) .validationOnApply(validator.migrationsProjectValidation()) + .applyToComponent { migrationsProjectComponent = this } } } @@ -292,6 +316,7 @@ abstract class CommonDialogWrapper( .validationOnInput(validator.startupProjectValidation()) .validationOnApply(validator.startupProjectValidation()) .comment(EfCoreUiBundle.message("startup.project.missing.comment")) + .applyToComponent { startupProjectComponent = this } } } @@ -300,6 +325,7 @@ abstract class CommonDialogWrapper( iconComboBox(dbContextView, availableDbContextsView) .validationOnInput(validator.dbContextValidation()) .validationOnApply(validator.dbContextValidation()) + .applyToComponent { dbContextComponent = this } } } @@ -320,12 +346,14 @@ abstract class CommonDialogWrapper( iconComboBox(buildConfigurationView, availableBuildConfigurationView) .validationOnInput(validator.buildConfigurationValidation()) .validationOnApply(validator.buildConfigurationValidation()) + .applyToComponent { buildConfigurationComponent = this } }.enabledIf(noBuildCheck!!.selected.not()) row(EfCoreUiBundle.message("target.framework")) { iconComboBox(targetFrameworksView, availableTargetFrameworksView) .validationOnInput(validator.targetFrameworkValidation()) .validationOnInput(validator.targetFrameworkValidation()) + .applyToComponent { targetFrameworkComponent = this } }.enabledIf(noBuildCheck!!.selected.not()) } } diff --git a/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/ui/ComboBoxModelExtensions.kt b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/ui/ComboBoxModelExtensions.kt new file mode 100644 index 00000000..a12bdab5 --- /dev/null +++ b/src/rider/main/kotlin/com/jetbrains/rider/plugins/efcore/ui/ComboBoxModelExtensions.kt @@ -0,0 +1,11 @@ +package com.jetbrains.rider.plugins.efcore.ui + +import javax.swing.ComboBoxModel + +val ComboBoxModel.elements: List get() { + return buildList { + for (i in 0 until getSize()) { + add(getElementAt(i)) + } + } +} \ No newline at end of file diff --git a/src/rider/main/resources/messages/EfCoreUiBundle.properties b/src/rider/main/resources/messages/EfCoreUiBundle.properties index 922247a8..6538cbf9 100644 --- a/src/rider/main/resources/messages/EfCoreUiBundle.properties +++ b/src/rider/main/resources/messages/EfCoreUiBundle.properties @@ -152,7 +152,10 @@ tab.ef.core.command=EF Core Command # # Install EF Core tools action.install.text=Install +install.global.dotnet.tool.presentable.name=Install .NET Tool +install.local.dotnet.tool.presentable.name=Install .NET Tool (Local) ef.core.global.tools.have.been.successfully.installed=EF Core global tools have been successfully installed +ef.core.local.tools.have.been.successfully.installed=EF Core local tools have been successfully installed progress.title.getting.dotnet.ef.version=Getting dotnet-ef version\u2026 notification.content.ef.core.tools.are.required.to.execute.this.action=To use EF Core in the IDE, install dotnet-ef as a global tool notification.content.invalid.ef.core.tools.version=Unable to find available EF Core tools @@ -188,4 +191,3 @@ default.target.framework= tool.kind.none=None tool.kind.local=Local tool.kind.global=Global -install.dotnet.tool.presentable.name=Install .NET Tool \ No newline at end of file diff --git a/src/test/kotlin/com/jetbrains/rider/plugins/efcore/cases/AddMigrationDialogTest.kt b/src/test/kotlin/com/jetbrains/rider/plugins/efcore/cases/AddMigrationDialogTest.kt new file mode 100644 index 00000000..2ea58799 --- /dev/null +++ b/src/test/kotlin/com/jetbrains/rider/plugins/efcore/cases/AddMigrationDialogTest.kt @@ -0,0 +1,127 @@ +@file:Suppress("HardCodedStringLiteral") + +package com.jetbrains.rider.plugins.efcore.cases + +import com.intellij.platform.backend.workspace.WorkspaceModel +import com.intellij.platform.backend.workspace.virtualFile +import com.jetbrains.rdclient.util.idea.toIOFile +import com.jetbrains.rider.plugins.efcore.cli.api.models.DotnetEfVersion +import com.jetbrains.rider.plugins.efcore.features.migrations.add.AddMigrationDialogWrapper +import com.jetbrains.rider.plugins.efcore.framework.EfCoreDialogTest +import com.jetbrains.rider.plugins.efcore.rd.MigrationsIdentity +import com.jetbrains.rider.plugins.efcore.rd.riderEfCoreModel +import com.jetbrains.rider.projectView.solution +import com.jetbrains.rider.projectView.workspace.getContentRootUrl +import com.jetbrains.rider.test.annotations.TestEnvironment +import com.jetbrains.rider.test.env.enums.BuildTool +import com.jetbrains.rider.test.env.enums.SdkVersion +import com.jetbrains.rider.test.framework.waitBackendAndWorkspaceModelSuspending +import com.jetbrains.rider.test.framework.waitBackendSuspending +import com.jetbrains.rider.test.scriptingApi.changeFileSystem2 +import com.jetbrains.rider.test.scriptingApi.runBlockingWithFlushing +import org.testng.annotations.DataProvider +import org.testng.annotations.Test +import java.io.File +import kotlin.test.assertNotNull +import kotlin.test.assertTrue +import kotlin.time.Duration + +@TestEnvironment(sdkVersion = SdkVersion.AUTODETECT, buildTool = BuildTool.AUTODETECT) +class AddMigrationDialogTest : EfCoreDialogTest() { + private val efToolset = DotnetEfVersion(7, 0, 10) + + override fun getSolutionDirectoryName() = "EFCoreSolution" + + @Suppress("HardCodedStringLiteral") + @DataProvider + fun validMigrationNames() = arrayOf( + arrayOf("EFCoreConsoleApp", "EFCoreConsoleApp.DAL", "BloggingContext", "Abc", "Abc" ), + arrayOf("EFCoreConsoleApp", "EFCoreConsoleApp.DAL", "BloggingContext", "Abc123", "Abc123",), + arrayOf("EFCoreConsoleApp", "EFCoreConsoleApp.DAL", "BloggingContext", "Abc_123", "Abc_123"), + arrayOf("EFCoreConsoleApp", "EFCoreConsoleApp.DAL", "BloggingContext", "abc-123", "abc123"), + arrayOf("EFCoreConsoleApp", "EFCoreConsoleApp.DAL", "BloggingContext", "Abc 123", "Abc123"), + arrayOf("EFCoreConsoleApp", "EFCoreConsoleApp.DAL", "BloggingContext", "Abc$123", "Abc123"), + arrayOf("EFCoreConsoleApp", "EFCoreConsoleApp.DAL", "BloggingContext", "123Abc", "_123Abc"), + ) + + @Suppress("HardCodedStringLiteral") + @DataProvider + fun validMigrationFolders() = arrayOf( + arrayOf("EFCoreConsoleApp", "EFCoreConsoleApp.DAL", "BloggingContext", "Migrations"), + arrayOf("EFCoreConsoleApp", "EFCoreConsoleApp.DAL", "BloggingContext", "_Migrations"), + arrayOf("EFCoreConsoleApp", "EFCoreConsoleApp.DAL", "BloggingContext", "Migrations 123"), + arrayOf("EFCoreConsoleApp", "EFCoreConsoleApp.DAL", "BloggingContext", "Migrations$123"), + ) + + @Test(dataProvider = "validMigrationNames") + fun addMigrationCustomName(startupProjectName: String, migrationsProjectName: String, dbContextName: String, sourceName: String, targetName: String) { + runBlockingWithFlushing("addMigrationCustomName", Duration.INFINITE) { + installEfLocalTools(efToolset) + waitBackendSuspending(project) + withDialog({ AddMigrationDialogWrapper(efToolset, project, null) }) { dialog, dataCtx -> + selectStartupProject(startupProjectName) + selectMigrationsProject(migrationsProjectName) + selectDbContext(dbContextName) + setMigrationName(sourceName) + + executeCommand() + + assertMigrationExist(targetName) + } + } + } + + @Test(dataProvider = "validMigrationFolders") + fun addMigrationCustomFolder(startupProjectName: String, migrationsProjectName: String, dbContextName: String, folderName: String) { + runBlockingWithFlushing("addMigrationCustomFolder", Duration.INFINITE) { + installEfLocalTools(efToolset) + waitBackendSuspending(project) + withDialog({ AddMigrationDialogWrapper(efToolset, project, null) }) { dialog, dataCtx -> + selectStartupProject(startupProjectName) + selectMigrationsProject(migrationsProjectName) + selectDbContext(dbContextName) + val migrationName = "SomeSafeName" + setMigrationName(migrationName) + setMigrationFolder(folderName) + + executeCommand() + + assertMigrationExist(migrationName) + } + } + } + + private fun AddMigrationDialogWrapper.setMigrationName(name: String) { + assertNotNull(migrationNameComponent, "Migration name field wasn't initialized") { + it.text = name + } + } + + private fun AddMigrationDialogWrapper.setMigrationFolder(name: String) { + assertNotNull(migrationsFolderComponent, "Migration folder field wasn't initialized") { + it.text = name + } + } + + private suspend fun AddMigrationDialogWrapper.assertMigrationExist(name: String) { + val migrationsProject = assertNotNull(dataCtx.migrationsProject.value, "Migrations project is null") + val dotnetProject = assertNotNull(findProjectById(migrationsProject.id), "Project wasn't found") + val dotnetProjectDirectory = assertNotNull(dotnetProject.getContentRootUrl(WorkspaceModel.getInstance(project).getVirtualFileUrlManager())?.virtualFile, "Project directory wasn't found") + + changeFileSystem2(project) { + arrayOf(dotnetProjectDirectory.toIOFile()) + } + waitBackendAndWorkspaceModelSuspending(project) + + val model = project.solution.riderEfCoreModel + val dbContext = assertNotNull(dataCtx.dbContext.value, "DbContext is null") + val migrations = model.getAvailableMigrations.startSuspending(MigrationsIdentity(migrationsProject.id, dbContext.fullName)) + val migration = migrations.firstOrNull { it.migrationShortName == name } + assertNotNull(migration, "Migration can't be found on backend") + + val migrationsFolder = assertNotNull(dataCtx.migrationsOutputFolder.value, "Migrations folder is null") + val migrationsFolderFullPath = File(migrationsProject.fullPath).parentFile.resolve(migrationsFolder) + val migrationFullPath = migrationsFolderFullPath.resolve("${migration.migrationLongName}.cs") + assertTrue(migrationFullPath.exists(), "Migration can't be found at path '$migrationFullPath'") + } +} \ No newline at end of file diff --git a/src/test/kotlin/com/jetbrains/rider/plugins/efcore/cases/DummyTest.kt b/src/test/kotlin/com/jetbrains/rider/plugins/efcore/cases/DummyTest.kt deleted file mode 100644 index 505a2ff1..00000000 --- a/src/test/kotlin/com/jetbrains/rider/plugins/efcore/cases/DummyTest.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.jetbrains.rider.plugins.efcore.cases - -import com.jetbrains.rider.test.base.BaseTestWithShell -import org.testng.annotations.Test - -@Test -//@TestEnvironment(toolset = ToolsetVersion.TOOLSET_17_CORE, coreVersion = CoreVersion.DOT_NET_6) -class DummyTest : BaseTestWithShell() { - @Test - fun someTest() { - assert(true) - } -} diff --git a/src/test/kotlin/com/jetbrains/rider/plugins/efcore/framework/EfCoreDialogTest.kt b/src/test/kotlin/com/jetbrains/rider/plugins/efcore/framework/EfCoreDialogTest.kt new file mode 100644 index 00000000..16fe9e5d --- /dev/null +++ b/src/test/kotlin/com/jetbrains/rider/plugins/efcore/framework/EfCoreDialogTest.kt @@ -0,0 +1,67 @@ +package com.jetbrains.rider.plugins.efcore.framework + +import com.intellij.openapi.ui.DialogPanel +import com.jetbrains.rider.plugins.efcore.cli.api.EfCoreCliCommandFactory +import com.jetbrains.rider.plugins.efcore.cli.execution.CliCommandResult +import com.jetbrains.rider.plugins.efcore.features.shared.dialog.CommonDataContext +import com.jetbrains.rider.plugins.efcore.features.shared.dialog.CommonDialogWrapper +import com.jetbrains.rider.plugins.efcore.ui.elements +import com.jetbrains.rider.plugins.efcore.ui.items.DbContextItem +import com.jetbrains.rider.plugins.efcore.ui.items.MigrationsProjectItem +import com.jetbrains.rider.plugins.efcore.ui.items.StartupProjectItem +import kotlin.test.assertNotNull + +@Suppress("HardCodedStringLiteral", "UnstableApiUsage") +abstract class EfCoreDialogTest : EfCoreTest() { + protected suspend fun > withDialog(dialogFactory: () -> TDialog, action: suspend TDialog.(DialogPanel, TContext) -> Unit) { + val dialog = dialogFactory() + val panel = dialog.requestPanel() + dialog.action(panel, dialog.dataCtx) + dialog.disposeIfNeeded() + } + + fun > TDialog.selectMigrationsProject(name: String): MigrationsProjectItem { + val migrationsProjectItem = assertNotNull( + migrationsProjectComponent?.model?.elements?.firstOrNull { it.data.name == name }, + "Migrations project with name $name wasn't found in component's available items") + migrationsProjectComponent?.model?.selectedItem = migrationsProjectItem + return migrationsProjectItem + } + + fun > TDialog.selectStartupProject(name: String): StartupProjectItem { + val startupProjectItem = assertNotNull( + startupProjectComponent?.model?.elements?.firstOrNull { it.data.name == name }, + "Startup project with name $name wasn't found in component's available items") + startupProjectComponent?.model?.selectedItem = startupProjectItem + return startupProjectItem + } + + fun > TDialog.selectDbContext(name: String): DbContextItem { + val dbContextItem = assertNotNull( + dbContextComponent?.model?.elements?.firstOrNull { it.data.name == name }, + "DbContext with name $name wasn't found in component's available items") + dbContextComponent?.model?.selectedItem = dbContextItem + return dbContextItem + } + + fun > TDialog.assertValid() { + requestPanel().apply() + val errors = performValidateAll() + val presentableErrors = errors + .joinToString("\n") { "\t${it.component}: ${it.message}" } + .let { "Validation summary:\n$it" } + if (errors.isNotEmpty()) { + logger.warn(presentableErrors) + } + assert(errors.isEmpty()) { "Validation should succeed" } + } + + suspend fun > TDialog.executeCommand(): CliCommandResult { + assertValid() + val command = generateCommand() + val cliCommand = EfCoreCliCommandFactory.getInstance(project).create(command, efCoreVersion) + val result = executeCommand(cliCommand) + postCommandExecute(result) + return result + } +} \ No newline at end of file diff --git a/src/test/kotlin/com/jetbrains/rider/plugins/efcore/framework/EfCoreTest.kt b/src/test/kotlin/com/jetbrains/rider/plugins/efcore/framework/EfCoreTest.kt new file mode 100644 index 00000000..264f55c9 --- /dev/null +++ b/src/test/kotlin/com/jetbrains/rider/plugins/efcore/framework/EfCoreTest.kt @@ -0,0 +1,47 @@ +package com.jetbrains.rider.plugins.efcore.framework + +import com.intellij.execution.configurations.GeneralCommandLine +import com.intellij.platform.backend.workspace.WorkspaceModel +import com.jetbrains.rd.platform.util.lifetime +import com.jetbrains.rd.util.lifetime.waitTermination +import com.jetbrains.rider.model.RdProjectDescriptor +import com.jetbrains.rider.plugins.efcore.cli.api.DotnetCliCommandBuilder +import com.jetbrains.rider.plugins.efcore.cli.api.ManagementCommandFactory +import com.jetbrains.rider.plugins.efcore.cli.api.models.DotnetEfVersion +import com.jetbrains.rider.plugins.efcore.cli.execution.CliCommand +import com.jetbrains.rider.plugins.efcore.cli.execution.CliCommandPresentationInfo +import com.jetbrains.rider.plugins.efcore.cli.execution.CliCommandResult +import com.jetbrains.rider.projectView.workspace.ProjectModelEntity +import com.jetbrains.rider.projectView.workspace.findProjects +import com.jetbrains.rider.projectView.workspace.isProject +import com.jetbrains.rider.test.base.BaseTestWithSolution +import java.util.* +import kotlin.test.assertTrue + +abstract class EfCoreTest : BaseTestWithSolution() { + suspend fun installEfLocalTools(version: DotnetEfVersion) { + val presentation = CliCommandPresentationInfo("Manifest", "Manifest created") + val initManifest = DotnetCliCommandBuilder(presentation, project, "new", "tool-manifest", "--force").build() + assertTrue("Init manifest failed") { executeCommand(initManifest).succeeded } + + val installTools = ManagementCommandFactory.getInstance(project).installLocalTools(version) + assertTrue("dotnet-ef installation failed") { executeCommand(installTools).succeeded } + } + + fun findProjectById(id: UUID): ProjectModelEntity? { + return WorkspaceModel.getInstance(project) + .findProjects() + .filter { it.isProject() } + .map { it to it.descriptor as RdProjectDescriptor } + .firstOrNull { it.second.originalGuid == id } + ?.first + } + + suspend fun executeCommand(command: CliCommand): CliCommandResult { + val patchedCommand = command.copy( + commandLine = command.commandLine.withEnvironment("DOTNET_ROLL_FORWARD", "LatestMajor")) + + val commandResult = TestCommandExecutor(project).execute(patchedCommand) + return commandResult ?: throw NotImplementedError() + } +} \ No newline at end of file diff --git a/src/test/kotlin/com/jetbrains/rider/plugins/efcore/framework/TestCommandExecutor.kt b/src/test/kotlin/com/jetbrains/rider/plugins/efcore/framework/TestCommandExecutor.kt new file mode 100644 index 00000000..b05ea14b --- /dev/null +++ b/src/test/kotlin/com/jetbrains/rider/plugins/efcore/framework/TestCommandExecutor.kt @@ -0,0 +1,67 @@ +package com.jetbrains.rider.plugins.efcore.framework + +import com.intellij.execution.process.OSProcessHandler +import com.intellij.execution.process.ProcessAdapter +import com.intellij.execution.process.ProcessEvent +import com.intellij.execution.process.ProcessHandler +import com.intellij.openapi.diagnostic.logger +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.Key +import com.jetbrains.rider.plugins.efcore.EfCoreUiBundle +import com.jetbrains.rider.plugins.efcore.cli.execution.CliCommand +import com.jetbrains.rider.plugins.efcore.cli.execution.CliCommandExecutor +import com.jetbrains.rider.plugins.efcore.cli.execution.CliCommandResult +import kotlinx.coroutines.CancellationException +import kotlinx.coroutines.CompletableDeferred + +@Suppress("HardCodedStringLiteral") +class TestCommandExecutor(intellijProject: Project) : CliCommandExecutor(intellijProject) { + private val logger = logger() + + override suspend fun doExecute(command: CliCommand): CliCommandResult? { + return try { + val processCompletion = CompletableDeferred() + val processHandler = createProcessHandler(command, processCompletion) + logger.info("Starting process '${command.commandLine.commandLineString}'") + processHandler.startNotify() + processCompletion.await() + } catch (cancellation: CancellationException) { + null + } + } + + private fun createProcessHandler(command: CliCommand, + completion: CompletableDeferred): ProcessHandler = + OSProcessHandler(command.commandLine).apply { + addProcessListener(object : ProcessAdapter() { + private val outputBuilder = StringBuilder() + private val errorBuilder = StringBuilder() + private val logger = logger() + override fun onTextAvailable(event: ProcessEvent, outputType: Key<*>) { + val text = event.text.trim() + logger.info("${command.commandLine.exePath} [$outputType]: ${text}") + outputBuilder.append(text) + } + + override fun processTerminated(event: ProcessEvent) { + logger.info(EfCoreUiBundle.message("process.terminated.with.exit.code", event.exitCode)) + + val result = CliCommandResult( + command.commandLine.commandLineString, + event.exitCode, + outputBuilder.toString(), + event.exitCode == 0, + errorBuilder.toString() + ) + + completion.complete(result) + } + + override fun processNotStarted() { + logger.error("Process wasn't started") + + completion.cancel() + } + }) + } +} \ No newline at end of file diff --git a/testData/NuGet.config b/testData/NuGet.config new file mode 100644 index 00000000..6ce97590 --- /dev/null +++ b/testData/NuGet.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/testData/solutions/EFCoreSolution/EF Core Single App 31/BloggingContext.cs b/testData/solutions/EFCoreSolution/EF Core Single App 31/BloggingContext.cs new file mode 100644 index 00000000..14ad4dc6 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App 31/BloggingContext.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace EFCoreConsoleApp +{ + public class BloggingContext : DbContext + { + public DbSet Blogs { get; set; } + public DbSet Posts { get; set; } + + public string DbPath { get; private set; } + + public BloggingContext() + { + var folder = Environment.SpecialFolder.LocalApplicationData; + var path = Environment.GetFolderPath(folder); + DbPath = $"{path}{System.IO.Path.DirectorySeparatorChar}blogging.db"; + } + + // The following configures EF to create a Sqlite database file in the + // special "local" folder for your platform. + protected override void OnConfiguring(DbContextOptionsBuilder options) + => options.UseSqlite($"Data Source={DbPath}"); + } + + public class BloggingContext2 : DbContext + { + public DbSet Blogs2 { get; set; } + + public string DbPath { get; private set; } + + public BloggingContext2() + { + var folder = Environment.SpecialFolder.LocalApplicationData; + var path = Environment.GetFolderPath(folder); + DbPath = $"{path}{System.IO.Path.DirectorySeparatorChar}blogging.db"; + } + + // The following configures EF to create a Sqlite database file in the + // special "local" folder for your platform. + protected override void OnConfiguring(DbContextOptionsBuilder options) + => options.UseSqlite($"Data Source={DbPath}"); + } + + public class Blog + { + public int BlogId { get; set; } + public string Url { get; set; } + + public List Posts { get; } = new List(); + } + + public class Post + { + public int PostId { get; set; } + public string Title { get; set; } + public string Content { get; set; } + + public int BlogId { get; set; } + public Blog Blog { get; set; } + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EF Core Single App 31/EFCoreSingleApp31.csproj b/testData/solutions/EFCoreSolution/EF Core Single App 31/EFCoreSingleApp31.csproj new file mode 100644 index 00000000..e71d970c --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App 31/EFCoreSingleApp31.csproj @@ -0,0 +1,16 @@ + + + + Exe + netcoreapp3.1 + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/testData/solutions/EFCoreSolution/EF Core Single App 31/Program.cs b/testData/solutions/EFCoreSolution/EF Core Single App 31/Program.cs new file mode 100644 index 00000000..27d47744 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App 31/Program.cs @@ -0,0 +1,41 @@ +using System; +using System.Linq; +using EFCoreConsoleApp; + +namespace EFCoreSingleApp +{ + class Program + { + static void Main(string[] args) + { + using (var db = new BloggingContext()) + { + // Note: This sample requires the database to be created before running. + Console.WriteLine($"Database path: {db.DbPath}."); + + // Create + Console.WriteLine("Inserting a new blog"); + db.Add(new Blog { Url = "http://blogs.msdn.com/adonet" }); + db.SaveChanges(); + + // Read + Console.WriteLine("Querying for a blog"); + var blog = db.Blogs + .OrderBy(b => b.BlogId) + .First(); + + // Update + Console.WriteLine("Updating the blog and adding a post"); + blog.Url = "https://devblogs.microsoft.com/dotnet"; + blog.Posts.Add( + new Post { Title = "Hello World", Content = "I wrote an app using EF Core!" }); + db.SaveChanges(); + + // Delete + Console.WriteLine("Delete the blog"); + db.Remove(blog); + db.SaveChanges(); + } + } + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/BloggingContext.cs b/testData/solutions/EFCoreSolution/EF Core Single App/BloggingContext.cs new file mode 100644 index 00000000..14ad4dc6 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/BloggingContext.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace EFCoreConsoleApp +{ + public class BloggingContext : DbContext + { + public DbSet Blogs { get; set; } + public DbSet Posts { get; set; } + + public string DbPath { get; private set; } + + public BloggingContext() + { + var folder = Environment.SpecialFolder.LocalApplicationData; + var path = Environment.GetFolderPath(folder); + DbPath = $"{path}{System.IO.Path.DirectorySeparatorChar}blogging.db"; + } + + // The following configures EF to create a Sqlite database file in the + // special "local" folder for your platform. + protected override void OnConfiguring(DbContextOptionsBuilder options) + => options.UseSqlite($"Data Source={DbPath}"); + } + + public class BloggingContext2 : DbContext + { + public DbSet Blogs2 { get; set; } + + public string DbPath { get; private set; } + + public BloggingContext2() + { + var folder = Environment.SpecialFolder.LocalApplicationData; + var path = Environment.GetFolderPath(folder); + DbPath = $"{path}{System.IO.Path.DirectorySeparatorChar}blogging.db"; + } + + // The following configures EF to create a Sqlite database file in the + // special "local" folder for your platform. + protected override void OnConfiguring(DbContextOptionsBuilder options) + => options.UseSqlite($"Data Source={DbPath}"); + } + + public class Blog + { + public int BlogId { get; set; } + public string Url { get; set; } + + public List Posts { get; } = new List(); + } + + public class Post + { + public int PostId { get; set; } + public string Title { get; set; } + public string Content { get; set; } + + public int BlogId { get; set; } + public Blog Blog { get; set; } + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/EFCoreSingleApp.csproj b/testData/solutions/EFCoreSolution/EF Core Single App/EFCoreSingleApp.csproj new file mode 100644 index 00000000..29b4553c --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/EFCoreSingleApp.csproj @@ -0,0 +1,16 @@ + + + + Exe + net5.0 + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211202185558_Initial.Designer.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211202185558_Initial.Designer.cs new file mode 100644 index 00000000..cdc5a22c --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211202185558_Initial.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreSingleApp.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20211202185558_Initial")] + partial class Initial + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211202185558_Initial.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211202185558_Initial.cs new file mode 100644 index 00000000..49984df9 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211202185558_Initial.cs @@ -0,0 +1,58 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreSingleApp.Migrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Blogs", + columns: table => new + { + BlogId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Url = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Blogs", x => x.BlogId); + }); + + migrationBuilder.CreateTable( + name: "Posts", + columns: table => new + { + PostId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Title = table.Column(type: "TEXT", nullable: true), + Content = table.Column(type: "TEXT", nullable: true), + BlogId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Posts", x => x.PostId); + table.ForeignKey( + name: "FK_Posts_Blogs_BlogId", + column: x => x.BlogId, + principalTable: "Blogs", + principalColumn: "BlogId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Posts_BlogId", + table: "Posts", + column: "BlogId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Posts"); + + migrationBuilder.DropTable( + name: "Blogs"); + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013341_Migration2.Designer.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013341_Migration2.Designer.cs new file mode 100644 index 00000000..3cc9e397 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013341_Migration2.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreSingleApp.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20211204013341_Migration2")] + partial class Migration2 + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013341_Migration2.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013341_Migration2.cs new file mode 100644 index 00000000..332962c5 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013341_Migration2.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreSingleApp.Migrations +{ + public partial class Migration2 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013352_Migration3.Designer.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013352_Migration3.Designer.cs new file mode 100644 index 00000000..3a717e97 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013352_Migration3.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreSingleApp.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20211204013352_Migration3")] + partial class Migration3 + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013352_Migration3.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013352_Migration3.cs new file mode 100644 index 00000000..ce1737b2 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211204013352_Migration3.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreSingleApp.Migrations +{ + public partial class Migration3 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211205030446_SomeMigration223.Designer.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211205030446_SomeMigration223.Designer.cs new file mode 100644 index 00000000..101139e1 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211205030446_SomeMigration223.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreSingleApp.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20211205030446_SomeMigration223")] + partial class SomeMigration223 + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211205030446_SomeMigration223.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211205030446_SomeMigration223.cs new file mode 100644 index 00000000..4a6d0d8b --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211205030446_SomeMigration223.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreSingleApp.Migrations +{ + public partial class SomeMigration223 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209213608_SomeCoolCoolMigration.Designer.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209213608_SomeCoolCoolMigration.Designer.cs new file mode 100644 index 00000000..63cc1bbe --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209213608_SomeCoolCoolMigration.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreSingleApp.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20211209213608_SomeCoolCoolMigration")] + partial class SomeCoolCoolMigration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209213608_SomeCoolCoolMigration.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209213608_SomeCoolCoolMigration.cs new file mode 100644 index 00000000..42bfff8f --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209213608_SomeCoolCoolMigration.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreSingleApp.Migrations +{ + public partial class SomeCoolCoolMigration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209215101_Wow Migration.Designer.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209215101_Wow Migration.Designer.cs new file mode 100644 index 00000000..dbceb87e --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209215101_Wow Migration.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreSingleApp.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20211209215101_Wow Migration")] + partial class WowMigration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209215101_Wow Migration.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209215101_Wow Migration.cs new file mode 100644 index 00000000..fb0fdd37 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/20211209215101_Wow Migration.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreSingleApp.Migrations +{ + public partial class WowMigration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContext2Migrations/20211204224712_Initial.Designer.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContext2Migrations/20211204224712_Initial.Designer.cs new file mode 100644 index 00000000..c76d239a --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContext2Migrations/20211204224712_Initial.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreSingleApp.Migrations.BloggingContext2Migrations +{ + [DbContext(typeof(BloggingContext2))] + [Migration("20211204224712_Initial")] + partial class Initial + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs2"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Post"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContext2Migrations/20211204224712_Initial.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContext2Migrations/20211204224712_Initial.cs new file mode 100644 index 00000000..db2b9c3b --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContext2Migrations/20211204224712_Initial.cs @@ -0,0 +1,58 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreSingleApp.Migrations.BloggingContext2Migrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Blogs2", + columns: table => new + { + BlogId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Url = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Blogs2", x => x.BlogId); + }); + + migrationBuilder.CreateTable( + name: "Post", + columns: table => new + { + PostId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Title = table.Column(type: "TEXT", nullable: true), + Content = table.Column(type: "TEXT", nullable: true), + BlogId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Post", x => x.PostId); + table.ForeignKey( + name: "FK_Post_Blogs2_BlogId", + column: x => x.BlogId, + principalTable: "Blogs2", + principalColumn: "BlogId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Post_BlogId", + table: "Post", + column: "BlogId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Post"); + + migrationBuilder.DropTable( + name: "Blogs2"); + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContext2Migrations/BloggingContext2ModelSnapshot.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContext2Migrations/BloggingContext2ModelSnapshot.cs new file mode 100644 index 00000000..fcc40f9e --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContext2Migrations/BloggingContext2ModelSnapshot.cs @@ -0,0 +1,72 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreSingleApp.Migrations.BloggingContext2Migrations +{ + [DbContext(typeof(BloggingContext2))] + partial class BloggingContext2ModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs2"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Post"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContextModelSnapshot.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContextModelSnapshot.cs new file mode 100644 index 00000000..fce143e5 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Migrations/BloggingContextModelSnapshot.cs @@ -0,0 +1,72 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreSingleApp.Migrations +{ + [DbContext(typeof(BloggingContext))] + partial class BloggingContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EF Core Single App/Program.cs b/testData/solutions/EFCoreSolution/EF Core Single App/Program.cs new file mode 100644 index 00000000..27d47744 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EF Core Single App/Program.cs @@ -0,0 +1,41 @@ +using System; +using System.Linq; +using EFCoreConsoleApp; + +namespace EFCoreSingleApp +{ + class Program + { + static void Main(string[] args) + { + using (var db = new BloggingContext()) + { + // Note: This sample requires the database to be created before running. + Console.WriteLine($"Database path: {db.DbPath}."); + + // Create + Console.WriteLine("Inserting a new blog"); + db.Add(new Blog { Url = "http://blogs.msdn.com/adonet" }); + db.SaveChanges(); + + // Read + Console.WriteLine("Querying for a blog"); + var blog = db.Blogs + .OrderBy(b => b.BlogId) + .First(); + + // Update + Console.WriteLine("Updating the blog and adding a post"); + blog.Url = "https://devblogs.microsoft.com/dotnet"; + blog.Posts.Add( + new Post { Title = "Hello World", Content = "I wrote an app using EF Core!" }); + db.SaveChanges(); + + // Delete + Console.WriteLine("Delete the blog"); + db.Remove(blog); + db.SaveChanges(); + } + } + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/BloggingContext.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/BloggingContext.cs new file mode 100644 index 00000000..f27193e1 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/BloggingContext.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; + +namespace EFCoreConsoleApp +{ + public class BloggingContext : DbContext + { + public DbSet Blogs { get; set; } + public DbSet Posts { get; set; } + + public string DbPath { get; private set; } + + public BloggingContext() + { + var folder = Environment.SpecialFolder.LocalApplicationData; + var path = Environment.GetFolderPath(folder); + DbPath = $"{path}{System.IO.Path.DirectorySeparatorChar}blogging.db"; + } + + // The following configures EF to create a Sqlite database file in the + // special "local" folder for your platform. + protected override void OnConfiguring(DbContextOptionsBuilder options) + => options.UseSqlite($"Data Source={DbPath}"); + } + + public class BloggingContext2 : IdentityDbContext + { + public DbSet Blogs { get; set; } + public DbSet Posts { get; set; } + + public string DbPath { get; private set; } + + public BloggingContext2() + { + var folder = Environment.SpecialFolder.LocalApplicationData; + var path = Environment.GetFolderPath(folder); + DbPath = $"{path}{System.IO.Path.DirectorySeparatorChar}blogging.db"; + } + + // The following configures EF to create a Sqlite database file in the + // special "local" folder for your platform. + protected override void OnConfiguring(DbContextOptionsBuilder options) + => options.UseSqlite($"Data Source={DbPath}"); + } + + public class Blog + { + public int BlogId { get; set; } + public string Url { get; set; } + + public List Posts { get; } = new List(); + } + + public class Post + { + public int PostId { get; set; } + public string Title { get; set; } + public string Content { get; set; } + + public int BlogId { get; set; } + public Blog Blog { get; set; } + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/EFCoreConsoleApp.DAL.csproj b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/EFCoreConsoleApp.DAL.csproj new file mode 100644 index 00000000..35af0812 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/EFCoreConsoleApp.DAL.csproj @@ -0,0 +1,14 @@ + + + + net6.0 + EFCoreConsoleApp.Migrations + + + + + + + + + diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211202184808_SomeMigration.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211202184808_SomeMigration.Designer.cs new file mode 100644 index 00000000..63dbde9f --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211202184808_SomeMigration.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20211202184808_SomeMigration")] + partial class SomeMigration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211202184808_SomeMigration.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211202184808_SomeMigration.cs new file mode 100644 index 00000000..396c68b0 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211202184808_SomeMigration.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class SomeMigration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211208145548_Lalala.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211208145548_Lalala.Designer.cs new file mode 100644 index 00000000..8bd6ec68 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211208145548_Lalala.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20211208145548_Lalala")] + partial class Lalala + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211208145548_Lalala.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211208145548_Lalala.cs new file mode 100644 index 00000000..67a7e425 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20211208145548_Lalala.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class Lalala : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git "a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220419161331_\321\204\320\262\321\204\321\213\320\262\321\204\321\213\321\204\321\213\320\262.Designer.cs" "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220419161331_\321\204\320\262\321\204\321\213\320\262\321\204\321\213\321\204\321\213\320\262.Designer.cs" new file mode 100644 index 00000000..1b63fa79 --- /dev/null +++ "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220419161331_\321\204\320\262\321\204\321\213\320\262\321\204\321\213\321\204\321\213\320\262.Designer.cs" @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20220419161331_фвфывфыфыв")] + partial class фвфывфыфыв + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git "a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220419161331_\321\204\320\262\321\204\321\213\320\262\321\204\321\213\321\204\321\213\320\262.cs" "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220419161331_\321\204\320\262\321\204\321\213\320\262\321\204\321\213\321\204\321\213\320\262.cs" new file mode 100644 index 00000000..53c1e073 --- /dev/null +++ "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220419161331_\321\204\320\262\321\204\321\213\320\262\321\204\321\213\321\204\321\213\320\262.cs" @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class фвфывфыфыв : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622151126_asdasdasdasd.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622151126_asdasdasdasd.Designer.cs new file mode 100644 index 00000000..bccee7f2 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622151126_asdasdasdasd.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20220622151126_asdasdasdasd")] + partial class asdasdasdasd + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622151126_asdasdasdasd.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622151126_asdasdasdasd.cs new file mode 100644 index 00000000..8ad8e180 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622151126_asdasdasdasd.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class asdasdasdasd : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622152953_SomeMig.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622152953_SomeMig.Designer.cs new file mode 100644 index 00000000..c4400adc --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622152953_SomeMig.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20220622152953_SomeMig")] + partial class SomeMig + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622152953_SomeMig.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622152953_SomeMig.cs new file mode 100644 index 00000000..d78f6605 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220622152953_SomeMig.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class SomeMig : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220802193127_OneTwoThree.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220802193127_OneTwoThree.Designer.cs new file mode 100644 index 00000000..9438ca75 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220802193127_OneTwoThree.Designer.cs @@ -0,0 +1,74 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20220802193127_OneTwoThree")] + partial class OneTwoThree + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.12"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220802193127_OneTwoThree.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220802193127_OneTwoThree.cs new file mode 100644 index 00000000..f3eeaf1f --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20220802193127_OneTwoThree.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class OneTwoThree : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007225611_TheCoolestMigration.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007225611_TheCoolestMigration.Designer.cs new file mode 100644 index 00000000..6d4fe45d --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007225611_TheCoolestMigration.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221007225611_TheCoolestMigration")] + partial class TheCoolestMigration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007225611_TheCoolestMigration.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007225611_TheCoolestMigration.cs new file mode 100644 index 00000000..b8c4099b --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007225611_TheCoolestMigration.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class TheCoolestMigration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230330_dsfsdsdfsdfsdfsdf.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230330_dsfsdsdfsdfsdfsdf.Designer.cs new file mode 100644 index 00000000..e0d72961 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230330_dsfsdsdfsdfsdfsdf.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221007230330_dsfsdsdfsdfsdfsdf")] + partial class dsfsdsdfsdfsdfsdf + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230330_dsfsdsdfsdfsdfsdf.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230330_dsfsdsdfsdfsdfsdf.cs new file mode 100644 index 00000000..351224cf --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230330_dsfsdsdfsdfsdfsdf.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class dsfsdsdfsdfsdfsdf : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230746_wewerqvsdassdfg.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230746_wewerqvsdassdfg.Designer.cs new file mode 100644 index 00000000..32f76de4 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230746_wewerqvsdassdfg.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221007230746_wewerqvsdassdfg")] + partial class wewerqvsdassdfg + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230746_wewerqvsdassdfg.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230746_wewerqvsdassdfg.cs new file mode 100644 index 00000000..c8d7e30e --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221007230746_wewerqvsdassdfg.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class wewerqvsdassdfg : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144637_sgdgsdsgsdggsdsd.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144637_sgdgsdsgsdggsdsd.Designer.cs new file mode 100644 index 00000000..c86fca89 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144637_sgdgsdsgsdggsdsd.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221008144637_sgdgsdsgsdggsdsd")] + partial class sgdgsdsgsdggsdsd + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144637_sgdgsdsgsdggsdsd.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144637_sgdgsdsgsdggsdsd.cs new file mode 100644 index 00000000..22488359 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144637_sgdgsdsgsdggsdsd.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class sgdgsdsgsdggsdsd : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144658_asrwersxfsdf.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144658_asrwersxfsdf.Designer.cs new file mode 100644 index 00000000..e37d26fa --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144658_asrwersxfsdf.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221008144658_asrwersxfsdf")] + partial class asrwersxfsdf + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144658_asrwersxfsdf.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144658_asrwersxfsdf.cs new file mode 100644 index 00000000..da6f8425 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008144658_asrwersxfsdf.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class asrwersxfsdf : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008151446_assdfsdfsdf.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008151446_assdfsdfsdf.Designer.cs new file mode 100644 index 00000000..06550bba --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008151446_assdfsdfsdf.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221008151446_assdfsdfsdf")] + partial class assdfsdfsdf + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008151446_assdfsdfsdf.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008151446_assdfsdfsdf.cs new file mode 100644 index 00000000..5a354cea --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221008151446_assdfsdfsdf.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class assdfsdfsdf : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191710_bsdfgdfgdfgd.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191710_bsdfgdfgdfgd.Designer.cs new file mode 100644 index 00000000..a46ac5c9 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191710_bsdfgdfgdfgd.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221208191710_bsdfgdfgdfgd")] + partial class bsdfgdfgdfgd + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191710_bsdfgdfgdfgd.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191710_bsdfgdfgdfgd.cs new file mode 100644 index 00000000..3de6eae5 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191710_bsdfgdfgdfgd.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class bsdfgdfgdfgd : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191752_asdfasdfsdfsdf.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191752_asdfasdfsdfsdf.Designer.cs new file mode 100644 index 00000000..a9bc24c7 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191752_asdfasdfsdfsdf.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221208191752_asdfasdfsdfsdf")] + partial class asdfasdfsdfsdf + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191752_asdfasdfsdfsdf.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191752_asdfasdfsdfsdf.cs new file mode 100644 index 00000000..9f46dd45 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208191752_asdfasdfsdfsdf.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class asdfasdfsdfsdf : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208225915_sasdfsdfsdfsdfsdf.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208225915_sasdfsdfsdfsdfsdf.Designer.cs new file mode 100644 index 00000000..bd1dbbfb --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208225915_sasdfsdfsdfsdfsdf.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221208225915_sasdfsdfsdfsdfsdf")] + partial class sasdfsdfsdfsdfsdf + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208225915_sasdfsdfsdfsdfsdf.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208225915_sasdfsdfsdfsdfsdf.cs new file mode 100644 index 00000000..6544b5ea --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208225915_sasdfsdfsdfsdfsdf.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class sasdfsdfsdfsdfsdf : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208230009_sdfgsdfgsdfgsdfgsdfg.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208230009_sdfgsdfgsdfgsdfgsdfg.Designer.cs new file mode 100644 index 00000000..d495297a --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208230009_sdfgsdfgsdfgsdfgsdfg.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221208230009_sdfgsdfgsdfgsdfgsdfg")] + partial class sdfgsdfgsdfgsdfgsdfg + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208230009_sdfgsdfgsdfgsdfgsdfg.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208230009_sdfgsdfgsdfgsdfgsdfg.cs new file mode 100644 index 00000000..8ae57d65 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20221208230009_sdfgsdfgsdfgsdfgsdfg.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class sdfgsdfgsdfgsdfgsdfg : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230123144745_Initial.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230123144745_Initial.Designer.cs new file mode 100644 index 00000000..f612e724 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230123144745_Initial.Designer.cs @@ -0,0 +1,319 @@ +// +using System; +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext2))] + [Migration("20230123144745_Initial")] + partial class Initial + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230123144745_Initial.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230123144745_Initial.cs new file mode 100644 index 00000000..6d50845a --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230123144745_Initial.cs @@ -0,0 +1,264 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AspNetRoles", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetUsers", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "INTEGER", nullable: false), + PasswordHash = table.Column(type: "TEXT", nullable: true), + SecurityStamp = table.Column(type: "TEXT", nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), + PhoneNumber = table.Column(type: "TEXT", nullable: true), + PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), + TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), + LockoutEnd = table.Column(type: "TEXT", nullable: true), + LockoutEnabled = table.Column(type: "INTEGER", nullable: false), + AccessFailedCount = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Blogs", + columns: table => new + { + BlogId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Url = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Blogs", x => x.BlogId); + }); + + migrationBuilder.CreateTable( + name: "AspNetRoleClaims", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoleId = table.Column(type: "TEXT", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserClaims", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + UserId = table.Column(type: "TEXT", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetUserClaims_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserLogins", + columns: table => new + { + LoginProvider = table.Column(type: "TEXT", nullable: false), + ProviderKey = table.Column(type: "TEXT", nullable: false), + ProviderDisplayName = table.Column(type: "TEXT", nullable: true), + UserId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); + table.ForeignKey( + name: "FK_AspNetUserLogins_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserRoles", + columns: table => new + { + UserId = table.Column(type: "TEXT", nullable: false), + RoleId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + columns: table => new + { + UserId = table.Column(type: "TEXT", nullable: false), + LoginProvider = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Value = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AspNetUserTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Posts", + columns: table => new + { + PostId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Title = table.Column(type: "TEXT", nullable: true), + Content = table.Column(type: "TEXT", nullable: true), + BlogId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Posts", x => x.PostId); + table.ForeignKey( + name: "FK_Posts_Blogs_BlogId", + column: x => x.BlogId, + principalTable: "Blogs", + principalColumn: "BlogId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AspNetRoleClaims_RoleId", + table: "AspNetRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "AspNetRoles", + column: "NormalizedName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserClaims_UserId", + table: "AspNetUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserLogins_UserId", + table: "AspNetUserLogins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserRoles_RoleId", + table: "AspNetUserRoles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "AspNetUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "AspNetUsers", + column: "NormalizedUserName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Posts_BlogId", + table: "Posts", + column: "BlogId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AspNetRoleClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserLogins"); + + migrationBuilder.DropTable( + name: "AspNetUserRoles"); + + migrationBuilder.DropTable( + name: "AspNetUserTokens"); + + migrationBuilder.DropTable( + name: "Posts"); + + migrationBuilder.DropTable( + name: "AspNetRoles"); + + migrationBuilder.DropTable( + name: "AspNetUsers"); + + migrationBuilder.DropTable( + name: "Blogs"); + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230330161721_UserEmailAdded.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230330161721_UserEmailAdded.Designer.cs new file mode 100644 index 00000000..73e4660b --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230330161721_UserEmailAdded.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + [Migration("20230330161721_UserEmailAdded")] + partial class UserEmailAdded + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230330161721_UserEmailAdded.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230330161721_UserEmailAdded.cs new file mode 100644 index 00000000..59798375 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/20230330161721_UserEmailAdded.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + public partial class UserEmailAdded : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/BloggingContextModelSnapshot.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/BloggingContextModelSnapshot.cs new file mode 100644 index 00000000..7c0392e2 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations/BloggingContextModelSnapshot.cs @@ -0,0 +1,73 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations +{ + [DbContext(typeof(BloggingContext))] + partial class BloggingContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208191602_blablablablabla.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208191602_blablablablabla.Designer.cs new file mode 100644 index 00000000..1a31aa4c --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208191602_blablablablabla.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221208191602_blablablablabla")] + partial class blablablablabla + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208191602_blablablablabla.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208191602_blablablablabla.cs new file mode 100644 index 00000000..69bc858b --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208191602_blablablablabla.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + public partial class blablablablabla : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208230028_sdfsdfddasadsfadsfadsfadsf.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208230028_sdfsdfddasadsfadsfadsfadsf.Designer.cs new file mode 100644 index 00000000..db83804f --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208230028_sdfsdfddasadsfadsfadsfadsf.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221208230028_sdfsdfddasadsfadsfadsfadsf")] + partial class sdfsdfddasadsfadsfadsfadsf + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208230028_sdfsdfddasadsfadsfadsfadsf.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208230028_sdfsdfddasadsfadsfadsfadsf.cs new file mode 100644 index 00000000..c034cf9a --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221208230028_sdfsdfddasadsfadsfadsfadsf.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + public partial class sdfsdfddasadsfadsfadsfadsf : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git "a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209132246_\321\204\321\213\320\262\320\260\320\274\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260.Designer.cs" "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209132246_\321\204\321\213\320\262\320\260\320\274\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260.Designer.cs" new file mode 100644 index 00000000..e1f7e11a --- /dev/null +++ "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209132246_\321\204\321\213\320\262\320\260\320\274\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260.Designer.cs" @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221209132246_фывамываываываыва")] + partial class фывамываываываыва + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git "a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209132246_\321\204\321\213\320\262\320\260\320\274\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260.cs" "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209132246_\321\204\321\213\320\262\320\260\320\274\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260.cs" new file mode 100644 index 00000000..4f79c89d --- /dev/null +++ "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209132246_\321\204\321\213\320\262\320\260\320\274\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260\321\213\320\262\320\260.cs" @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + public partial class фывамываываываыва : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209135716_CoolestMigrationEver.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209135716_CoolestMigrationEver.Designer.cs new file mode 100644 index 00000000..4e47c56b --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209135716_CoolestMigrationEver.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221209135716_CoolestMigrationEver")] + partial class CoolestMigrationEver + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209135716_CoolestMigrationEver.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209135716_CoolestMigrationEver.cs new file mode 100644 index 00000000..5b07a1e0 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209135716_CoolestMigrationEver.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + public partial class CoolestMigrationEver : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209140018_SuperDuperMigration.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209140018_SuperDuperMigration.Designer.cs new file mode 100644 index 00000000..1a1b8e3f --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209140018_SuperDuperMigration.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221209140018_SuperDuperMigration")] + partial class SuperDuperMigration + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209140018_SuperDuperMigration.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209140018_SuperDuperMigration.cs new file mode 100644 index 00000000..a83ebf5e --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209140018_SuperDuperMigration.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + public partial class SuperDuperMigration : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git "a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209143948_\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\262\320\277\320\262.Designer.cs" "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209143948_\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\262\320\277\320\262.Designer.cs" new file mode 100644 index 00000000..c8690a95 --- /dev/null +++ "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209143948_\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\262\320\277\320\262.Designer.cs" @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20221209143948_вапвапвапввпв")] + partial class вапвапвапввпв + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git "a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209143948_\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\262\320\277\320\262.cs" "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209143948_\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\262\320\277\320\262.cs" new file mode 100644 index 00000000..507466d9 --- /dev/null +++ "b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations123/20221209143948_\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\260\320\277\320\262\320\262\320\277\320\262.cs" @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations123 +{ + public partial class вапвапвапввпв : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230123145642_dfsdsfdsf.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230123145642_dfsdsfdsf.Designer.cs new file mode 100644 index 00000000..8911e8d3 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230123145642_dfsdsfdsf.Designer.cs @@ -0,0 +1,319 @@ +// +using System; +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + [DbContext(typeof(BloggingContext2))] + [Migration("20230123145642_dfsdsfdsf")] + partial class dfsdsfdsf + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230123145642_dfsdsfdsf.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230123145642_dfsdsfdsf.cs new file mode 100644 index 00000000..762f8378 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230123145642_dfsdsfdsf.cs @@ -0,0 +1,264 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + public partial class dfsdsfdsf : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AspNetRoles", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetUsers", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "INTEGER", nullable: false), + PasswordHash = table.Column(type: "TEXT", nullable: true), + SecurityStamp = table.Column(type: "TEXT", nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), + PhoneNumber = table.Column(type: "TEXT", nullable: true), + PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), + TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), + LockoutEnd = table.Column(type: "TEXT", nullable: true), + LockoutEnabled = table.Column(type: "INTEGER", nullable: false), + AccessFailedCount = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Blogs", + columns: table => new + { + BlogId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Url = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Blogs", x => x.BlogId); + }); + + migrationBuilder.CreateTable( + name: "AspNetRoleClaims", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoleId = table.Column(type: "TEXT", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserClaims", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + UserId = table.Column(type: "TEXT", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetUserClaims_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserLogins", + columns: table => new + { + LoginProvider = table.Column(type: "TEXT", nullable: false), + ProviderKey = table.Column(type: "TEXT", nullable: false), + ProviderDisplayName = table.Column(type: "TEXT", nullable: true), + UserId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); + table.ForeignKey( + name: "FK_AspNetUserLogins_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserRoles", + columns: table => new + { + UserId = table.Column(type: "TEXT", nullable: false), + RoleId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + columns: table => new + { + UserId = table.Column(type: "TEXT", nullable: false), + LoginProvider = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Value = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AspNetUserTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Posts", + columns: table => new + { + PostId = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Title = table.Column(type: "TEXT", nullable: true), + Content = table.Column(type: "TEXT", nullable: true), + BlogId = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Posts", x => x.PostId); + table.ForeignKey( + name: "FK_Posts_Blogs_BlogId", + column: x => x.BlogId, + principalTable: "Blogs", + principalColumn: "BlogId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AspNetRoleClaims_RoleId", + table: "AspNetRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "AspNetRoles", + column: "NormalizedName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserClaims_UserId", + table: "AspNetUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserLogins_UserId", + table: "AspNetUserLogins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserRoles_RoleId", + table: "AspNetUserRoles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "AspNetUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "AspNetUsers", + column: "NormalizedUserName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Posts_BlogId", + table: "Posts", + column: "BlogId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AspNetRoleClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserLogins"); + + migrationBuilder.DropTable( + name: "AspNetUserRoles"); + + migrationBuilder.DropTable( + name: "AspNetUserTokens"); + + migrationBuilder.DropTable( + name: "Posts"); + + migrationBuilder.DropTable( + name: "AspNetRoles"); + + migrationBuilder.DropTable( + name: "AspNetUsers"); + + migrationBuilder.DropTable( + name: "Blogs"); + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130707_Blablabla.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130707_Blablabla.Designer.cs new file mode 100644 index 00000000..7c7e486c --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130707_Blablabla.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20230420130707_Blablabla")] + partial class Blablabla + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130707_Blablabla.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130707_Blablabla.cs new file mode 100644 index 00000000..3cdd1601 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130707_Blablabla.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + public partial class Blablabla : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130906_sdfsdfsdfsdf.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130906_sdfsdfsdfsdf.Designer.cs new file mode 100644 index 00000000..3987b869 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130906_sdfsdfsdfsdf.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20230420130906_sdfsdfsdfsdf")] + partial class sdfsdfsdfsdf + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130906_sdfsdfsdfsdf.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130906_sdfsdfsdfsdf.cs new file mode 100644 index 00000000..4f613f59 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130906_sdfsdfsdfsdf.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + public partial class sdfsdfsdfsdf : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130955_asdasdsad.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130955_asdasdsad.Designer.cs new file mode 100644 index 00000000..c33891cc --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130955_asdasdsad.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20230420130955_asdasdsad")] + partial class asdasdsad + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130955_asdasdsad.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130955_asdasdsad.cs new file mode 100644 index 00000000..98c3732f --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420130955_asdasdsad.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + public partial class asdasdsad : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131026_asdasdasdasdasdasdasdasdasdasdasdasd.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131026_asdasdasdasdasdasdasdasdasdasdasdasd.Designer.cs new file mode 100644 index 00000000..539c3e89 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131026_asdasdasdasdasdasdasdasdasdasdasdasd.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20230420131026_asdasdasdasdasdasdasdasdasdasdasdasd")] + partial class asdasdasdasdasdasdasdasdasdasdasdasd + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131026_asdasdasdasdasdasdasdasdasdasdasdasd.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131026_asdasdasdasdasdasdasdasdasdasdasdasd.cs new file mode 100644 index 00000000..d9615159 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131026_asdasdasdasdasdasdasdasdasdasdasdasd.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + public partial class asdasdasdasdasdasdasdasdasdasdasdasd : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131138_sdfsdfvsdfsdfsdfsdfsdf.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131138_sdfsdfvsdfsdfsdfsdfsdf.Designer.cs new file mode 100644 index 00000000..25d32f18 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131138_sdfsdfvsdfsdfsdfsdfsdf.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20230420131138_sdfsdfvsdfsdfsdfsdfsdf")] + partial class sdfsdfvsdfsdfsdfsdfsdf + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131138_sdfsdfvsdfsdfsdfsdfsdf.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131138_sdfsdfvsdfsdfsdfsdfsdf.cs new file mode 100644 index 00000000..40afc1bd --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131138_sdfsdfvsdfsdfsdfsdfsdf.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + public partial class sdfsdfvsdfsdfsdfsdfsdf : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131447_asdasdsdaasdasdasdsdaasdasdasd.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131447_asdasdsdaasdasdasdsdaasdasdasd.Designer.cs new file mode 100644 index 00000000..ef3ff50f --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131447_asdasdsdaasdasdasdsdaasdasdasd.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20230420131447_asdasdsdaasdasdasdsdaasdasdasd")] + partial class asdasdsdaasdasdasdsdaasdasdasd + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131447_asdasdsdaasdasdasdsdaasdasdasd.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131447_asdasdsdaasdasdasdsdaasdasdasd.cs new file mode 100644 index 00000000..606b5afa --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420131447_asdasdsdaasdasdasdsdaasdasdasd.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + public partial class asdasdsdaasdasdasdsdaasdasdasd : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420132053_123.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420132053_123.Designer.cs new file mode 100644 index 00000000..52ce2ba5 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420132053_123.Designer.cs @@ -0,0 +1,75 @@ +// +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + [DbContext(typeof(BloggingContext))] + [Migration("20230420132053_123")] + partial class _123 + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420132053_123.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420132053_123.cs new file mode 100644 index 00000000..01143ff3 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/20230420132053_123.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + public partial class _123 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/BloggingContext2ModelSnapshot.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/BloggingContext2ModelSnapshot.cs new file mode 100644 index 00000000..7dc7a2eb --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp.DAL/Migrations345/BloggingContext2ModelSnapshot.cs @@ -0,0 +1,317 @@ +// +using System; +using EFCoreConsoleApp; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp.Migrations.Migrations345 +{ + [DbContext(typeof(BloggingContext2))] + partial class BloggingContext2ModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Property("BlogId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("BlogId"); + + b.ToTable("Blogs"); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.Property("PostId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BlogId") + .HasColumnType("INTEGER"); + + b.Property("Content") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("PostId"); + + b.HasIndex("BlogId"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Post", b => + { + b.HasOne("EFCoreConsoleApp.Blog", "Blog") + .WithMany("Posts") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("EFCoreConsoleApp.Blog", b => + { + b.Navigation("Posts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp/EFCoreConsoleApp.csproj b/testData/solutions/EFCoreSolution/EFCoreConsoleApp/EFCoreConsoleApp.csproj new file mode 100644 index 00000000..ca6a1818 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp/EFCoreConsoleApp.csproj @@ -0,0 +1,20 @@ + + + + Exe + net6.0 + 7dc4c7b0-bbf5-44eb-a709-8226de39b12f + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp/Program.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp/Program.cs new file mode 100644 index 00000000..d4e182a4 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp/Program.cs @@ -0,0 +1,40 @@ +using System; +using System.Linq; + +namespace EFCoreConsoleApp +{ + class Program + { + static void Main(string[] args) + { + using (var db = new BloggingContext()) + { + // Note: This sample requires the database to be created before running. + Console.WriteLine($"Database path: {db.DbPath}."); + + // Create + Console.WriteLine("Inserting a new blog"); + db.Add(new Blog { Url = "http://blogs.msdn.com/adonet" }); + db.SaveChanges(); + + // Read + Console.WriteLine("Querying for a blog"); + var blog = db.Blogs + .OrderBy(b => b.BlogId) + .First(); + + // Update + Console.WriteLine("Updating the blog and adding a post"); + blog.Url = "https://devblogs.microsoft.com/dotnet"; + blog.Posts.Add( + new Post { Title = "Hello World", Content = "I wrote an app using EF Core!" }); + db.SaveChanges(); + + // Delete + Console.WriteLine("Delete the blog"); + db.Remove(blog); + db.SaveChanges(); + } + } + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp/appsettings.Development.json b/testData/solutions/EFCoreSolution/EFCoreConsoleApp/appsettings.Development.json new file mode 100644 index 00000000..86490346 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp/appsettings.Development.json @@ -0,0 +1,5 @@ +{ + "ConnectionStrings": { + "Default2": "Data Source=/hello/world.sql" + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp/appsettings.json b/testData/solutions/EFCoreSolution/EFCoreConsoleApp/appsettings.json new file mode 100644 index 00000000..c1350906 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp/appsettings.json @@ -0,0 +1,5 @@ +{ + "ConnectionStrings": { + "Default1": "Data Source=/hello/world.sql" + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/BloggingContext.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/BloggingContext.cs new file mode 100644 index 00000000..f04ca45d --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/BloggingContext.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace EFCoreConsoleApp2.DAL +{ + public class BloggingContext : DbContext + { + public DbSet Blogs { get; set; } + public DbSet Posts { get; set; } + + public string DbPath { get; private set; } + + public BloggingContext() + { + var folder = Environment.SpecialFolder.LocalApplicationData; + var path = Environment.GetFolderPath(folder); + DbPath = $"{path}{System.IO.Path.DirectorySeparatorChar}blogging.db"; + } + + // The following configures EF to create a Sqlite database file in the + // special "local" folder for your platform. + protected override void OnConfiguring(DbContextOptionsBuilder options) + => options.UseSqlite($"Data Source={DbPath}"); + } + + public class Blog + { + public int BlogId { get; set; } + public string Url { get; set; } + + public List Posts { get; } = new List(); + } + + public class Post + { + public int PostId { get; set; } + public string Title { get; set; } + public string Content { get; set; } + + public int BlogId { get; set; } + public Blog Blog { get; set; } + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Contextasdas/MyDbContextassd.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Contextasdas/MyDbContextassd.cs new file mode 100644 index 00000000..0ee43abd --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Contextasdas/MyDbContextassd.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; +using EFCoreConsoleApp2.DAL.Migrations345432234; + +namespace EFCoreConsoleApp2.DAL.Contextasdas +{ + public partial class MyDbContextassd : DbContext + { + public MyDbContextassd() + { + } + + public MyDbContextassd(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet Sample1s { get; set; } + public virtual DbSet Sample2s { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (!optionsBuilder.IsConfigured) + { +#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. + optionsBuilder.UseSqlite("Data Source=/Users/seclerp/blogging.db"); + } + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToTable("sample_1"); + + entity.Property(e => e.Lolo).HasColumnName("lolo"); + }); + + modelBuilder.Entity(entity => + { + entity.HasNoKey(); + + entity.ToTable("sample_2"); + + entity.Property(e => e.Keke).HasColumnName("keke"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/EFCoreConsoleApp2.DAL.csproj b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/EFCoreConsoleApp2.DAL.csproj new file mode 100644 index 00000000..25498e68 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/EFCoreConsoleApp2.DAL.csproj @@ -0,0 +1,12 @@ + + + + net7.0 + EFCoreConsoleApp2.DAL + + + + + + + diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803134832_Initial.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803134832_Initial.Designer.cs new file mode 100644 index 00000000..ccd1e8ef --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803134832_Initial.Designer.cs @@ -0,0 +1,43 @@ +// +using System; +using EFCoreConsoleApp2.DAL.Contextasdas; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp2.DAL.Migrations345432234 +{ + [DbContext(typeof(MyDbContextassd))] + [Migration("20230803134832_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp2.DAL.Migrations345432234.Sample1", b => + { + b.Property("Lolo") + .HasColumnType("INTEGER") + .HasColumnName("lolo"); + + b.ToTable("sample_1", (string)null); + }); + + modelBuilder.Entity("EFCoreConsoleApp2.DAL.Migrations345432234.Sample2", b => + { + b.Property("Keke") + .HasColumnType("INTEGER") + .HasColumnName("keke"); + + b.ToTable("sample_2", (string)null); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803134832_Initial.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803134832_Initial.cs new file mode 100644 index 00000000..2abd8add --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803134832_Initial.cs @@ -0,0 +1,44 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp2.DAL.Migrations345432234 +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "sample_1", + columns: table => new + { + lolo = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + }); + + migrationBuilder.CreateTable( + name: "sample_2", + columns: table => new + { + keke = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "sample_1"); + + migrationBuilder.DropTable( + name: "sample_2"); + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135155_asdsadsadasdasadasdasd.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135155_asdsadsadasdasadasdasd.Designer.cs new file mode 100644 index 00000000..6e1ec69d --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135155_asdsadsadasdasadasdasd.Designer.cs @@ -0,0 +1,43 @@ +// +using System; +using EFCoreConsoleApp2.DAL.Contextasdas; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp2.DAL.Migrations345432234 +{ + [DbContext(typeof(MyDbContextassd))] + [Migration("20230803135155_asdsadsadasdasadasdasd")] + partial class asdsadsadasdasadasdasd + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp2.DAL.Migrations345432234.Sample1", b => + { + b.Property("Lolo") + .HasColumnType("INTEGER") + .HasColumnName("lolo"); + + b.ToTable("sample_1", (string)null); + }); + + modelBuilder.Entity("EFCoreConsoleApp2.DAL.Migrations345432234.Sample2", b => + { + b.Property("Keke") + .HasColumnType("INTEGER") + .HasColumnName("keke"); + + b.ToTable("sample_2", (string)null); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135155_asdsadsadasdasadasdasd.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135155_asdsadsadasdasadasdasd.cs new file mode 100644 index 00000000..91c8998e --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135155_asdsadsadasdasadasdasd.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp2.DAL.Migrations345432234 +{ + /// + public partial class asdsadsadasdasadasdasd : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135318_asdasadasdasdasdasd.Designer.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135318_asdasadasdasdasdasd.Designer.cs new file mode 100644 index 00000000..b1983aff --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135318_asdasadasdasdasdasd.Designer.cs @@ -0,0 +1,43 @@ +// +using System; +using EFCoreConsoleApp2.DAL.Contextasdas; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp2.DAL.Migrations345432234 +{ + [DbContext(typeof(MyDbContextassd))] + [Migration("20230803135318_asdasadasdasdasdasd")] + partial class asdasadasdasdasdasd + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp2.DAL.Migrations345432234.Sample1", b => + { + b.Property("Lolo") + .HasColumnType("INTEGER") + .HasColumnName("lolo"); + + b.ToTable("sample_1", (string)null); + }); + + modelBuilder.Entity("EFCoreConsoleApp2.DAL.Migrations345432234.Sample2", b => + { + b.Property("Keke") + .HasColumnType("INTEGER") + .HasColumnName("keke"); + + b.ToTable("sample_2", (string)null); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135318_asdasadasdasdasdasd.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135318_asdasadasdasdasdasd.cs new file mode 100644 index 00000000..0e77822a --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/20230803135318_asdasadasdasdasdasd.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace EFCoreConsoleApp2.DAL.Migrations345432234 +{ + /// + public partial class asdasadasdasdasdasd : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/MyDbContextassdModelSnapshot.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/MyDbContextassdModelSnapshot.cs new file mode 100644 index 00000000..0dae94ed --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/MyDbContextassdModelSnapshot.cs @@ -0,0 +1,40 @@ +// +using System; +using EFCoreConsoleApp2.DAL.Contextasdas; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace EFCoreConsoleApp2.DAL.Migrations345432234 +{ + [DbContext(typeof(MyDbContextassd))] + partial class MyDbContextassdModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.9"); + + modelBuilder.Entity("EFCoreConsoleApp2.DAL.Migrations345432234.Sample1", b => + { + b.Property("Lolo") + .HasColumnType("INTEGER") + .HasColumnName("lolo"); + + b.ToTable("sample_1", (string)null); + }); + + modelBuilder.Entity("EFCoreConsoleApp2.DAL.Migrations345432234.Sample2", b => + { + b.Property("Keke") + .HasColumnType("INTEGER") + .HasColumnName("keke"); + + b.ToTable("sample_2", (string)null); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/Sample1.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/Sample1.cs new file mode 100644 index 00000000..4174fb2f --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/Sample1.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; + +namespace EFCoreConsoleApp2.DAL.Migrations345432234 +{ + public partial class Sample1 + { + public long? Lolo { get; set; } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/Sample2.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/Sample2.cs new file mode 100644 index 00000000..636ad248 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2.DAL/Migrations345432234/Sample2.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; + +namespace EFCoreConsoleApp2.DAL.Migrations345432234 +{ + public partial class Sample2 + { + public long? Keke { get; set; } + } +} diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/EFCore/DbContext.t4 b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/EFCore/DbContext.t4 new file mode 100644 index 00000000..049f1ade --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/EFCore/DbContext.t4 @@ -0,0 +1,339 @@ +<#@ template hostSpecific="true" #> +<#@ assembly name="System.Linq" #> +<#@ assembly name="Microsoft.EntityFrameworkCore" #> +<#@ assembly name="Microsoft.EntityFrameworkCore.Design" #> +<#@ assembly name="Microsoft.EntityFrameworkCore.Relational" #> +<#@ assembly name="Microsoft.Extensions.DependencyInjection.Abstractions" #> +<#@ parameter name="Model" type="Microsoft.EntityFrameworkCore.Metadata.IModel" #> +<#@ parameter name="Options" type="Microsoft.EntityFrameworkCore.Scaffolding.ModelCodeGenerationOptions" #> +<#@ parameter name="NamespaceHint" type="System.String" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="Microsoft.EntityFrameworkCore" #> +<#@ import namespace="Microsoft.EntityFrameworkCore.Design" #> +<#@ import namespace="Microsoft.EntityFrameworkCore.Infrastructure" #> +<#@ import namespace="Microsoft.EntityFrameworkCore.Scaffolding" #> +<#@ import namespace="Microsoft.Extensions.DependencyInjection" #> +<# + if (!ProductInfo.GetVersion().StartsWith("7.0")) + { + Warning("Your templates were created using an older version of Entity Framework. Additional features and bug fixes may be available. See https://aka.ms/efcore-docs-updating-templates for more information."); + } + + var services = (IServiceProvider)Host; + var providerCode = services.GetRequiredService(); + var annotationCodeGenerator = services.GetRequiredService(); + var code = services.GetRequiredService(); + + var usings = new List + { + "System", + "System.Collections.Generic", + "Microsoft.EntityFrameworkCore" + }; + + if (NamespaceHint != Options.ModelNamespace + && !string.IsNullOrEmpty(Options.ModelNamespace)) + { + usings.Add(Options.ModelNamespace); + } + + if (!string.IsNullOrEmpty(NamespaceHint)) + { +#> +namespace <#= NamespaceHint #>; + +<# + } +#> +public partial class <#= Options.ContextName #> : DbContext +{ +<# + if (!Options.SuppressOnConfiguring) + { +#> + public <#= Options.ContextName #>() + { + } + +<# + } +#> + public <#= Options.ContextName #>(DbContextOptions<<#= Options.ContextName #>> options) + : base(options) + { + } + +<# + foreach (var entityType in Model.GetEntityTypes().Where(e => !e.IsSimpleManyToManyJoinEntityType())) + { +#> + public virtual DbSet<<#= entityType.Name #>> <#= entityType.GetDbSetName() #> { get; set; }<#= Options.UseNullableReferenceTypes ? " = null!;" : "" #> + +<# + } + + if (!Options.SuppressOnConfiguring) + { +#> + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) +<# + if (!Options.SuppressConnectionStringWarning) + { +#> +#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. +<# + } +#> + => optionsBuilder<#= code.Fragment(providerCode.GenerateUseProvider(Options.ConnectionString), indent: 3) #>; + +<# + } + +#> + protected override void OnModelCreating(ModelBuilder modelBuilder) + { +<# + var anyConfiguration = false; + + var modelFluentApiCalls = Model.GetFluentApiCalls(annotationCodeGenerator); + if (modelFluentApiCalls != null) + { + usings.AddRange(modelFluentApiCalls.GetRequiredUsings()); +#> + modelBuilder<#= code.Fragment(modelFluentApiCalls, indent: 3) #>; +<# + anyConfiguration = true; + } + + StringBuilder mainEnvironment; + foreach (var entityType in Model.GetEntityTypes().Where(e => !e.IsSimpleManyToManyJoinEntityType())) + { + // Save all previously generated code, and start generating into a new temporary environment + mainEnvironment = GenerationEnvironment; + GenerationEnvironment = new StringBuilder(); + + if (anyConfiguration) + { + WriteLine(""); + } + + var anyEntityTypeConfiguration = false; +#> + modelBuilder.Entity<<#= entityType.Name #>>(entity => + { +<# + var key = entityType.FindPrimaryKey(); + if (key != null) + { + var keyFluentApiCalls = key.GetFluentApiCalls(annotationCodeGenerator); + if (keyFluentApiCalls != null + || (!key.IsHandledByConventions() && !Options.UseDataAnnotations)) + { + if (keyFluentApiCalls != null) + { + usings.AddRange(keyFluentApiCalls.GetRequiredUsings()); + } +#> + entity.HasKey(<#= code.Lambda(key.Properties, "e") #>)<#= code.Fragment(keyFluentApiCalls, indent: 4) #>; +<# + anyEntityTypeConfiguration = true; + } + } + + var entityTypeFluentApiCalls = entityType.GetFluentApiCalls(annotationCodeGenerator) + ?.FilterChain(c => !(Options.UseDataAnnotations && c.HasDataAnnotation)); + if (entityTypeFluentApiCalls != null) + { + usings.AddRange(entityTypeFluentApiCalls.GetRequiredUsings()); + + if (anyEntityTypeConfiguration) + { + WriteLine(""); + } +#> + entity<#= code.Fragment(entityTypeFluentApiCalls, indent: 4) #>; +<# + anyEntityTypeConfiguration = true; + } + + foreach (var index in entityType.GetIndexes() + .Where(i => !(Options.UseDataAnnotations && i.HasDataAnnotation(annotationCodeGenerator)))) + { + if (anyEntityTypeConfiguration) + { + WriteLine(""); + } + + var indexFluentApiCalls = index.GetFluentApiCalls(annotationCodeGenerator); + if (indexFluentApiCalls != null) + { + usings.AddRange(indexFluentApiCalls.GetRequiredUsings()); + } +#> + entity.HasIndex(<#= code.Lambda(index.Properties, "e") #>, <#= code.Literal(index.GetDatabaseName()) #>)<#= code.Fragment(indexFluentApiCalls, indent: 4) #>; +<# + anyEntityTypeConfiguration = true; + } + + var firstProperty = true; + foreach (var property in entityType.GetProperties()) + { + var propertyFluentApiCalls = property.GetFluentApiCalls(annotationCodeGenerator) + ?.FilterChain(c => !(Options.UseDataAnnotations && c.HasDataAnnotation) + && !(c.Method == "IsRequired" && Options.UseNullableReferenceTypes && !property.ClrType.IsValueType)); + if (propertyFluentApiCalls == null) + { + continue; + } + + usings.AddRange(propertyFluentApiCalls.GetRequiredUsings()); + + if (anyEntityTypeConfiguration && firstProperty) + { + WriteLine(""); + } +#> + entity.Property(e => e.<#= property.Name #>)<#= code.Fragment(propertyFluentApiCalls, indent: 4) #>; +<# + anyEntityTypeConfiguration = true; + firstProperty = false; + } + + foreach (var foreignKey in entityType.GetForeignKeys()) + { + var foreignKeyFluentApiCalls = foreignKey.GetFluentApiCalls(annotationCodeGenerator) + ?.FilterChain(c => !(Options.UseDataAnnotations && c.HasDataAnnotation)); + if (foreignKeyFluentApiCalls == null) + { + continue; + } + + usings.AddRange(foreignKeyFluentApiCalls.GetRequiredUsings()); + + if (anyEntityTypeConfiguration) + { + WriteLine(""); + } +#> + entity.HasOne(d => d.<#= foreignKey.DependentToPrincipal.Name #>).<#= foreignKey.IsUnique ? "WithOne" : "WithMany" #>(p => p.<#= foreignKey.PrincipalToDependent.Name #>)<#= code.Fragment(foreignKeyFluentApiCalls, indent: 4) #>; +<# + anyEntityTypeConfiguration = true; + } + + foreach (var skipNavigation in entityType.GetSkipNavigations().Where(n => n.IsLeftNavigation())) + { + if (anyEntityTypeConfiguration) + { + WriteLine(""); + } + + var left = skipNavigation.ForeignKey; + var leftFluentApiCalls = left.GetFluentApiCalls(annotationCodeGenerator, useStrings: true); + var right = skipNavigation.Inverse.ForeignKey; + var rightFluentApiCalls = right.GetFluentApiCalls(annotationCodeGenerator, useStrings: true); + var joinEntityType = skipNavigation.JoinEntityType; + + if (leftFluentApiCalls != null) + { + usings.AddRange(leftFluentApiCalls.GetRequiredUsings()); + } + + if (rightFluentApiCalls != null) + { + usings.AddRange(rightFluentApiCalls.GetRequiredUsings()); + } +#> + entity.HasMany(d => d.<#= skipNavigation.Name #>).WithMany(p => p.<#= skipNavigation.Inverse.Name #>) + .UsingEntity>( + <#= code.Literal(joinEntityType.Name) #>, + r => r.HasOne<<#= right.PrincipalEntityType.Name #>>().WithMany()<#= code.Fragment(rightFluentApiCalls, indent: 6) #>, + l => l.HasOne<<#= left.PrincipalEntityType.Name #>>().WithMany()<#= code.Fragment(leftFluentApiCalls, indent: 6) #>, + j => + { +<# + var joinKey = joinEntityType.FindPrimaryKey(); + var joinKeyFluentApiCalls = joinKey.GetFluentApiCalls(annotationCodeGenerator); + + if (joinKeyFluentApiCalls != null) + { + usings.AddRange(joinKeyFluentApiCalls.GetRequiredUsings()); + } +#> + j.HasKey(<#= code.Arguments(joinKey.Properties.Select(e => e.Name)) #>)<#= code.Fragment(joinKeyFluentApiCalls, indent: 7) #>; +<# + var joinEntityTypeFluentApiCalls = joinEntityType.GetFluentApiCalls(annotationCodeGenerator); + if (joinEntityTypeFluentApiCalls != null) + { + usings.AddRange(joinEntityTypeFluentApiCalls.GetRequiredUsings()); +#> + j<#= code.Fragment(joinEntityTypeFluentApiCalls, indent: 7) #>; +<# + } + + foreach (var index in joinEntityType.GetIndexes()) + { + var indexFluentApiCalls = index.GetFluentApiCalls(annotationCodeGenerator); + if (indexFluentApiCalls != null) + { + usings.AddRange(indexFluentApiCalls.GetRequiredUsings()); + } +#> + j.HasIndex(<#= code.Literal(index.Properties.Select(e => e.Name).ToArray()) #>, <#= code.Literal(index.GetDatabaseName()) #>)<#= code.Fragment(indexFluentApiCalls, indent: 7) #>; +<# + } +#> + }); +<# + anyEntityTypeConfiguration = true; + } +#> + }); +<# + // If any signicant code was generated, append it to the main environment + if (anyEntityTypeConfiguration) + { + mainEnvironment.Append(GenerationEnvironment); + anyConfiguration = true; + } + + // Resume generating code into the main environment + GenerationEnvironment = mainEnvironment; + } + + foreach (var sequence in Model.GetSequences()) + { + var needsType = sequence.Type != typeof(long); + var needsSchema = !string.IsNullOrEmpty(sequence.Schema) && sequence.Schema != sequence.Model.GetDefaultSchema(); + var sequenceFluentApiCalls = sequence.GetFluentApiCalls(annotationCodeGenerator); +#> + modelBuilder.HasSequence<#= needsType ? $"<{code.Reference(sequence.Type)}>" : "" #>(<#= code.Literal(sequence.Name) #><#= needsSchema ? $", {code.Literal(sequence.Schema)}" : "" #>)<#= code.Fragment(sequenceFluentApiCalls, indent: 3) #>; +<# + } + + if (anyConfiguration) + { + WriteLine(""); + } +#> + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} +<# + mainEnvironment = GenerationEnvironment; + GenerationEnvironment = new StringBuilder(); + + foreach (var ns in usings.Distinct().OrderBy(x => x, new NamespaceComparer())) + { +#> +using <#= ns #>; +<# + } + + WriteLine(""); + + GenerationEnvironment.Append(mainEnvironment); +#> diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/EFCore/EntityType.t4 b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/EFCore/EntityType.t4 new file mode 100644 index 00000000..15fde1f3 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/EFCore/EntityType.t4 @@ -0,0 +1,173 @@ +<#@ template hostSpecific="true" #> +<#@ assembly name="Microsoft.EntityFrameworkCore" #> +<#@ assembly name="Microsoft.EntityFrameworkCore.Design" #> +<#@ assembly name="Microsoft.EntityFrameworkCore.Relational" #> +<#@ assembly name="Microsoft.Extensions.DependencyInjection.Abstractions" #> +<#@ parameter name="EntityType" type="Microsoft.EntityFrameworkCore.Metadata.IEntityType" #> +<#@ parameter name="Options" type="Microsoft.EntityFrameworkCore.Scaffolding.ModelCodeGenerationOptions" #> +<#@ parameter name="NamespaceHint" type="System.String" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ import namespace="System.ComponentModel.DataAnnotations" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Text" #> +<#@ import namespace="Microsoft.EntityFrameworkCore" #> +<#@ import namespace="Microsoft.EntityFrameworkCore.Design" #> +<#@ import namespace="Microsoft.Extensions.DependencyInjection" #> +<# + if (EntityType.IsSimpleManyToManyJoinEntityType()) + { + // Don't scaffold these + return ""; + } + + var services = (IServiceProvider)Host; + var annotationCodeGenerator = services.GetRequiredService(); + var code = services.GetRequiredService(); + + var usings = new List + { + "System", + "System.Collections.Generic" + }; + + if (Options.UseDataAnnotations) + { + usings.Add("System.ComponentModel.DataAnnotations"); + usings.Add("System.ComponentModel.DataAnnotations.Schema"); + usings.Add("Microsoft.EntityFrameworkCore"); + } + + if (!string.IsNullOrEmpty(NamespaceHint)) + { +#> +namespace <#= NamespaceHint #>; + +<# + } + + if (!string.IsNullOrEmpty(EntityType.GetComment())) + { +#> +/// +/// <#= code.XmlComment(EntityType.GetComment()) #> +/// +<# + } + + if (Options.UseDataAnnotations) + { + foreach (var dataAnnotation in EntityType.GetDataAnnotations(annotationCodeGenerator)) + { +#> +<#= code.Fragment(dataAnnotation) #> +<# + } + } +#> +public partial class <#= EntityType.Name #> +{ +<# + var firstProperty = true; + foreach (var property in EntityType.GetProperties().OrderBy(p => p.GetColumnOrder() ?? -1)) + { + if (!firstProperty) + { + WriteLine(""); + } + + if (!string.IsNullOrEmpty(property.GetComment())) + { +#> + /// + /// <#= code.XmlComment(property.GetComment(), indent: 1) #> + /// +<# + } + + if (Options.UseDataAnnotations) + { + var dataAnnotations = property.GetDataAnnotations(annotationCodeGenerator) + .Where(a => !(a.Type == typeof(RequiredAttribute) && Options.UseNullableReferenceTypes && !property.ClrType.IsValueType)); + foreach (var dataAnnotation in dataAnnotations) + { +#> + <#= code.Fragment(dataAnnotation) #> +<# + } + } + + usings.AddRange(code.GetRequiredUsings(property.ClrType)); + + var needsNullable = Options.UseNullableReferenceTypes && property.IsNullable && !property.ClrType.IsValueType; + var needsInitializer = Options.UseNullableReferenceTypes && !property.IsNullable && !property.ClrType.IsValueType; +#> + public <#= code.Reference(property.ClrType) #><#= needsNullable ? "?" : "" #> <#= property.Name #> { get; set; }<#= needsInitializer ? " = null!;" : "" #> +<# + firstProperty = false; + } + + foreach (var navigation in EntityType.GetNavigations()) + { + WriteLine(""); + + if (Options.UseDataAnnotations) + { + foreach (var dataAnnotation in navigation.GetDataAnnotations(annotationCodeGenerator)) + { +#> + <#= code.Fragment(dataAnnotation) #> +<# + } + } + + var targetType = navigation.TargetEntityType.Name; + if (navigation.IsCollection) + { +#> + public virtual ICollection<<#= targetType #>> <#= navigation.Name #> { get; } = new List<<#= targetType #>>(); +<# + } + else + { + var needsNullable = Options.UseNullableReferenceTypes && !(navigation.ForeignKey.IsRequired && navigation.IsOnDependent); + var needsInitializer = Options.UseNullableReferenceTypes && navigation.ForeignKey.IsRequired && navigation.IsOnDependent; +#> + public virtual <#= targetType #><#= needsNullable ? "?" : "" #> <#= navigation.Name #> { get; set; }<#= needsInitializer ? " = null!;" : "" #> +<# + } + } + + foreach (var skipNavigation in EntityType.GetSkipNavigations()) + { + WriteLine(""); + + if (Options.UseDataAnnotations) + { + foreach (var dataAnnotation in skipNavigation.GetDataAnnotations(annotationCodeGenerator)) + { +#> + <#= code.Fragment(dataAnnotation) #> +<# + } + } +#> + public virtual ICollection<<#= skipNavigation.TargetEntityType.Name #>> <#= skipNavigation.Name #> { get; } = new List<<#= skipNavigation.TargetEntityType.Name #>>(); +<# + } +#> +} +<# + var previousOutput = GenerationEnvironment; + GenerationEnvironment = new StringBuilder(); + + foreach (var ns in usings.Distinct().OrderBy(x => x, new NamespaceComparer())) + { +#> +using <#= ns #>; +<# + } + + WriteLine(""); + + GenerationEnvironment.Append(previousOutput); +#> diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/EFCoreConsoleApp2.csproj b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/EFCoreConsoleApp2.csproj new file mode 100644 index 00000000..7e48f4c7 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/EFCoreConsoleApp2.csproj @@ -0,0 +1,17 @@ + + + + Exe + net7.0 + + + + + + + + + + + + diff --git a/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/Program.cs b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/Program.cs new file mode 100644 index 00000000..7ce21d94 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreConsoleApp2/Program.cs @@ -0,0 +1,41 @@ +using System; +using System.Linq; +using EFCoreConsoleApp2.DAL; + +namespace EFCoreConsoleApp2 +{ + class Program + { + static void Main(string[] args) + { + using (var db = new BloggingContext()) + { + // Note: This sample requires the database to be created before running. + Console.WriteLine($"Database path: {db.DbPath}."); + + // Create + Console.WriteLine("Inserting a new blog"); + db.Add(new Blog { Url = "http://blogs.msdn.com/adonet" }); + db.SaveChanges(); + + // Read + Console.WriteLine("Querying for a blog"); + var blog = db.Blogs + .OrderBy(b => b.BlogId) + .First(); + + // Update + Console.WriteLine("Updating the blog and adding a post"); + blog.Url = "https://devblogs.microsoft.com/dotnet"; + blog.Posts.Add( + new Post { Title = "Hello World", Content = "I wrote an app using EF Core!" }); + db.SaveChanges(); + + // Delete + Console.WriteLine("Delete the blog"); + db.Remove(blog); + db.SaveChanges(); + } + } + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EFCoreEmptyApp/EFCoreEmptyApp.csproj b/testData/solutions/EFCoreSolution/EFCoreEmptyApp/EFCoreEmptyApp.csproj new file mode 100644 index 00000000..de1784a1 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreEmptyApp/EFCoreEmptyApp.csproj @@ -0,0 +1,16 @@ + + + + Exe + net5.0 + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + diff --git a/testData/solutions/EFCoreSolution/EFCoreEmptyApp/Program.cs b/testData/solutions/EFCoreSolution/EFCoreEmptyApp/Program.cs new file mode 100644 index 00000000..55e88ff0 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreEmptyApp/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace EFCoreEmptyApp +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/BloggingContext.fs b/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/BloggingContext.fs new file mode 100644 index 00000000..ef4ebc0c --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/BloggingContext.fs @@ -0,0 +1,23 @@ +module BloggingModel + +open System.ComponentModel.DataAnnotations +open Microsoft.EntityFrameworkCore +open EntityFrameworkCore.FSharp.Extensions + +[] +type Blog = { + [] Id: int + Url: string +} + +type BloggingContext() = + inherit DbContext() + + [] val mutable blogs : DbSet + member this.Blogs with get() = this.blogs and set v = this.blogs <- v + + override _.OnModelCreating builder = + builder.RegisterOptionTypes() // enables option values for all entities + + override __.OnConfiguring(options: DbContextOptionsBuilder) : unit = + options.UseSqlite("Data Source=D:\\blogging.db") |> ignore \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/EFCoreFSharpApp.DAL.fsproj b/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/EFCoreFSharpApp.DAL.fsproj new file mode 100644 index 00000000..5026beb9 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/EFCoreFSharpApp.DAL.fsproj @@ -0,0 +1,18 @@ + + + + net7.0 + true + + + + + + + + + + + + + diff --git a/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/Migrations/20220625144746_Initial.fs b/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/Migrations/20220625144746_Initial.fs new file mode 100644 index 00000000..6b75657f --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/Migrations/20220625144746_Initial.fs @@ -0,0 +1,69 @@ +// +namespace EFCoreFSharpApp.DAL.Migrations + +open System +open Microsoft.EntityFrameworkCore +open Microsoft.EntityFrameworkCore.Infrastructure +open Microsoft.EntityFrameworkCore.Metadata +open Microsoft.EntityFrameworkCore.Migrations +open Microsoft.EntityFrameworkCore.Storage.ValueConversion + +[)>] +[] +type Initial() = + inherit Migration() + + override this.Up(migrationBuilder:MigrationBuilder) = + migrationBuilder.CreateTable( + name = "Blogs" + ,columns = (fun table -> + {| + Id = + table.Column( + nullable = false + ,``type`` = "INTEGER" + ).Annotation("Sqlite:Autoincrement", true) + Url = + table.Column( + nullable = false + ,``type`` = "TEXT" + ) + |}) + , constraints = + (fun table -> + table.PrimaryKey("PK_Blogs", (fun x -> (x.Id) :> obj) + ) |> ignore + ) + ) |> ignore + + + override this.Down(migrationBuilder:MigrationBuilder) = + migrationBuilder.DropTable( + name = "Blogs" + ) |> ignore + + + override this.BuildTargetModel(modelBuilder: ModelBuilder) = + modelBuilder.HasAnnotation("ProductVersion", "6.0.6") |> ignore + + modelBuilder.Entity("BloggingModel+Blog", (fun b -> + + b.Property("Id") + .IsRequired(true) + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + |> ignore + + b.Property("Url") + .IsRequired(true) + .HasColumnType("TEXT") + |> ignore + + b.HasKey("Id") + |> ignore + + + b.ToTable("Blogs") |> ignore + + )) |> ignore + diff --git a/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/Migrations/20221008190814_ssdfsfdsdfsdf.fs b/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/Migrations/20221008190814_ssdfsfdsdfsdf.fs new file mode 100644 index 00000000..ce6f1ddb --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/Migrations/20221008190814_ssdfsfdsdfsdf.fs @@ -0,0 +1,45 @@ +// +namespace EFCoreFSharpApp.DAL.Migrations + +open System +open Microsoft.EntityFrameworkCore +open Microsoft.EntityFrameworkCore.Infrastructure +open Microsoft.EntityFrameworkCore.Metadata +open Microsoft.EntityFrameworkCore.Migrations +open Microsoft.EntityFrameworkCore.Storage.ValueConversion + +[)>] +[] +type ssdfsfdsdfsdf() = + inherit Migration() + + override this.Up(migrationBuilder:MigrationBuilder) = + () + + override this.Down(migrationBuilder:MigrationBuilder) = + () + + override this.BuildTargetModel(modelBuilder: ModelBuilder) = + modelBuilder.HasAnnotation("ProductVersion", "6.0.9") |> ignore + + modelBuilder.Entity("BloggingModel+Blog", (fun b -> + + b.Property("Id") + .IsRequired(true) + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + |> ignore + + b.Property("Url") + .IsRequired(true) + .HasColumnType("TEXT") + |> ignore + + b.HasKey("Id") + |> ignore + + + b.ToTable("Blogs") |> ignore + + )) |> ignore + diff --git a/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/Migrations/BloggingContextModelSnapshot.fs b/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/Migrations/BloggingContextModelSnapshot.fs new file mode 100644 index 00000000..bd9eff67 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreFSharpApp.DAL/Migrations/BloggingContextModelSnapshot.fs @@ -0,0 +1,38 @@ +// +namespace EFCoreFSharpApp.DAL.Migrations + +open System +open Microsoft.EntityFrameworkCore +open Microsoft.EntityFrameworkCore.Infrastructure +open Microsoft.EntityFrameworkCore.Metadata +open Microsoft.EntityFrameworkCore.Migrations +open Microsoft.EntityFrameworkCore.Storage.ValueConversion + +[)>] +type BloggingContextModelSnapshot() = + inherit ModelSnapshot() + + override this.BuildModel(modelBuilder: ModelBuilder) = + modelBuilder.HasAnnotation("ProductVersion", "6.0.9") |> ignore + + modelBuilder.Entity("BloggingModel+Blog", (fun b -> + + b.Property("Id") + .IsRequired(true) + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + |> ignore + + b.Property("Url") + .IsRequired(true) + .HasColumnType("TEXT") + |> ignore + + b.HasKey("Id") + |> ignore + + + b.ToTable("Blogs") |> ignore + + )) |> ignore + diff --git a/testData/solutions/EFCoreSolution/EFCoreNotSupported/EFCoreNotSupported.csproj b/testData/solutions/EFCoreSolution/EFCoreNotSupported/EFCoreNotSupported.csproj new file mode 100644 index 00000000..acaba414 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreNotSupported/EFCoreNotSupported.csproj @@ -0,0 +1,15 @@ + + + + Exe + netcoreapp3.1 + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/testData/solutions/EFCoreSolution/EFCoreNotSupported/Program.cs b/testData/solutions/EFCoreSolution/EFCoreNotSupported/Program.cs new file mode 100644 index 00000000..85036356 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreNotSupported/Program.cs @@ -0,0 +1,12 @@ +using System; + +namespace EFCoreNotSupported +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EFCoreSolution.sln b/testData/solutions/EFCoreSolution/EFCoreSolution.sln new file mode 100644 index 00000000..ac175242 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EFCoreSolution.sln @@ -0,0 +1,64 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCoreConsoleApp", "EFCoreConsoleApp\EFCoreConsoleApp.csproj", "{301F80A4-7C8C-4B17-90A3-26E493722803}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCoreConsoleApp.DAL", "EFCoreConsoleApp.DAL\EFCoreConsoleApp.DAL.csproj", "{8F04FF82-9583-40FB-A111-F38DC6D19739}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "EfCoreFSharpApp", "EfCoreFSharpApp\EfCoreFSharpApp.fsproj", "{1FCA41D4-6C7A-4AD3-8AC1-2E892F923E87}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCoreSingleApp", "EF Core Single App\EFCoreSingleApp.csproj", "{552E885E-2964-424D-8D66-AF1B1D39BA66}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCoreEmptyApp", "EFCoreEmptyApp\EFCoreEmptyApp.csproj", "{249124EA-3527-4D16-A003-1B21F1FBD816}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCoreNotSupported", "EFCoreNotSupported\EFCoreNotSupported.csproj", "{4C9C6C24-EFE6-4F4B-934A-64125E48713D}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "EFCoreFSharpApp.DAL", "EFCoreFSharpApp.DAL\EFCoreFSharpApp.DAL.fsproj", "{18C2134B-0FFA-4F4F-B087-859F3455045E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCoreConsoleApp2", "EFCoreConsoleApp2\EFCoreConsoleApp2.csproj", "{3E130A86-1207-4530-9632-5BA1DF666FAB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCoreConsoleApp2.DAL", "EFCoreConsoleApp2.DAL\EFCoreConsoleApp2.DAL.csproj", "{FEA06BC8-186B-4F95-A116-4D9E7C08F3BC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {301F80A4-7C8C-4B17-90A3-26E493722803}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {301F80A4-7C8C-4B17-90A3-26E493722803}.Debug|Any CPU.Build.0 = Debug|Any CPU + {301F80A4-7C8C-4B17-90A3-26E493722803}.Release|Any CPU.ActiveCfg = Release|Any CPU + {301F80A4-7C8C-4B17-90A3-26E493722803}.Release|Any CPU.Build.0 = Release|Any CPU + {8F04FF82-9583-40FB-A111-F38DC6D19739}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F04FF82-9583-40FB-A111-F38DC6D19739}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F04FF82-9583-40FB-A111-F38DC6D19739}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8F04FF82-9583-40FB-A111-F38DC6D19739}.Release|Any CPU.Build.0 = Release|Any CPU + {1FCA41D4-6C7A-4AD3-8AC1-2E892F923E87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FCA41D4-6C7A-4AD3-8AC1-2E892F923E87}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FCA41D4-6C7A-4AD3-8AC1-2E892F923E87}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FCA41D4-6C7A-4AD3-8AC1-2E892F923E87}.Release|Any CPU.Build.0 = Release|Any CPU + {552E885E-2964-424D-8D66-AF1B1D39BA66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {552E885E-2964-424D-8D66-AF1B1D39BA66}.Debug|Any CPU.Build.0 = Debug|Any CPU + {552E885E-2964-424D-8D66-AF1B1D39BA66}.Release|Any CPU.ActiveCfg = Release|Any CPU + {552E885E-2964-424D-8D66-AF1B1D39BA66}.Release|Any CPU.Build.0 = Release|Any CPU + {249124EA-3527-4D16-A003-1B21F1FBD816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {249124EA-3527-4D16-A003-1B21F1FBD816}.Debug|Any CPU.Build.0 = Debug|Any CPU + {249124EA-3527-4D16-A003-1B21F1FBD816}.Release|Any CPU.ActiveCfg = Release|Any CPU + {249124EA-3527-4D16-A003-1B21F1FBD816}.Release|Any CPU.Build.0 = Release|Any CPU + {4C9C6C24-EFE6-4F4B-934A-64125E48713D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4C9C6C24-EFE6-4F4B-934A-64125E48713D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4C9C6C24-EFE6-4F4B-934A-64125E48713D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4C9C6C24-EFE6-4F4B-934A-64125E48713D}.Release|Any CPU.Build.0 = Release|Any CPU + {18C2134B-0FFA-4F4F-B087-859F3455045E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18C2134B-0FFA-4F4F-B087-859F3455045E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18C2134B-0FFA-4F4F-B087-859F3455045E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18C2134B-0FFA-4F4F-B087-859F3455045E}.Release|Any CPU.Build.0 = Release|Any CPU + {3E130A86-1207-4530-9632-5BA1DF666FAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3E130A86-1207-4530-9632-5BA1DF666FAB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3E130A86-1207-4530-9632-5BA1DF666FAB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3E130A86-1207-4530-9632-5BA1DF666FAB}.Release|Any CPU.Build.0 = Release|Any CPU + {FEA06BC8-186B-4F95-A116-4D9E7C08F3BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FEA06BC8-186B-4F95-A116-4D9E7C08F3BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FEA06BC8-186B-4F95-A116-4D9E7C08F3BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FEA06BC8-186B-4F95-A116-4D9E7C08F3BC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/testData/solutions/EFCoreSolution/EfCoreFSharpApp/EfCoreFSharpApp.fsproj b/testData/solutions/EFCoreSolution/EfCoreFSharpApp/EfCoreFSharpApp.fsproj new file mode 100644 index 00000000..ccb5c0b0 --- /dev/null +++ b/testData/solutions/EFCoreSolution/EfCoreFSharpApp/EfCoreFSharpApp.fsproj @@ -0,0 +1,25 @@ + + + + Exe + net7.0 + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + diff --git a/testData/solutions/EFCoreSolution/EfCoreFSharpApp/Program.fs b/testData/solutions/EFCoreSolution/EfCoreFSharpApp/Program.fs new file mode 100644 index 00000000..a4ec4b5f --- /dev/null +++ b/testData/solutions/EFCoreSolution/EfCoreFSharpApp/Program.fs @@ -0,0 +1,19 @@ +// Learn more about F# at http://docs.microsoft.com/dotnet/fsharp + +open BloggingModel + +// Define a function to construct a message to print +let from whom = + sprintf "from %s" whom + +[] +let main argv = + use ctx = new BloggingContext() + printfn $"Database path: {ctx}." + let blog: Blog = { Id = 123; Url = "456" } + ctx.Add blog |> ignore + ctx.SaveChanges() |> ignore + let blog = ctx.Set().Find(123) + let blog = { blog with Url = "789" } + ctx.SaveChanges() |> ignore + 0 // return an integer exit code \ No newline at end of file diff --git a/testData/solutions/EFCoreSolution/EfCoreFSharpApp/blogging.db b/testData/solutions/EFCoreSolution/EfCoreFSharpApp/blogging.db new file mode 100644 index 00000000..9affed61 Binary files /dev/null and b/testData/solutions/EFCoreSolution/EfCoreFSharpApp/blogging.db differ