November 2007 Blog Posts

ClassFromConfig v1.2

I have updated ClassFromConfig to version 1.2. Now it supports connection strings, e.g if you had <connectionStrings> <add name="MyConnection" connectionString="..."/></connectionStrings> in your config, you could access it as follows: Config.ConnectionStrings.MyConnection Unfortunately there was a problem in previous releases. It was a "works on my machine" syndrome. Doh! Luckily it was discovered, thanks to Gabriel. Anyway, check out ClassFromConfig - it'll save you time. Tags: .NET, C#, Open Source, Configuration, Tools

Forms Authentication in Web Services

Recently I was working on a project where a Windows Application needed to access Web Application via Web Services. Web Application was using FormsAuthentication. And Windows Application had to "log-in" to the Web Service in order to interact with it. So the solution I found to be working as desired is as follows. My Web Service has a LogIn method: public void LogIn(string username, string password){ if (!System.Web.Security.Membership.Provider.ValidateUser(username, password)) throw new System.Security.SecurityException("Enable to login"); System.Web.Security.FormsAuthentication.SetAuthCookie(username, true);} And my Windows Application has this code to call my Web Service: private MyWebService myWebService;private void Form1_Load(object sender, EventArgs...

A Proper Build Server

Recently I have installed CruiseControl.NET – a continuous integration server. It was a good move. My previous encounter with continuous integration involved just a set batch scripts. Although I could do just fine with batch scripts, I feel much better now when I have a proper build server setup. My build server consists of the following components: CruiseControl.NET – continuous integration server. Subversion – version control system. MSBuild – my build tool of choice. NUnit – unit testing framework. CruiseControl.NET CruiseControl.NET is and continuous integration server and it’s an integral...

XML readability

XML is great! It provides a very flexible data structure and means to intelligently deal with that data. However the issue with XML i have is it's readability - it's hard to read XML document. Consider this XML-schema code (probably not the best example - lines are truncated): <?xml version="1.0"?><xs:schema xmlns:nant="http://nant.sf.net/release/0.85/nant.xsd" elementFormDefault="qualified" targetNamespace="http://nant.sf.net/release/0.85/nant.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:annotation> <xs:documentation>NAnt schema generated at 10/14/2006 16:12:51</xs:documentation> </xs:annotation> <xs:complexType name="NAnt.Core.TaskContainer"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="asminfo" type="nant:NAnt.DotNet.Tasks.AssemblyInfoTask" /> ...

ClassFromConfig v1.1.1

An update to my previous post: I have updated ClassFromConfig to automatically recognise value types. Types that it can recognise: Boolean Integer Double DateTime String array (String[]) I'm planning to add generation of connection string properties, e.g if you had <connectionStrings> <add name="MyConnection" connectionString="..."/></connectionStrings> in your config, you could access it as follows: Config.ConnectionStrings.MyConnection Tags: .NET, C#, Open Source, Configuration, Tools