sjh37 / EntityFramework-Reverse-POCO-Code-First-Generator

EntityFramework Reverse POCO Code First Generator - Beautifully generated code that is fully customisable. This generator creates code as if you reverse engineered a database and lovingly created the code by hand. It is free to academics (you need a .edu or a .ac email address), not free for commercial use. Obtain your licence from
https://www.reversepoco.co.uk/
Other
705 stars 231 forks source link

Poco Generator v2.37.1 - // Failed to read database schema in LoadTables(). #455

Open lpmplpmp opened 6 years ago

lpmplpmp commented 6 years ago

I like to use poco generator in my sample project, and only get what I want and copy to my code first real project. A few weeks ago, I tried to use v2.32.0. All the EF code work as expected.

Today, I tried to create only one table in the database, and use v2.37.1 to generate code.

What I got in cs file is as the following. Hope someone can test it too. Please let me know if you need more information, I may make a youtube video to re-generate this issue.

// ----------------------------------------------------------------------------------------- // Failed to read database schema in LoadTables(). // ----------------------------------------------------------------------------------------- The multi-part identifier "C.TABLE_NAME" could not be bound. The multi-part identifier "C.TABLE_NAME" could not be bound. The multi-part identifier "C.TABLE_NAME" could not be bound. The multi-part identifier "C.TABLE_NAME" could not be bound. System.Data.SqlClient.SqlException at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader() at Microsoft.VisualStudio.TextTemplatingA02D5A3083DD66A51A4BDC5FEBF7F33FD4D3E4E6FD0BC26BD210679254D4D71E29717544BDFADCE6F8CB962AC09890C0DC6571A176F36B740B21C2A37EAA1BE6.GeneratedTextTransformation.SqlServerSchemaReader.ReadSchema() in d:\0_mydocument\documents\visual studio 2017\Projects\ItHandyGuy.OnlineGame\ItHandyGuy.OnlineGame.Ui.ConsoleApp\EF.Reverse.POCO.Core.ttinclude:line 2733 at Microsoft.VisualStudio.TextTemplatingA02D5A3083DD66A51A4BDC5FEBF7F33FD4D3E4E6FD0BC26BD210679254D4D71E29717544BDFADCE6F8CB962AC09890C0DC6571A176F36B740B21C2A37EAA1BE6.GeneratedTextTransformation.LoadTables(DbProviderFactory factory) in d:\0_mydocument\documents\visual studio 2017\Projects\ItHandyGuy.OnlineGame\ItHandyGuy.OnlineGame.Ui.ConsoleApp\EF.Reverse.POCO.Core.ttinclude:line 722

sjh37 commented 6 years ago

Hi. This has already been fixed, but not yet released. See https://github.com/sjh37/EntityFramework-Reverse-POCO-Code-First-Generator/commit/2b7fbb27c8a044fcf77467eccc2e9260e12e587a

Make the same change to your code and check if its ok.

lpmplpmp commented 6 years ago

I will try again when you release the new version. Thank you very much.

lpmplpmp commented 6 years ago

Hi. This has already been fixed, but not yet released. See 2b7fbb2 Make the same change to your code and check if its ok. -->

I will try again when you release the new version. Thank you very much.