Closed premboyapati closed 4 years ago
I deep dive into the code and found the root cause. Dommel is assuming for some reason, my connection is to SQL server and generating the query to work with SQL server as in below:
*_select from [SchemaNAME].[TableNAME] where [Id] = @Id_**
This is method generating sql incorrectly as if I am trying to work with SQL server.......
My connection is with SqlServer and I still have the same error
The error that it generates in a project using SqlServer is this ..
Message: Não foi possível carregar o tipo IColumnNameResolver do assembly Dommel, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null.
StackTrace: Dapper.FluentMap.Dommel.FluentMapConfigurationExtensions.ForDommel(FluentMapConfiguration config)
em xFidelidade.Data.RegisterMappings.<>c.1 configure) em xFidelidade.Data.RegisterMappings.Register() em D:\Dados\Projetos\xFidelidade\src\xFidelidade.Data\RegisterMappings.cs:linha 13 em xFidelidade.Data.Repository.Repository
1..ctor(IDbConnection connection) em D:\Dados\Projetos\xFidelidade\src\xFidelidade.Data\Repository\Repository.cs:linha 18
em xFidelidade.Data.Repository.CategoriaClienteRepository..ctor(IDbConnection connection) em D:\Dados\Projetos\xFidelidade\src\xFidelidade.Data\Repository\CategoriaClienteRepository.cs:linha 13
em xFidelidade.CategoriaCliente.frmCategoriaCliente.frmCategoriaCliente_Load(Object sender, EventArgs e) em D:\Dados\Projetos\xFidelidade\src\xFidelidade\CategoriaCliente\frmCategoriaCliente.cs:linha 26
em System.Windows.Forms.Form.OnLoad(EventArgs e)
em System.Windows.Forms.Form.OnCreateControl()
em System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
em System.Windows.Forms.Control.CreateControl()
em System.Windows.Forms.Control.WmShowWindow(Message& m)
em System.Windows.Forms.Control.WndProc(Message& m)
em System.Windows.Forms.ScrollableControl.WndProc(Message& m)
em System.Windows.Forms.Form.WmShowWindow(Message& m)
em System.Windows.Forms.Form.WndProc(Message& m)
em System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
em System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
em System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
My connection is with SqlServer and I still have the same error
Did you check your model with correct attributes...your model class should be like this....
Good luck! Let me know if it works for you.
My map is like this, I use FluentMap
My map is like this, I use FluentMap
I tried like you intitially but not working...comment your mapping code and decorate your model using Table and Column attributes...That's why you are getting 'IColumnNameResolver
Meu mapa é assim, eu uso o FluentMap
Tentei como você inicialmente, mas não está funcionando ... comente seu código de mapeamento e decore seu modelo usando os atributos Tabela e Coluna ... É por isso que você está recebendo 'IColumnNameResolver
When I change the model by inserting the annotations in it, it works correctly. I'm sorry, I'm still learning to use this type of technology, but is this a mistake and will it be corrected? or will it continue like this? I like to use FluentMap, because I don't make my models "dirty"
Meu mapa é assim, eu uso o FluentMap
Tentei como você inicialmente, mas não está funcionando ... comente seu código de mapeamento e decore seu modelo usando os atributos Tabela e Coluna ... É por isso que você está recebendo 'IColumnNameResolver
When I change the model by inserting the annotations in it, it works correctly. I'm sorry, I'm still learning to use this type of technology, but is this a mistake and will it be corrected? or will it continue like this? I like to use FluentMap, because I don't make my models "dirty"
I am not an author of this code base. I do not know if this is an issue or not. With my experience, I would say there is huge GAP between what documentation says and what codebase works...
I will leave your question to answer the codebase owner/stakeholder...
I am glad to hear that my suggestion worked for you...whenever you think something worked, please give thumbs up, so that others can quickly look at it and try that same solution.
Good luck again!
Hi there,
Do you guys know these basic issues exists in the code...It's only working with the property based column attribute and not working with fluent mapping....
Does this codebase works with Oracle database? If yes, Can you point me to the documentation. If no, Do I need to implement any interface to work with oracle? How can I do that?
Thanks Prem.
Dapper.FluentMap.Json does not work with Dommel v2 yet, but there is a PR in progress: https://github.com/henkmollema/Dapper-FluentMap/pull/105
As for Oracle support, you should implement a custom ISqlBuilder
for Oracle (e.g. OracleSqlBuilder
and add it with in your startup code:
DommelMapper.AddSqlBuilder(typeof(OracleConnection), new OracleSqlBuilder());
Dapper.FluentMap.Dommel v2 is released.
Hi there,
I am trying to get a simple select query from oracle database as shown in the below screenshot. It is not working for me, throwing an error, invalid table name. I am 100% sure there is no issue with my table and schema name and column mappings. It seems Dapper/Dommel is causing some issue in generating the sql with correct table name.
May I know how can I see what SQL query my get statement generating...by enabling logging or some way...
My DBA's will not allow SQL Profilers to see the query...
Error and Code:
In case if you are looking for stack trace: at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone) at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl& rdrImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[] scnForExecution, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Int64& internalInitialLOBFS, OracleException& exceptionForArrayBindDML, OracleConnection connection, OracleLogicalTransaction& oracleLogicalTransaction, IEnumerable
1 adrianParsedStmt, Boolean isDescribeOnly, Boolean isFromEF) at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior) at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) **_at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) at Dapper.SqlMapper.QueryRowImpl[T](IDbConnection cnn, Row row, CommandDefinition& command, Type effectiveType) at Dapper.SqlMapper.QueryFirstOrDefault[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable
1 commandTimeout, Nullable`1 commandType) at Dommel.DommelMapper.Get[TEntity](IDbConnection connection, Object id, IDbTransaction transaction)_**I would really appreciate your quick response...
Thank you, Prem.