Archives

Archives / 2005 / July
  • WilsonORMapper v4.1 Released -- Includes support for Medium-Trust

      Update: WilsonORMapper v4.1.0.0 (7/29/2005) includes the following:       

    • Supports medium-trust when mapping to public members (or reflection).       
    • Supports expressions for nullValue (like MinValue) by Jeff Lanning.       
    • Added queryOnly setting for relations for OPath without actual loading.       
    • Additional method overloads for consistency with OPath and Generics.
    • QueryHelper now handles Bool values (configurable for CustomProvider).       
    • Include original Exception for Connection errors for better debugging.       
    • OPath Support for more features: subEntity, relation filters, sortOrder.
    • Allow Enum values to be either Strings or Ints -- thanks to Peter Goetzl.
    • Bug Fixes: Recursive non-LazyLoad Issues, Recursive Cascade Deletes.       
    • Bug Fixes: Unchanged Parent PersistChildren, Update InitialState Always.       
    • Bug Fixes: Oracle String Parameter Type, Relationships with Stored Procs.       
    • Bug Fixes: Composite Key Embedded Objects and ObjectSets by Peter Goetzl.       
    • ORHelper: Include alias for relations to better support OPath Engine.       
    • Demo App: Include defaultNamespace and alias for relations in mappings.       
    • Example App: defaultNamespace, alias for relations, and OPath example.       
    • And another special thanks to Jeff Lanning for continued OPath support.
    Note:  Medium-trust requires mapping to public members or also enabling reflection.

  • In Atlanta? Get FREE Training, Starting with SharePoint

    If you're in Atlanta then check out the new Atlanta Microsoft Professionals User Group created by Dan Attis, Matt Ranlett, Keith Rome, and Brendon Schwartz.  This isn't really a user group by any definition I've ever seen -- its a community driven series of classes for things like SharePoint, BizTalk, and other MS technologies.  That's right, this is FREE training, typically several sessions and hands-on labs for each topic that is choosen -- starting with Windows SharePoint Services on August 15th.  I'm thinking I might even get out to some of these classes since its a deal that's hard to beat, although that may depend on my kids' schedules now that school is starting back.

  • Yet More FireFox Issues -- This Time With v1.0.6

    I installed FireFox v1.0.6 this afternoon since I've been running a daily build of FireFox since v1.0.5 quit working and broke my ability to even go back to v1.0.4.  All I can say is v1.0.6 did NOT work either -- it had the exact same problems as v1.0.5 did when it decided to quit working (see previous post).  Yes I tried to start it in safe-mode and it still did not work, and I tried uninstalling and reinstalling and nothing I did helped in any way.  I think of myself as pretty computer savvy and able to install and fix most any software issues, but this one is perplexing and has no error messages to help at all.  So for now I'm still stuck running a daily build of FireFox, and if I can't get things working soon I guess I should return to IE for the latest security patches.

  • Issues with FireFox v1.0.5 -- And their Lack of Openness

    It seems there are some really weird problems with FireFox v1.0.5 -- really weird.  I installed it since it was supposed to be an important bug-fix release, and it worked fine for a day or two.  Then all of the sudden it just quit working -- and I mean it quit working.  The main window would display, but no page would load, my bookmark toolbar was gone, and all the menus and functions just quit working.  I could not even type into the navigation box to try another url, nor could I type into the Google search box -- FireFox was broken.  I could not even get a second window to ever appear when I tried to start another instance, I got no errors or warnings, and there did not appear to be anything unusual going on when I looked at my task manager.  I tried reinstalling it, I uninstalled it and tried it again, I uninstalled it and tried reinstalling v1.0.4 (which I luckily still had since Mozilla doesn't seem to keep old versions around in any obvious place, if at all) -- nothing worked.  Luckily IE was still working just fine, and I was able to determine that this is apparently something that is happening quite a bit with v1.0.5 -- so much so that they told their developers to quit working on localizing it and just wait for v1.0.6 very soon.  It seems some people have found some spyware on their machines and once they got rid of it then it started working again, but that doesn't seem to be the case for many others -- nor did I find any spyware on my system so that plan didn't help me.  The only thing that seemed to be the universal fix was reported to get the current build, which I believe is reported to be a release candidate for v1.0.6 -- so I got the latest build, installed it, and everything now works again.  Now the most frustrating thing about all of this is that I could not find any official confirmation from the Mozilla folks that this is a confirmed issue -- just like its been reported many times before that they don't seem to be very open and forthcoming on security issues.  I'm not saying I have any clue how to manage issues like this any better, especially when its such a critical component in the security of our computers as web browsers are in today's world -- but it seems that at this rate FireFox may end up being their own worst enemy.

  • What's Up with 2 Custom Collection Articles in MSDN ?

    Dino Esposito's latest MSDN column is "DataSets vs. Collections" -- definitely a good read on this topic from one of the best in the business.  And if that weren't enough, Paul Ballard also has an MSDN article on "Give Your Everyday Custom Collections a Design-Time Makeover" -- another very good read with hard-to-find details on data-binding.

    Note that neither of these articles push O/R Mappers, but they are just interesting discussions on using Custom Collections for your business objects.   And just in case it isn't enough to find two such articles from some of the best in the same issue of MSDN, what's going on with these posts that hint at something in the future?

    And back a few months ago, Karl Seguin had an online MSDN article on "On the Way to Mastering ASP.NET: Introducing Custom Entity Classes".  So maybe, just maybe, we're starting to see the first wave of something better than the simple ObjectDataSource in ASP.NET v2.0 coming out of Microsoft at some point in the future -- maybe.

  • Family Update -- Jenny is Cancer Free

    My wife Jenny finished her rounds of radiation a week ago, and the tests all look positive -- so as far as we know she is cancer free!  At some point, probably around the end of this year or early next year, she'll still need to have some reconstructive surgery -- but for now she's finally a free woman.  She even got to get in the swimming pool with me and the kids yesterday evening -- I don't think she could stand seeing us go swimming without her before.

    By the way, speaking of swimming and my kids, I still can't believe that both of my 7-year old kids can already swim so well that you hardly have to even worry about them this summer.  They both swim just fine in the deep end, and they can dive down to the bottom and pick up toys -- even in my sister's 8 foot deep pool on July 4th.  Its just never ending amazement how much kids can do when given the opportunity -- they also already know PowerPoint!

    While I'm giving family updates, I should also mention how amazing Tori did in her dance recital back a month ago -- and while I may be biased, I'm also quite serious that she is very talented.  This was her 5th year of dancing -- the first year was just a little ballet class at the community center without a recital.  Then she spent 3 years doing combo ballet/tap classes at a school on the other side of town where we lived before moving recently.  This year we enrolled her in 3 separate classes -- ballet, tap, and jazz -- at the school closer to our new house -- made possible since I work from home now.  Note that this is her thing -- its not something we make her do -- she loves dancing (and singing) and it shows all the time -- its actually incredibly hard to make her stop dancing.  Anyhow, she was in all 3 classes this year and as far as I know there were no other kids anywhere near her age that had 3 different numbers in the recital (certainly older girls often have a lot of routines).  She was one of the oldest girls in her ballet class and definitely the most experienced -- it was actually comical watching her at the recital since there were a few times that she was pointing to other younger girls with instructions!  :)  Her tap class had herself, 2 other girls about the same age, and 2 young boys -- the other school never had any boys but there are several at this school, so it was cool watching her dancing with a boy for the first time.  They all did good, but of course Tori was the best -- she knew every part and you can tell just how natural everything comes when you watch her dance.  Finally the jazz class was just her and 2 other girls about the same age -- and once again she knew every part and just shined -- she just blew me away since I really didn't think she would remember every part in 3 different routines, and do them all nearly perfect.  She's truly an amazing dancer already -- watch out for Tori Wilson in another 15 or 20 years!

  • Wait a Minute -- Where is All the Code and Sql -- I Can't Find It

    I get an interesting question sometimes when someone downloads my WilsonORMapper demo -- they want to know "Where is all the code and sql?".  Now this is exactly one of the main points of using an O/R Mapper -- that being that there really is very little code, and even less sql!  Another common statement that I hear is that "I'm doing just fine right now" or "I don't have any problems when it comes to data access".  Of course you don't have any "problems" -- you just have lots of repetitious code and boring sql, and new features require a lot more of it.  Yea, yea -- you've heard it all before -- but once again I ask if you have ever REALLY looked at the small amount of code needed with O/R Mapping?  So let's look at a real example -- lets consider a MS Sql table named Categories with fields (CategoryId INT, CategoryName VARCHAR(50)).

    Here's the bare minimum amount of sql you'll have to create/generate/maintain (you'll need more procs for filtering, sorting, and paging):

    CREATE PROCEDURE RetrieveCategoryList () AS
        SELECT CategoryId, CategoryName FROM Categories;

    CREATE PROCEDURE RetrieveCategoryById (@CategoryId INT) AS
        SELECT CategoryId, CategoryName FROM Categories WHERE CategoryId = @CategoryId;

    CREATE PROCEDURE InsertCategory (@CategoryName VARCHAR(50)) AS
        INSERT INTO Categories (CategoryName) VALUES (@CategoryName);
        SELECT CategoryId = SCOPE_IDENTITY();

    CREATE PROCEDURE UpdateCategory (@CategoryId INT, @CategoryName VARCHAR(50)) AS
        UPDATE Categories SET CategoryName = @CategoryName WHERE CategoryId = @CategoryId;

    CREATE PROCEDURE DeleteCategory (@CategoryId INT) AS
        DELETE FROM Categories WHERE CategoryId = @CategoryId;
    Here's the total amount of "sql" that I'll have to create/generate/maintain for my O/R Mapper (includes filtering, sorting, and paging):
    <entity type="Demo.Category" table="Categories" keyMember="id" keyType="Auto">
        <attribute member="id" field="CategoryId" alias="Id" />
        <attribute member="name" field="CategoryName" alias="Name"/>
    </entity>
    Now I'll also have to create/generate/maintain my business object, but you will to (and much more) unless you're using DataSets here:
    namespace Demo {
        public class Category {
            private int id;
            private string name;

            public int Id {
                get { return this.id; }
            }

            public string Name {
                get { return this.name; }
                set { this.name = value; }
            }
        }
    }
    By the way, there's nothing inherently wrong with DataSets, but I would like to point out that I still have no more code in that case.  And the more features you need (filtering, sorting, paging) the more you have to continue to create/generate/maintain -- but I am done!  But wait, there's more -- we still need to look at how much code is required to actually use this O/R Mapping business class and mapping.  I'll assume you know what your own ADO.NET code or DAL code will look like, and of course you'll also have a lot of code that fills your business objects with the data your return, and you'll also have a lot of code to set the various parameters for the persistence later.  Oh yea, and don't forget that the more features you've had to implement, the more cases of setting up those stored procs there will be.

    In the meantime, here's the code that's required to initialize my O/R Mapper and to get all the Categories (and bind them to your grid):

    ObjectSpace manager = new ObjectSpace(mappingFile, connectString, Provider.MsSql);
    CategoryGrid.DataSource = manager.GetObjectSet(typeof(Category), String.Empty);
    // .NET v2.0: CategoryGrid.DataSource = manager.GetObjectSet<Category>(String.Empty);
    Now here's all the code that's required to create a new Category and to insert it into the database (initialization has already happened):
    Category category = manager.GetObject(typeof(Category)) as Category;
    // .NET v2.0: Category category = manager.GetObject<Category>();
    category.Name = "Insert";
    manager.PersistChanges(category);
    Here's the code that's required to retrieve an existing Category and to update it into the database (it should look very similar I hope):
    Category category = manager.GetObject(typeof(Category), id) as Category;
    // .NET v2.0: Category category = manager.GetObject<Category>(id);
    category.Name = "Update";
    manager.PersistChanges(category);
    And here's the code that's required to retrieve an existing category and to delete it from the database (still pretty similar I think):
    Category category = manager.GetObject(typeof(Category), id) as Category;
    // .NET v2.0: Category category = manager.GetObject<Category>(id);
    manager.MarkForDeletion(category);
    manager.PersistChanges(category);
    To make it interesting, what code would I need to write if I decided I wanted to delete all of my categories in one batch statement:
    manager.ExecuteDelete(typeof(Category). String.Empty);
    Note that this really will be a batch statement -- there will NOT be a bunch of objects loaded and then a bunch of individual deletes!  I should also point out that I have so far only talked about a single type of object -- but what if you need to look at object graphs? Once you starting adding related objects, your sql and business objects and ADO.NET or DAL usage can get an order of complexity greater.  But all I have to do is to do the same type of mapping, and also add an additional xml declaration to describe the relationships needed.  Then my related objects will be loaded (or lazy-loaded) automatically, and I can also easily persist an entire object graph at one time.  So download it and REALLY try the demos to see it for yourself, either with one of the provided demo/example apps, or with your own app.

    Note that most everything I've said will also be similar with other O/R Mappers should you prefer -- so find the one that's best for you.