Closed andrespk closed 4 years ago
Hello @andrespk ,
Thank you for reporting. We will look at it.
I believe only one line might be missing to support Oracle in .NET Core.
I will get back to you early next week.
Best Regards,
Jon
Thank you for your prompt reply @JonathanMagnan. Stay safe!
Hello @andrespk ,
Do you think you could provide us a runnable project with this issue? We tried on our side and everything seem to work fine so we are definitively missing something on our side to reproduce it.
You can send it in private here: info@zzzprojects.com
Hi @JonathanMagnan
I will prepare & share that ASAP, alright? Have a nice week.
Sounds good @andrespk !
I'll be looking forward to hearing from you!
Have a good day,
Jon
Hello @andrespk,
A quick reminder that we are here to assist you!
Don't hesitate to provide a runnable project!
Best regards,
Jon
Hello @andrespk,
a simple reminder that we are here to help you.
feel free to provide a runnable project.
Best regards,
Jon
Hello @JonathanMagnan
I just returned yesterday from my vacation. I’m sorry for late reply, but during vacation time I was not able to access the company repo. I’ll send you the runnable version + oracle script for table creation till this Friday, ok? Please forgive me but I didn’t code the migrations stuff for this project yet, but I think you can handle that with no worries :)
Thank you for your patience.
don't worry about it @andrespk !
I'll be here to assist you once you get the time work on a runnable project :)
Best regards,
Jon
Dear @JonathanMagnan
Please check it out the runnable project and some instructions here: https://1drv.ms/u/s!Apqbt0x98kF1hssoEs3dcKTU0HnUnw?e=fkOcW9
Hello @andrespk ,
It seems that you don't use the BulkInsert
from our library but the one provided by the DeclarativeSql.Dapper
dll as show the stack trace below:
at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName, Boolean throwOnError)
at DeclarativeSql.Dapper.OracleOperation.CreateBulkInsertCommand[T](IEnumerable1 data) at DeclarativeSql.Dapper.OracleOperation.BulkInsert[T](IEnumerable1 data)
at DeclarativeSql.Dapper.IDbConnectionExtensions.BulkInsert[T](IDbConnection connection, IEnumerable1 data, Nullable1 timeout)
at LGCNS.NetAppFramework.Infra.Data.DapperSqlRepository1.Insert(IEnumerable1 entries) in C:\Users\Jonathan\Desktop\IssueOracle\NetAppFramework\lgcns-netappframework-master\LGCNS.NetAppFramework\Infra\Data\DapperSqlRepository.cs:line 136
at LGCNS.NetAppFrameworkTests.Infra.Data.Oracle.DapperSqlRepositoryForOracleUnitTests.DapperSqlRepository_Oracle_InsertManyFakeUsers_WithSucces() in C:\Users\Jonathan\Desktop\IssueOracle\NetAppFramework\lgcns-netappframework-master\LGCNS.NetAppFrameworkTests\Infra\Data\Oracle\DapperSqlRepositoryForOracleUnitTests.cs:line 253
So obviously, nothing can be done here as our library has never been called yet.
Since both libraries have the BulkInsert
method, we called our library without using it as an extension method:
DapperPlusExtensions.BulkInsert(_connection, entries);
and it worked.
So to make it works, just make sure to use the extensions from the right library or call it as a method.
Let me know if that explains correctly the current issue.
Best Regards,
Jon
Dear @JonathanMagnan ,
First of all thank you for your help, and I am really sorry for my mistake. Anyway, I've followed your advice, so I decoupled bulk operations from original class and I've created a new one without DeclarativeSql lib references (DapperBulkOperations class). However, I did new tests and now I got a new error . It seems BulkOperation does not recognize the table name, but I am passing it to DapperPlusManager settings.
Please take a look on error as follows and the new project version here =>lgcns-netappframework-master (1).zip.
Error Message: An error occured while retrieving the InformationSchemaTable information. See the inner exception for details.
Inner Error: ORA-00942: a tabela ou view não existe (table or view does not exist)
Stack Trace:
at Z.BulkOperations.BulkOperation.()
at Z.BulkOperations.BulkOperation.Execute()
at Z.Dapper.Plus.DapperPlusAction.Execute()
at Z.Dapper.Plus.DapperPlusAction..ctor(BaseDapperPlusActionSet action, String key, DapperPlusActionKind kind, Object dataSource)
at Z.Dapper.Plus.DapperPlusActionSet1.DapperPlusActionSetBuilder(DapperPlusContext context, IDbConnection connection, IDbTransaction transaction, String mapperKey, DapperPlusActionKind actionKind, IEnumerable
1 items, Func2[] selectors) at Z.Dapper.Plus.DapperPlusActionSet
1..ctor(DapperPlusContext context, IDbConnection connection, String mapperKey, DapperPlusActionKind actionKind, IEnumerable1 items, Func
2[] selectors)
at Z.Dapper.Plus.DapperPlusExtensions.BulkInsert[T](IDbConnection connection, String mapperKey, IEnumerable1 items, Func
2[] selectors)
at Z.Dapper.Plus.DapperPlusExtensions.BulkInsert[T](IDbConnection connection, IEnumerable1 items, Func
2[] selectors)
at LGCNS.NetAppFramework.Infra.Data.DapperBulkOperations1.InsertMany(IEnumerable
1 entries) in C:\Temp\LGCNS\LGCNS.NetAppFramework\LGCNS.NetAppFramework\Infra\Data\D
apperBulkOperations.cs:line 36
at LGCNS.NetAppFrameworkTests.Infra.Data.Oracle.DapperSqlRepositoryForOracleUnitTests.DapperSqlRepository_Oracle_InsertManyFakeUsers_WithSucces() in C:\Temp\LGCNS\LGCNS.NetAppFramework\LGCNS.NetAppFrameworkTests\Infra\Data\Oracle\DapperSqlRepositoryForOracleUnitTests.cs:line 256
Hello @andrespk ,
Could you check as well the Case Sensitive
of your table?
Looking at your SQL, you don't escape them, so there are automatically converted in UPPERCASE. See: https://stackoverflow.com/a/1162757/5619143
On our side, we escape it. So, I believe in your database the table is APP_ACCESS_TOKENS
but you currently told our library it was app_access_tokens
which is not the same and could throw this error.
I guess, doing a simple return tableName.ToUpper();
could also work in the extractTableName
method.
Let me know if that was this.
Hello @JonathanMagnan ,
The weird thing is I've tested the table query with lowercase identifier in SQL Developer, and it worked, look at these 2 examples:
However, I also checked in Oracle docs for this issue, and you're right. It's necessary to change the collation for schema, table and column levels as BINARY_AI or BINARY_CI. (https://oracle-base.com/articles/12c/column-level-collation-and-case-insensitive-database-12cr2#setting-collation). I changed the logic and now it works!
Thank you very much! God bless you!
Awesome ;)
I said that's normal that it was working on SQL Developer since you didn't escape the table name:
select * from "ssomao.app_access_tokens"
(this one will fail)
I'm happy that everything is now working.
Have a great day.
Best Regards,
Jon
The bulk operations don't work with oracle connections. The error produced is:
However, the .NET Core lib for Oracle Managed Data Access has been installed and Dapper lib is working fine as well. I cannot figure out what is happening.