.Net Code Samples
Infrastructure
Testing
- NUnit - MsTest - XUnit overview and NUnit/MSTest template
- Changing AppSettings dynamically in unit tests
- Dynamically creating a LocalDb database in tests
- Build test- using Microsoft.Build.Engine in a test (3.5 and 4.0)
Core .Net
- .Net 1.0 typed collection
- GenericComparer<T>
- Copy properties, compare properties with reflection.
- Get the description of an enum.
- Read ADO DataReader into entity with reflection
- Run an assembly in a new AppDomain
- Simple type information
- (3.5) Static Reflection: find property names
- EmbeddedResource loader
ASP AppCode
- ASP Business Validation class
- ASP Strongly-Typed Session
- ASP Errors (log4net)
- ASP Errors Text File (Health Monitoring)
- BasicAuthenticationModule for Forms authenticated website
ASP Utilities
- PreInit HTTPModule and AuthorizeModule (Session with non-ASP resources)
- ASP Ajax Page Methods
- ASP Dropdown Country List
- Image Thumbnail HTTPHandler
- Static calendar user control
ASP/ADO Examples
- Basic Gridview bound to POCO with sorting and paging
- Paged Gridview bound to POCO with sorting and paging
- DetailView with SqlDataSource and identity column
- SqlDataSource with Guids
- Read ADO DataReader into entity with reflection
- NHibernate getting started
- Common database exception classifier
- Entity Framework Code First generic repository
- Retry (transient SQLExceptions)
Windows.Forms etc
Specific Tasks
Warning: hacky code! Experiments that (mostly) "Work On My Machine".
- Asp 2.0 Localize utility
- Using DbProviderFactories
- Convert Html to XHtml class (regex version)- Convert Html to XHtml class (Agility Pack version)
- Read XHtml into XmlDocument
- Read Excel into DataTables
- Create PDF with iTextSharp
- Convert List<T> - DataTable
- Web scraper
- Public Holidays calculation class(es)
- SmartPaster2010- code listing of my port of the SmartPaster Visual Studio Addin to VS 2010/ VS 2012/ VS 2013
- Demo User repository