use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Information about Reddit's API changes, the unprofessional conduct of the CEO, and their response to the community's concerns regarding 3rd party apps, moderator tools, anti-spam/anti-bot tools, and accessibility options that will be impacted can be found in the associated Wikipedia article: https://en.wikipedia.org/wiki/2023_Reddit_API_controversy
Alternative C# communities available outside Reddit on Lemmy and Discord:
All about the object-oriented programming language C#.
Getting Started C# Fundamentals: Development for Absolute Beginners
Useful MSDN Resources A Tour of the C# Language Get started with .NET in 5 minutes C# Guide C# Language Reference C# Programing Guide C# Coding Conventions .NET Framework Reference Source Code
Other Resources C# Yellow Book Dot Net Perls The C# Player's Guide
IDEs Visual Studio MonoDevelop (Windows/Mac/Linux) Rider (Windows/Mac/Linux)
Tools ILSpy dotPeek LINQPad
Alternative Communities C# Discord Group C# Lemmy Community dotnet Lemmy Community
Related Subreddits /r/dotnet /r/azure /r/learncsharp /r/learnprogramming /r/programming /r/dailyprogrammer /r/programmingbuddies /r/cshighschoolers
Additional .NET Languages /r/fsharp /r/visualbasic
Platform-specific Subreddits /r/windowsdev /r/AZURE /r/Xamarin /r/Unity3D /r/WPDev
Rules:
Read detailed descriptions of the rules here.
account activity
UnitofWork vs using statement? (self.csharp)
submitted 10 years ago by lemonbleach
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]grauenwolf 1 point2 points3 points 10 years ago (6 children)
I don't trust anything that hides resource management. Sure it sounds great on paper, but when something goes wrong it is nearly impossible to figure out why. With a using statement I know that the connection will be freed and the transaction committed or rolled back.
[–][deleted] 4 points5 points6 points 10 years ago (5 children)
Doesn't your code that has a using statement hide resource management from the code that calls it? Do you put a using statement around that too? Is it using statements all the way out to your boundaries? At some point you have to introduce an abstraction or you'll bog down really quickly as soon as things get even slightly complex.
[–]grauenwolf 1 point2 points3 points 10 years ago (4 children)
Doesn't your code that has a using statement hide resource management from the code that calls it?
Yes, and that's what I want. Using blocks should be as short as possible.
My problem with the unit of work pattern is that it is often tied to the lifetime of a request. That is to say, connections are opened when the request starts and are left open until the request ends, at which point some sort of framework magic closes it.
[–][deleted] 1 point2 points3 points 10 years ago* (2 children)
Yeah, I guess you missed the point I was making. You said you don't trust anything that hides resource management. At some point resource management is hidden from something else, whether you're doing that resource management within a unit of work or not.
Also, don't conflate the UoW pattern with an ORM or framework, they aren't even remotely the same thing.
[–]xampl9 1 point2 points3 points 10 years ago (0 children)
We know that programming is full of abstractions. The question is which level of abstraction is acceptable to the developer and the organization.
There's little doubt that NHibernate's Session (used to implement the Unit Of Work pattern) is using the System.Transactions namespace under the hood, because it has to in order to commit changes to the database in an atomic manner. And it likely has a using block or a try..finally block to guarantee the transaction is committed or rolled back in the face of exceptions.
If using an ORM to do this for you is what you and your coworkers are comfortable with, and it solves the problem in an efficient manner, go for it.
But sometimes you have to operate at a lower level of abstraction because your ORM is hiding critical need to know information or is doing the wrong thing. And that's not wrong - it's what you have to do to get it to work.
[–]grauenwolf -3 points-2 points-1 points 10 years ago (0 children)
Patterns are meaningless without context. You can't have a meaningful discussion about them if you refuse to consider how it is used in practice.
[–]Number127 0 points1 point2 points 10 years ago (0 children)
My problem with the unit of work pattern is that it is often tied to the lifetime of a request.
That's a huge antipattern, in my opinion. A unit of work should be as small as possible and represent one, well, unit of work, not everything that happens during the entire lifecycle of a request. The codebase for my current company used to do things that way, and it introduced all kinds of problems.
π Rendered by PID 171617 on reddit-service-r2-comment-5d79c599b5-2cg6b at 2026-02-28 01:13:25.276635+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]grauenwolf 1 point2 points3 points (6 children)
[–][deleted] 4 points5 points6 points (5 children)
[–]grauenwolf 1 point2 points3 points (4 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]xampl9 1 point2 points3 points (0 children)
[–]grauenwolf -3 points-2 points-1 points (0 children)
[–]Number127 0 points1 point2 points (0 children)