easyBlog

EasyObjects and the Enterprise Library

About the author

Author Name is someone.
E-mail me Send mail

Recent comments

Authors

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2009

Data Migration and EasyObjects

I just wanted to post this code, because sometimes I find it hard to believe that things can go so smoothly when using EasyObjects and MyGeneration. Quite simply, they rock!

I needed to migrate the Comments from the old DNN blog to the BlogEngine database. Although I could have done it using T-SQL, the code would have been unwieldy and hard to debug. So instead I chose to whip up some code using EasyObjects. It literally took 20 minutes and worked on the first try, no debugging required. I can't promise you exactly the same results with your project, of course, but it is a good example of how quickly you can develop database applications once you become comfortable with the tools you use.

By request, I can make the code available for download, although I doubt it would be of much use to anyone because it is very specific (DNN to BlogEngine). Sorry for the lack of comments in the code, but I don't plan on using the code ever again, so why take the time?

static void Main(string[] args)
{
    Blog_Comments oldComment = new Blog_Comments();
    oldComment.Where.Title.Value = "Cialis";
    oldComment.Where.Title.Operator = WhereParameter.Operand.NotContains;
    oldComment.Query.AddOrderBy(Blog_CommentsSchema.EntryID);
    
    oldComment.Query.Load();

    PostComment newComment = new PostComment();
    do
    {
        Blog_Entries oldEntry = new Blog_Entries();
        oldEntry.LoadByPrimaryKey(oldComment.EntryID);

        Posts newEntry = new Posts();
        newEntry.Where.Title.Value = oldEntry.s_Title;
        newEntry.Query.Load();

        newComment.AddNew();
        newComment.s_Author = oldComment.s_Author;
        newComment.s_Comment = oldComment.s_Comment;
        newComment.s_CommentDate = oldComment.s_AddedDate;
        newComment.s_Country = "us";
        newComment.s_Email = "noreply@noonanconsultinginc.com";
        newComment.s_Ip = "127.0.0.1";
        newComment.IsApproved = true;
        newComment.s_PostID = newEntry.s_PostID;
        newComment.s_Website = "http://www.easyobjects.net";

    } while (oldComment.MoveNext());

    Console.WriteLine(newComment.ToXml());
    newComment.Save();

    Console.WriteLine("\n\nPress <Enter> to continue...");
    Console.ReadLine();
}

 

And here is the complete list of files:

BlogCommentXfer

Remember, that's going from a blank project to a fully-functional table migration in 20 minutes, including dynamic SELECT queries, table-to-table column mapping, null-value handling, looping through results and a batch INSERT at the end (by calling Save()). If I had thought of it, I could have added a transaction wrapper around the whole thing in another minute. In fact, it has almost taken me as long to write this blog post as it did to write the code and migrate the data.

Pretty damn cool.

kick it on DotNetKicks.com


Tags:
Categories: EasyObjects
Posted by mgnoonan on Wednesday, February 20, 2008 12:33 AM
Permalink | Comments (0) | Post RSSRSS comment feed

When your WCF service stops responding

