Once every while a Dilbert strip is so great, you *have* to re-publish it.
So here it goes: Wally and testing the new 3-DD printer.
–jeroen
via: Dilbert comic strip for 11/05/2012 from the official Dilbert comic strips archive..
Posted by jpluimers on 2012/11/07
Once every while a Dilbert strip is so great, you *have* to re-publish it.
So here it goes: Wally and testing the new 3-DD printer.
–jeroen
via: Dilbert comic strip for 11/05/2012 from the official Dilbert comic strips archive..
Posted in Comics | Leave a Comment »
Posted by jpluimers on 2012/11/07
A while ago I needed to shorten SqlClient ConnectionStrings. One way to do that is to use the shortest Key for each property (and not use the default key names that are much longer).
I beefed up the code to show you both the shortest and all equivalent keys (a few of the Microsoft exams want you to memorize most of these).
The HTML table below (similar to the huge and therefore hard to read table on MSDN) comes directly from the C# code at the bottom of the post. The only post-editing I did was making the header row bold.
| Key | ShortesEquivalentKey | EquivalentKeys |
| Application Name | app | Application Name,app |
| ApplicationIntent | ApplicationIntent | ApplicationIntent |
| Asynchronous Processing | async | Asynchronous Processing,async |
| AttachDbFilename | AttachDbFilename | AttachDbFilename,extended properties,initial file name |
| Connect Timeout | timeout | Connect Timeout,connection timeout,timeout |
| Connection Reset | Connection Reset | Connection Reset |
| Context Connection | Context Connection | Context Connection |
| Current Language | language | Current Language,language |
| Data Source | addr | Data Source,addr,address,network address,server |
| Encrypt | Encrypt | Encrypt |
| Enlist | Enlist | Enlist |
| Failover Partner | Failover Partner | Failover Partner |
| Initial Catalog | database | Initial Catalog,database |
| Integrated Security | trusted_connection | Integrated Security,trusted_connection |
| Load Balance Timeout | connection lifetime | Load Balance Timeout,connection lifetime |
| Max Pool Size | Max Pool Size | Max Pool Size |
| Min Pool Size | Min Pool Size | Min Pool Size |
| MultipleActiveResultSets | MultipleActiveResultSets | MultipleActiveResultSets |
| MultiSubnetFailover | MultiSubnetFailover | MultiSubnetFailover |
| Network Library | net | Network Library,net,network |
| Packet Size | Packet Size | Packet Size |
| Password | pwd | Password,pwd |
| Persist Security Info | persistsecurityinfo | Persist Security Info,persistsecurityinfo |
| Pooling | Pooling | Pooling |
| Replication | Replication | Replication |
| Transaction Binding | Transaction Binding | Transaction Binding |
| TrustServerCertificate | TrustServerCertificate | TrustServerCertificate |
| Type System Version | Type System Version | Type System Version |
| User ID | uid | User ID,uid,user |
| User Instance | User Instance | User Instance |
| Workstation ID | wsid | Workstation ID,wsid |
The code below uses a few techniques referenced as StackOverflow links:
Both the main program and the SqlConnectionStringBuilderHelper class are less than 70 lines of code (each about 50 when excluding comments and empty lines).
The SqlConnectionStringBuilderHelper uses the internals of the SqlConnectionStringBuilder class (all DbConnectionStringBuilder descendants I have seen work in a similar way):
Related:
Persist Security Info: [WayBack] c# – Persist Security Info Property=true and Persist Security Info Property=false – Stack OverflowNetwork Library:
OLE DB Services:
Enjoy the code: Read the rest of this entry »
Posted in .NET, ASP.NET, C#, C# 3.0, C# 4.0, C# 5.0, CSV, Development, LINQ, Software Development | Leave a Comment »