torsdag den 18. oktober 2007

Microsoft is not that bad.

Just started a massive .NET project and was looking at some old code I had to manage the data connection, when I was told about Microsofts free data block named "Enterprise Library 3.1". At first I was wondering what this was and if it could possible replace my oldschool datamanager class. Shortly after installing and making up a really fast test program, to see how much code it would require to make a connection and retrieve a DataSet, I realized that my old class was doomed. This new Supertanker code had everything i needed and much much more. Now normally im not so fond of using other programmers files, since I'm a control freak when it comes to coding. But this tool from Microsoft simply adds so much more to my applications and saves me a few weeks from work. So Yey a new gadget for my applications.

Just a few lines like this:

Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource configSource = new Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource("My Custom App.config");
DatabaseProviderFactory factory = new DatabaseProviderFactory(configSource);
Database db = factory.Create("MyDatabase");
DbCommand dbCommand = db.GetStoredProcCommand("SP_GetMembers",7);
System.Data.DataSet ds = db.ExecuteDataSet(dbCommand);

And woila i had a DataSet I could work with. And this is just a really simple test. I can't wait until I dig deeper into this tool. I read about some nice object caching as well, and validation of data.

Great little tool.
If you want it you can get it from MSDN just search for Enterprise Library May 2007.

Ingen kommentarer: