-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reverse engineering: SQL Server User Defined Data Type cannot be reverse engineered #7576
Comments
Not sure if this is a dupe, but looks like the same scenario as #7315. |
@ajcvickers I think this is a separate bug. In |
Yes, this is separate bug, but from one category - incorrect work with UDDT. |
I try to test it again with aspnet-1-1-2-may2017-patch-public and it not works. |
@Axioma-ShirokovPN I'm afraid the fix for this only went into the 2.0.0 release, not the 1.1.2 release. So it is not available in the aspnet-1-1-2-may2017-patch-public feed. |
If we have some schemas with identical name of UDDT - we get error
System.ArgumentException: An item with the same key has already been added. Key: TypeId
Steps to reproduce
Create 2 schemas: Items, Users.
Create 2 UDDT: Items.TypeId (tinyint), Users.TypeId (tinyint)
After this, call:
Scaffold-DbContext "Server=localhost\SQLEXPRESS; Database=SimpleDB; User Id=Test; Password=Test; MultipleActiveResultSets=true;" Microsoft.EntityFrameworkCore.SqlServer -Force -Verbose
And you will receive:
System.ArgumentException: An item with the same key has already been added. Key: TypeId
at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(Object key)
at System.Collections.Generic.Dictionary
2.Insert(TKey key, TValue value, Boolean add) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlServerDatabaseModelFactory.GetTypeAliases() at Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlServerDatabaseModelFactory.Create(DbConnection connection, TableSelectionSet tableSelectionSet) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlServerDatabaseModelFactory.Create(String connectionString, TableSelectionSet tableSelectionSet) at Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory.Create(String connectionString, TableSelectionSet tableSelectionSet) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlServerScaffoldingModelFactory.Create(String connectionString, TableSelectionSet tableSelectionSet) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineeringGenerator.GetMetadataModel(ReverseEngineeringConfiguration configuration) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineeringGenerator.GenerateAsync(ReverseEngineeringConfiguration configuration, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContextAsync(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable
1 schemas, IEnumerable1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<ScaffoldContextImpl>d__22.MoveNext() at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable
1 source, Int32& length)at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable
1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable
1 source)at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass4_0`1.b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
An item with the same key has already been added. Key: TypeId
Why I can't have 2 UDDT with the same name in different schemas?
Further technical details
The text was updated successfully, but these errors were encountered: