Skip to content

Sample can not delete Objects, NetCore6.0, SqlServer #2

@lehoangphan

Description

@lehoangphan

I clone this repository, and downgrade to version netcore6.0, sql server.

<Project Sdk="Microsoft.NET.Sdk.Web">

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

	<ItemGroup>
		<None Include="wwwroot\css\.DS_Store" />
		<None Include="wwwroot\fonts\.DS_Store" />
		<None Include="wwwroot\images\.DS_Store" />
		<None Include="wwwroot\js\.DS_Store" />
		<None Include="wwwroot\js\extensions\.DS_Store" />
		<None Include="wwwroot\js\site.js" />
		<None Include="wwwroot\scss\.DS_Store" />
	</ItemGroup>

	<ItemGroup>
		<PackageReference Include="Platformus.Core.Data.EntityFramework.SqlServer" Version="3.0.4" />
		<PackageReference Include="Platformus.Images" Version="3.0.4" />
		<PackageReference Include="Platformus.WebApplication" Version="3.0.4" />
		<PackageReference Include="Platformus.Website.Backend" Version="3.0.4" />
		<PackageReference Include="Platformus.Website.Data.EntityFramework.SqlServer" Version="3.0.4" />
		<PackageReference Include="Platformus.Website.Frontend" Version="3.0.4" />
	</ItemGroup>

</Project>

When I delete sample data (Object), it throw exception:

An unhandled exception occurred while processing the request.
SqlException: The DELETE statement conflicted with the REFERENCE constraint "FK_Properties_Objects". The conflict occurred in database "MyDB", table "dbo.Properties", column 'ObjectId'.
The statement has been terminated.
Microsoft.Data.SqlClient.SqlCommand+<>c.<ExecuteDbDataReaderAsync>b__188_0(Task<SqlDataReader> result)

DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions