outmatic / dapper.unitofwork Goto Github PK
View Code? Open in Web Editor NEWA simple unit of work implementation on top of Dapper
Home Page: https://outmatic.pl
License: MIT License
A simple unit of work implementation on top of Dapper
Home Page: https://outmatic.pl
License: MIT License
Does Dapper.UnitOfWork support NETCORE?
Hello,
Do you have a simple example, how to implements?
Tks,
Hi there, how does rollback occours in your code ?
Lets say i have a table with the following fields:
-Id (Int, Key, Auto Increment)
-Name(Nvarchar, Constraint, Not Null)
-Age(Int, Null)
When i try to insert two people in row like.
using(var uow = repositoryFactory.Create(true)){
uow.Execute(new AddPersonCommand(PersonInstanceOne));
uow.Execute(new AddPersonCommand(PersonInstanceOne));
uow.Commit();
}
The first query executes without any throuble as it should, but after the second query where i try to insert an existing constraint i get the exception but the commit accours for the first query.
My repository's execute method looks like this:
public void Execute(ICommand command){
if (command.RequiresTransaction && _transaction==null)
throw new Exception($"Error")
try{
command.Execute(_connection, _transaction)
} Catch(SqlClient.SqlException ex
Debug.WriteLine($"Error: {ex.Message}")
}
}
Is it possible to create a IDbConnection with npgsql connection so that it can be used with postgres db?
Hi again, last week i've forgot to ask you if there were deadlocks or any other async/sync tests for your async methods within sync methods.
In your example, line 36, you're calling the method MainAsync within a sync method, but i also read that the console's Main method may be an exception to these cases where you can actually call an async method and get fine with it in most cases without causing the application to crash.
MainAsync(args).GetAwaiter().GetResult();
The fact that this code will run synchronously may be a problem in most of the cases, after some reading on "don't block asynchronous code". As it looks, it may be there just for demonstration purposes and no real application at all, but i couldn't avoid to look at the same call in Retry.cs, line 34.
HandleExceptionAsync(retryOptions, ex, retryCount).GetAwaiter().GetResult();
After some reading and research about this method, i've found some warnings like "they're meant to be used by the compiler" and "they may cause deadlock".
All these approaches seems more like a way to unwrap the exceptions being thrown if any. My big question is: Is it safe to use GetAwaiter().GetResult() in this context ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.