Open kampilan opened 3 years ago
Complete support to the fields
argument is new to RepoDB. You have to use the latest beta release (RepoDb v1.12.0-beta4 and RepoDb.MySqlConnector v1.1.0-beta2). Noted on the other recommendation like FirstOrDefault or SingleOrDefault way of querying data.
We are throwing a customized readable exception message if the bootstrapper has not been initialized. Such error message forwards you to the Getting Started tutorial, if that does not happened in your side, it is highly appreciated if you can include the Stacktrace.
Thanks for the quick reply!!! I just figured that out. Sorry about that. No indication in the docs that it was a beta feature.
Jim
I will try and recreate the exception I was getting earlier. Thanks
Glad you find it and hopefully made it work. Do not forget to play around with the FieldCache.Get<T>()
method and eliminate the unchanged fields from the results. Thanks for the kinds words BTW. :)
Here is the stack trace you requested:
BTW the beta worked perfect regarding the fields parameter. Onward.
System.NullReferenceException : Object reference not set to an instance of an object.
at RepoDb.DbFieldCache.GetInternalAsync[TDbConnection](TDbConnection connection, String tableName, IDbTransaction transaction, Boolean enableValidation)
at RepoDb.DbConnectionExtension.QueryAllAsyncInternal[TEntity](IDbConnection connection, String tableName, IEnumerable1 fields, IEnumerable
1 orderBy, String hints, String cacheKey, Nullable1 cacheItemExpiration, Nullable
1 commandTimeout, IDbTransaction transaction, ICache cache, ITrace trace, IStatementBuilder statementBuilder)
at RepoDb.Research.MicroTests.Test0001_0100_QueryDynamic() in F:\research\repodb\RepoDb.Research\MicroTests.cs:line 74
at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter1.BlockUntilCompleted() at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaitable) at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func
1 invoke)
at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()
Is not this error are you getting? Below is the resultset when calling the non-sync method.
And below is for the async method.
Please take note that it is working after I had added the call to the bootstrapper. I am using the version RepoDb.MySqlConnector v1.1.0-beta2.
Can you create a dedicated issue (User Story) for the QueryFirstOrDefault() and/or QuerySingleOrDefault()? Thanks
I'm new to RepoDB. So far looks very good. An absolute requirement for me is to be able to only update properties I actually changed on the client side. The documentation for Update refers to a fields parameter that should fit the bill. However in the actual code this parameter does not exist. If I Query a single entity change one property and call update all columns are updated from the properties whether they were modified or not. Very bad. How can I control what columns are written during an update?
Couple of observations from a noob:
I'm using MySqlConnector. I did not realize I needed to call Bootstrap.Initiaize(). The exception thrown was NullReferenceException. It probably should be something more descriptive like "Did you forget to call Bootstrap?". No second chance for a good first impression kind of thing.
Add Single and SingleOrDefault instead if Query(...).SingleOrDefault(). Cumbersome especially with async.
Thanks for all the hard work you must have put into this. Very promising!!! Jim