NPoco | Simple microORM that maps the results of a query | Object-Relational Mapping library
kandi X-RAY | NPoco Summary
kandi X-RAY | NPoco Summary
Welcome to the NPoco! NPoco is a fork of PetaPoco based on Schotime’s branch with a handful of extra features.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of NPoco
NPoco Key Features
NPoco Examples and Code Snippets
Community Discussions
Trending Discussions on NPoco
QUESTION
So I have this read query to the database that I want to specify a NO-LOCK for the ORM (EF,Npoco,Nhibernate,LinqToSql), therefore I wrapped it in a transaction Scope and I specified the Transaction option which is an enum for ReadUncommitted (NOLOCK) [All in the effort to prevent database deadlock]
The challenge is I'm getting an exception "Specified argument was out of the range of valid values. Parameter name: transactionIsolationLevel" even though the transactionScope constructor is correct based on the required values.
I'm not going out of the IsolationLevel enum so I'm not expecting an out-of-range exception thrown at runtime.
If you've faced this kind of error or familiar with something similar to this. Please kindly assist.
Thanks and below is the code sample. [Using scope As Transactions.TransactionScope = New Transactions.TransactionScope(Transactions.TransactionScopeOption.Required, transactionOptions)] threw the exception
...ANSWER
Answered 2021-Apr-26 at 10:47Yes, so the answer was to move the transactionScope into a new class because there is a transaction conflict that should work based on the references but it is surprisingly causing the error.
At the end of the day, I resorted to storedprocedure (Faster and neat)
QUESTION
In my repository code, I am getting a disposable instance of Database. I am then using this to return an IAsyncEnumable
of my object type. The problem I'm running into is that the database object is being disposed before the enumeration happens at all -- so the connection is closed from under it. What is the pattern to solve this? (if it matters -- which it shouldn't -- this is NPoco).
I am editing the problem to say that it is specific to IAsyncEnumerable such that the awaited row-by-row fetch is more appropriate in this context, as opposed to assembling an entire List of results and returning that at once.
...ANSWER
Answered 2020-Oct-16 at 03:25No, DisposeWhenCompleted(database)
isn't a thing. But it could be, if you write an extension method for it. For example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install NPoco
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page