Saturday, February 12, 2005
« Addicted to E-mail | Main | Object Oriented Programming »

Inspired by Joe Audette's presentation at the Nashville .NET Users Group meeting last night, I've been on a mission to learn more about MySQL.  I downloaded the database server, administrator, query browser and the .NET data provider "MySQL Connector/Net" (formally ByteFX, I believe).  After installing all the goodies, I fired up MySQL Administrator and created a new database ...er... schema, and added a couple of tables.

Setting up a "hello world" test was a breeze.  MySql.Data.MySqlClient includes a MySqlHelper class, which is equivalent to the SqlHelper class found in the Microsoft Application Blocks for Data (now in the Enterprise Library).  Within just a few lines of code, I had a DataGrid populated from my new database...uh...schema.

string cnnString = "Server=localhost;Port=3306;Database=mydb;Uid=myusr;Pwd=mypwd";
MySqlConnection cnx = new MySqlConnection(cnnString);
cnx.Open();

DataSet ds = MySqlHelper.ExecuteDataset(cnx, "SELECT * FROM favorite");
dgFavorite.DataSource = ds;
dgFavorite.DataBind();

But, I didn't stop there.  Oh, no.  My new mission was to see if I could get Paul Wilson's ORMapper to talk to MySQL.  It took some Googling and a couple of good resources, but I was eventually able to do it.

// Retrieve a single object using GetObject()
Favorite fav = (Favorite) DataManager.ObjectSpace.GetObject(typeof(Favorite), 1);
lblResults.Text = "Retrieved Favorite: " + fav.Text;

// Retrieve all objects using Paul Welter's RetrieveAll() static method
dgFavorite2.DataSource = Favorite.RetrieveAll();
dgFavorite2.DataBind();

Of course, there are a lot of details I'm leaving out.  I may use this experience as a starting point for a tutorial or two for my "Learn ASP.NET" section.

By the way, I'm using Paul Welter's latest CodeSmith templates for the ORMapper, which automatically sets up static methods on the generated entity classes such as Retrieve(), RetrieveAll(), RetrievePage(), RetrieveQuery(), Save() and Delete().  Very cool.

What a rush... this is why I became a developer.

Saturday, February 12, 2005 1:09:00 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [9]  | 
Saturday, February 12, 2005 2:54:00 PM (Central Standard Time, UTC-06:00)
Yeah, ever since I started on it, my good friend Bob (media ministry leader) and I have talked about making it available to other churches. My goal is to make it fairly generic, but highly configurable at the same time, because every church has different set ups and different ways of doing things.



My initial efforts are to get it up and running for our church (which is a pretty specific implementation) and look for ways to make it less specific (i.e. Data store options - XML, MSSQL, MySql, etc. / Media format options - Mp3, Real, Wma, etc.).



Ideally, it would be integrated into a hosted sermon publishing service (similar to sermonsonline.com) which would be a much easier solution to develop for...



Anyways, I'm trying not to *over* architect this thing, but I do want to use some of my favorite open-source technologies (NUnit, CodeSmith, etc.) during its development.



Ok, I could go on and on, so I'll stop for now. :)
Saturday, February 12, 2005 2:32:00 PM (Central Standard Time, UTC-06:00)
Oh, that sounds awesome! What church wouldn't want an integrated solution for publishing sermons online? I encourage to keep working on that. I'm currently hosting a church that is posting sermons online in mp3 format, and I'm sure they would *love* to have a tool to help them do that.
Saturday, February 12, 2005 2:20:00 PM (Central Standard Time, UTC-06:00)
That sounds very interesting. Yeah, keep me posted. I'd love to help out where I can.



One thing I'm working on now for our church is automating our sermon publishing process and integrating into our web site. Right now everything is manual; recording sermon, cd ripping, encoding to mp3, uploading to web server, updating database, creating audio links, etc.



But I'm developing a C# winforms app (my first attempt at winforms) that automates the entire process. Still needs some work, but sermon publishing/management may be one type of "feature" that can be incorporated into a "church targeted" CMS that others don't have.



I'm also working on a custom events calendar solution with administrative features. But I've been stuck doing it in old school Chilisoft ASP (ugh) and an old version of MySql due to our current web host situation. But we're probably getting ready to switch to an ASP.NET/MSSQL web host which will allow me to develop a much more robust solution in my "native language". :)
Saturday, February 12, 2005 1:54:00 PM (Central Standard Time, UTC-06:00)
Not that I have the time, either...



Several others have expressed interest in developing an open-source CMS targeted for churches. If it's something you're interested in, I could use your help to get a project started.



Saturday, February 12, 2005 1:20:00 PM (Central Standard Time, UTC-06:00)
Hehe, yeah I here ya. I've designed and developed a couple large ASP.NET web apps for my company as well that I'd love to share with the community. But since we're a global records management/data security company they probably wouldn't exactly like that. :)



I have been wanting to either start or join an existing open-source ASP.NET/C# project. Just have to find the time...
Saturday, February 12, 2005 1:13:00 PM (Central Standard Time, UTC-06:00)
Not yet, but my ultimate goal is to offer an open source (or at least free) CMS solution. The portal framework I've written about in the past (and that this site runs on) shares a lot of code with an application framework I've written for my company and our customers. My company is pretty cool, but I think there's a chance they'd get a little upset if I started giving away their intellectual property ;)
Saturday, February 12, 2005 1:00:00 PM (Central Standard Time, UTC-06:00)
Cool, thanks. I'll check it out.



BTW, is the source for your "portal framework"/CMS available for download. I'd love to check it out. I just like reading code and looking at different developer's architectures. :)
Saturday, February 12, 2005 11:23:00 AM (Central Standard Time, UTC-06:00)
No, I haven't messed with MasterPages yet, although I know I should. I've been quite confortable with my own "skinning" architecture, similar to what you find in the Community Starter Kit.



It may be worth looking at Jeffrey Palermo's MasterPages implementation. He says it's based on Paul Wilson's version, but with some enhancements.



http://dotnetjunkies.com/WebLog/jpalermo/archive/2005/02/07/52173.aspx

Saturday, February 12, 2005 8:27:00 AM (Central Standard Time, UTC-06:00)
That's cool. I haven't tried his ORMapper yet, but I'm thinking about using his version of MasterPages for the redesign of our family site. Have you messed around with that yet?



I'm reading a couple articles on it now and it looks pretty cool. I know it's been out for a long time, but I just haven't really had a chance to check it out until now.



Joey
Comments are closed.