Scaffold-DbContext does not emit warning messages for failed entity generation
See original GitHub issueIf table contains columns with UDDT, it can’t be exported and there is no log information why.
Steps to reproduce
Install Visual Studio 2017 RC1.
Install MSSQL Server Express 2016.
Create schema Users or remove it from code.
In DB create simple UDDT: CREATE TYPE [Users].[UserName] FROM [nvarchar](20) NOT NULL
And create simple table: CREATE TABLE [Users].[Users]( [UserId] [int] IDENTITY(1,1) NOT NULL, [UserName] [Users].[UserName] NOT NULL, CONSTRAINT [PK_Users.Users:UserId] PRIMARY KEY CLUSTERED ( [UserId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [UsersData] ) ON [UsersData]
Next in VS2017RC1 command line:
Scaffold-DbContext "Server=localhost\SQLEXPRESS; Database=SimpleDB; User Id=Test; Password=Test; MultipleActiveResultSets=true;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Data\Models\Users -Schema Users -Force -Verbose
After this, we will receive:
[Table("Users", Schema = "Users")]
public partial class Users
{
public long UserId { get; set; }
}
Where is column UserName?! And this for all UDDT.
Key -Verbose in command parameters, but nothing output about this. If your table contains all columns with UDDT - you will receive empty log and simple string // Unable to generate entity type for table 'Users.Users'. Please see the warning messages.
in Context.cs
It mean - there is no any info\warnings\errors (it mean ok - isn’t it?) in command line with -Verbose key, but receive full zero in code.
Further technical details
<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0-preview4-final" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.0.0-msbuild2-final" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild2-final" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild2-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild2-final" />
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:9 (7 by maintainers)
Marking for re-triage. This (not showing log messages during Scaffold-DbContext) is a good candidate for 1.1.2.
Yes, it works in aspnet-1-1-2-may2017-patch-public Thank you.