Clearing up few points of common confusion about the next version of ADO.NET… read more
[A DevLife post]
Clearing up few points of common confusion about the next version of ADO.NET… read more
[A DevLife post]
Getting SqlDependency to work takes an enormous amount of orchestration up front – especially with regards to SQL Server permissions. Steve ran into a problem which made SqlDependecy work only intermittently. He finally got to the bottom of it (was related to the dbo owner) and has blogged about it here.
I was recently involved in an ASPAdvice thread about close and dispose – an age old .NET debate. (Okay, the “age old” part is relative.)
As backup, I quoted the msdn documentation that says “close and dispose are functionally equivalent” and someone pointed out not to believe everything I read and that in .NET 1.1, it was known to be “broken”.
With a hint from Angel Saenz-Badillos from the ADO.NET team, I opened up reflector to find proof that dispose will close as well . See the guts of dispose and close below.
I don’t see anythingn wrong with still calling close *and* dispose, just to be completely explicit. I’ve seen people do it inside of using blocks with a connection, even though the end of the block will call SqlConnection.Dispose which in turn calls close. So it’s redundant. And you would think that C# programmers would celebrate the use of less code.
Are there truly known cases where this fails?
This is SqlConnection’s Dispose method:
protected override void Dispose(bool disposing){if (disposing){this._userConnectionOptions = null;this._poolGroup = null;this.Close();}this.DisposeMe(disposing);base.Dispose(disposing);}
And just for fun…SqlConnection’s Close method. Don’t get confused by that Dispose at the end.
That’s for a different object, not the actual connection.public override void Close(){IntPtr ptr1;Bid.ScopeEnter(out ptr1, “<sc.SqlConnection.Close|API> %d#”, this.ObjectID);try{SqlStatistics statistics1 = null;RuntimeHelpers.PrepareConstrainedRegions();try{statistics1 = SqlStatistics.StartTimer(this.Statistics);lock (this.InnerConnection){this.InnerConnection.CloseConnection(this, this.ConnectionFactory);}if (this.Statistics != null){ADP.TimerCurrent(out this._statistics._closeTimestamp);}}catch (OutOfMemoryException exception3){this.Abort(exception3);throw;}catch (StackOverflowException exception2){this.Abort(exception2);throw;}catch (ThreadAbortException exception1){this.Abort(exception1);throw;}finally{SqlStatistics.StopTimer(statistics1);}}finally{SqlDebugContext context1 = this._sdc;this._sdc = null;Bid.ScopeLeave(ref ptr1);if (context1 != null){context1.Dispose();}}}
Read all about it here…
[A DevLife post]
Okay – the post title is meant to be facetious, but this blog post on my DevLife blog is some early thoughts on the ADO.NET vnext whitepapers and some of the ORM community’s reaction to them as well. [read more …]
[A DevLife post]
Thanks to Fabrice for pointing out that the whitepapers for the next gen ADO.NET are online. I am really excited abut this stuff. I’m printing them out for my airplane reading. (Which is wholly unlike me!) I better get back to packing!
I am still in Vermont and missed Pablo’s ADO.NET 3.0 talk. Kent Tegels was there though… [read more …]
[A DevLife post]
Though I have the necessary permissions for using SqlDependency almost memorized (as well as documented in my presentations and my new CoDe Mag article on Query Notification), I tend to forget that when using the lower level SqlNotificationRequest, that you need permissions to send and receive on your custom services and queues.
Here’s how to do that and here is the MSDN Documentation on the same.
In this example, the ASPNET account is the one for IIS5 that I have set up in my SQL Server. Use whichever account is going to be accessing the services and queues.
GRANT RECEIVE ON MyNotifQueue TO ASPNET
GRANT SEND ON SERVICE::[MyNotifService] TO [ASPNET]
Don’t Forget: www.acehaid.org
Someone asked me about ADO.NET indexing which encouraged me to write about some of the amazing results of some performance tests I have done comparing VS2003 and VS2005’s DataTable indexing. [Read more…]
[A DevLife post]
Sahil’s teaser video for his ado.net 2.0 video training course is great. Clearly a guy who loves data access and has an enormous reverence for data. But watch the video all the way through as you will surely get a great laugh at the end!
Don’t Forget: www.acehaid.org