My venture into WCF is proving to be quite educational, in some ways more stressful than others. Today I had a client trying to run a demo, but their service calls were routinely locking up and they kept having to restart the web server. So much for having a day off...  :-(

So I drove to the client, fired up my WCF test harness, ran a couple of tests and everything seemed to be working just fine. So I loaded up the AJAX-driven web site, and sure enough I could make the service lock up after just a few callbacks to the server. Back to my test harness, only this time I decided to add some looping in order to simulate the multiple calls made by the web browser. This time, I was able to lock up the service in my test harness as well.

So what was the solution?

It turns out that when you create the proxy for the service call, it is very important that you also call Dispose(). I guess I got a little lazy and tried to count on the garbage collection to take care of it, but my code was actually starving the service pool of available threads, and so it stops responding until the web server is restarted or the application pool cycles.

So I'm posting this here hoping that others will learn from my mistake: make sure you call Dispose() directly on your service proxy object, or use the "using" statement which will do it for you automatically.

 

HelloServiceClient proxy = new HelloServiceClient();
string result = proxy.HelloWorld(textBox1.Text);
proxy.Close();
proxy.Dispose();
 

-- OR --

 

using (HelloServiceClient proxy = new HelloServiceClient()) 
{ 
    string result = proxy.HelloWorld(textBox1.Text); 
}

 

In my next post, I will review the WCF support now in EasyObjects. Way cool.

kick it on DotNetKicks.com

 


Tags:
Categories: WCF
Posted by mgnoonan on Tuesday, February 19, 2008 12:00 AM
Permalink | Comments (7) | Post RSSRSS comment feed

EasyObjects.NET Roadmap for 2008

As I said in my last post, it's time to stop waiting around and move on to something better. And 2008 should be a great year, so it's time to get going!

First things first, and that's to get going on the beta testing for Access, MySql and Firebird I announced last year. There have been a few volunteers, but not as many as I hoped. I attributed this to the fact that I chose the holiday season to make the announcement, but it's February now. So I am emailing the people who asked to test and sending them a full copy of the current build of EO2 (not the free build) and the associated database modules.

Once that is underway, my next crucial task is to get the EasyObjects Store up and running. I have the basic web site ready, an SSL certificate and PayPal integration set to go. So after some testing, my goal is to have the store online before the end of Q1. The initial version of EO2 available for purchase will be a beta, but any purchases will entitle the user to free upgrades to all beta releases and the full EO2 once it becomes finalized. There will be no support levels available until after release, because that is all still under consideration.

The next big enhancement for EO2 is coming from a project I am working on, and that is WCF. I have modified the templates to generate the Operation and Data Contracts, as well as some lightweight, serialize-friendly classes to help EO work with WCF. It's still in the early stages, but WCF is too cool a technology not to support in EO. Target for a beta release is Q2.

For Q3 and beyond, there will probably be a new release of the Enterprise Library to deal with, we will finalize support for the new database modules, and finally a full release of EO2 in the Store.

That's my current plan, which will promptly go to shit faster than I can blink an eye, but at least it gives us some goals to shoot for.

I welcome your feedback.


Tags:
Posted by mgnoonan on Tuesday, February 12, 2008 11:43 PM
Permalink | Comments (1) | Post RSSRSS comment feed

Switching to BlogEngine.NET

I've been waiting and waiting for the DNN Blog project to get "up to speed" with some new features and functionality, and now that I have a moment to catch my breath, I realize I am done waiting. The DNN Blog is a nice, quick plug-in to the DNN web site that allowed me to setup a blog with relative ease. And time being a precious commodity for me, quick sometimes overrides better.

Well, it's time to move away from something quick and towards something better.

I had hoped that the DNN Blog project would be adding support for things like Live Writer, Pingbacks, social bookmarks and tag clouds. But alas, the project seems as mired in a slowdown as EasyObjects...  :-p

So after a brief search, and trying to decide whether I wanted to host my own (as I do currently) or move to one of the public blog hosting providers, I decided to give BlogEngine.NET a try. In addition to self hosting, I can probably migrate my existing entries without having to re-type everything, which is a plus. And it supports most of the features I was looking for. And more importantly, the project seems to be moving forward with active development. (I know, more on the EO plan in a sec!)

But this change doesn't come without cost, either, and I don't mean just setup and migration time. One key feature of the DNN Blog is the integration with the DNN Search engine. By moving to a separate engine, so too will the search capability for blog posts. No longer will you be able to use the search box on the home page to search the blogs, you will have to go to the blog page and use the search engine there.

Then there are the URL changes, but those will pass over time. I have yet to figure out how to make the new engine so that it will co-exist peacefully under the DNN EasyObjects web site, so for the time being I have placed it under a new URL and host header in IIS. There are too many httpmodules and httphandlers to figure out quickly.  :-(

Update (2/13/08): Man, Windows Live Writer makes posting soooooo much easier. I think I'm going to like this switch. All the prior posts have now been migrated, although you may notice that the HTML markup is now a part of the post. I will correct this over the next few days. Also, comments haven't been migrated yet. More changes are on the way!

Next post: The EasyObjects Road Map for 2008.


Tags:
Categories: General
Posted by mgnoonan on Tuesday, February 12, 2008 10:51 PM
Permalink | Comments (2) | Post RSSRSS comment feed