Sign in
|
Join
Paul Wilson's .NET Blog
Ramblings from the Creator of WilsonDotNet.com
This Blog
Home
Contact
Syndication
RSS
Atom
Comments RSS
Search
Go
Tags
.NET
.NET FAQ
AJAX
ASP.NET
Atlas
Avalon
C#
CLR
Community News
General Software Development
Infocard
Linq
O/RM
Orcas
Sharepoint
Vista
Visual Studio
WCF
Web Services
WinFX
WPF
WWF
Navigation
Home
Blogs
Archives
March 2008 (2)
February 2008 (1)
December 2007 (1)
May 2007 (1)
April 2007 (5)
March 2007 (1)
February 2007 (3)
January 2007 (6)
December 2006 (5)
November 2006 (6)
October 2006 (6)
September 2006 (1)
August 2006 (2)
July 2006 (1)
June 2006 (2)
May 2006 (8)
April 2006 (4)
March 2006 (4)
February 2006 (6)
January 2006 (4)
December 2005 (1)
November 2005 (1)
October 2005 (2)
September 2005 (4)
August 2005 (11)
July 2005 (8)
June 2005 (6)
May 2005 (6)
April 2005 (4)
March 2005 (8)
February 2005 (7)
January 2005 (13)
December 2004 (4)
November 2004 (3)
October 2004 (9)
September 2004 (17)
July 2004 (6)
June 2004 (3)
May 2004 (7)
April 2004 (9)
March 2004 (8)
February 2004 (10)
January 2004 (16)
December 2003 (4)
November 2003 (9)
October 2003 (18)
September 2003 (4)
August 2003 (6)
July 2003 (3)
June 2003 (17)
May 2003 (9)
April 2003 (10)
Wilson's Links
About Paul Wilson
WilsonDotNet.com
My ASP.NET Articles
The Best Web-Host
WilsonORMapper
My .NET BlogRoll
WilsonWebPortal
Resume of Paul Wilson
WilsonWebForm
WilsonXmlDbClient
Mimsware Consulting
May 2005 - Posts
Monday, May 30, 2005 5:48 PM
How/Why I Added a Wiki for WilsonDotNet
I've had several users of my
ORMapper
and
UIMapper
suggest that I add a
Wiki
to
WilsonDotNet
-- and I agreed it was a good idea. My first problem was finding the time to setup a Wiki, since I'm typically pretty busy already with my work and other projects. Of course this shouldn't be a big deal I was told since there are already some really good Wikis freely available, like
FlexWiki
. So a while back I downloaded FlexWiki and proceeded to setup a simple test Wiki on my local system -- took about an hour or so. At this point I was convinced that this would work out, but I still needed to integrate the Wiki with the rest of my existing site.
And this is where things started to go downhill. First I wanted to allow anonymous users to read my Wiki, but I only wanted my existing subscribers to be able to edit and create topics -- yes, this isn't a "pure" Wiki concept, but its what I wanted to do. I proceeded to look through the documentation and I found that this was something that others had also requested -- and failed. I did more searches and again found more people wanting this type of feature, but it just isn't supported out of the box so far. Of course you can always modify the app yourself, since its open-source, but I discovered that the codebase is quite involved.
At this point I thought I would just try some modifications to the web.config file in the authentication/authorization sections. Surely this wouldn't be too hard, but things didn't work out so easily -- I think because the Wiki needed to be its own IIS app. So now I decided to just give up and try it on my real site, again since I don't have a lot of time to waste getting this to work. This resulted in discovering that you can't just create your Wiki locally and simply upload and expect the links to work correctly. Another search showed that I wasn't alone in finding this to be an issue -- and there doesn't appear to be any solution to this.
At this point I had certainly put in more than a couple of hours, although I didn't track it to say it was 4, 8, or more hours. So I tabled this whole Wiki thing for a good while, and then recently I decided to think about this Wiki thing in another way. What is a Wiki? Its a set of topics, viewable as formatted Html, which can be edited and/or created, and a history is kept too. If you think about it that way, a Wiki does not sound very hard at all -- especially if you use the
FreeTextBox
for Html edits. So I did it -- in 30 minutes at most! And in my opinion its far better, at least for me, since it integrates with my site too.
So there you have it. I have my own
Wiki
that fits seamlessly into my already existing site and ties into my existing set of users. Its also far easier to use for someone like myself that isn't up on all the special codes needed to edit/create the formatted Html because I'm just letting my users have the full power of the
FreeTextBox
-- maybe this isn't a "real" Wiki, but its better for me. I also maintain a complete history of all edits, although I haven't exposed this yet (if ever), which I do think is a good idea. And I got all of this up and running in no time at all -- far less when compared with trying to figure out an existing free Wiki.
Posted by
PaulWilson
|
7 comment(s)
Thursday, May 26, 2005 10:43 AM
Check out my "Real" NHibernate Example App
As most of you know that follow my blog, I not only have my own
WilsonORMapper
, but I've also been tinkering with
NHibernate
some. Why? I needed to use a "free" set of code for my recent presentation on O/R Mapping at the
Atlanta Code Camp
. Anyhow, here's the long promised
link to download
my "real" NHibernate example app. What do I mean by calling it "real"? Well to put it bluntly, my experience is that its impossible to find a realistic and decently complex app for
NHibernate
(or
Hibernate
). My example app is the exact same one I updated for my
WilsonORMapper
, except I modified it slightly to support
NHibernate
. This means that it is first of all a real and fully functioning WinForm app -- complete with data-binding in grids and all your basic CRUD. It also means that this example includes several types of primary keys, relationships, and inheritance -- and did I mention it works!
Sure there is lots of documentation for
Hibernate
(and thus for
NHibernate
too), including books, but the examples are either typically small snippets, and many are outdated and just don't work with NHibernate v0.8. Some people have criticized the small amount of documentation I have for my
WilsonORMapper
, and rightly so, but I've always included a real example app that goes a long way in getting people started -- and without this I found it quite difficult to get up to speed on
NHibernate
since I was forced to dig into scattered documents, forums, and just plain old-fashioned trial-and-error in many cases! Here's an example --
NHibernate
has multiple ways to model related collections (sets, bags, lists, and maps), which certainly is an advantage if you need flexibility, but just try to figure out which one to use for a many-to-many related collection that you want to be bindable -- the answer is use the bag.
Anyhow, what's intriguing to me is how close both the basic approach and the mapping file syntax is for my
WilsonORMapper
and
NHibernate
-- they are remarkably similar and there's very little effort to switch between them. Of course there are certainly differences too --
NHibernate
is more flexible if you need that (most don't), while my
WilsonORMapper
is a little easier (far simpler codebase), supports more databases (including Access), and provides DAL capabilities as well as O/R Mapping. Both mappers have features the other lacks -- but they both have the basic set of features that most people need -- and both work as my example apps demonstrate. What are some other features my
WilsonORMapper
has? Supports stored procedures, custom collection types, real batch updates/deletes, server-side paging, lazy-loading without keeping "session" open, interface to avoid reflection, null values even in .NET v1.1, and I'm sure there are others I could list.
What about
NHibernate
you ask? I can't do it much justice to be fair since I'm not that experienced with it, but a few come to mind: more caching options, normalized inheritance, built-in one-to-one, two-way graph syncs, more cascade options, eager load option -- and again there are bound to be more. But the basics are pretty similar (although I prefer my
WilsonORMapper
of course) -- so if you're an
NHibernate
fan, then please download and enjoy my "real"
NHiberate example
app -- and feel free to add your own comments here on either mapper (or others), although please include some real details if you do.
Posted by
PaulWilson
|
37 comment(s)
Thursday, May 26, 2005 10:03 AM
WilsonORMapper v4.0 Released -- Includes .NET v2.0 Generics and Nullable Types
My
WilsonORMapper
v4.0 has finally been released out of beta with support for another database inheritance type,
as well as .NET v2.0 support for generics and nullable types -- and even more OPath support thanks to
Jeff Lanning
.
Download
the updated demo package which contains both the usual simple demo and a more complex example.
Update:
WilsonORMapper
v4.0.0.0 (5/26/2005) includes the following:
Supports "shared inheritance" in the database using type discriminator.
This is also referred to as "single table with type discriminator".
Always supported "redundant inheritance" or "one table per concrete type".
Added support for .NET v2.0 Generics and Nullable Types -- VS 2005 Beta.
Allows you to initialize you own relation collections, as long as IList.
Works for all new objects, as well as non-lazy cases for existing objects.
QueryHelper GetExpression expanded with ComparisonOperators by
Paul Welter
.
Also includes nearly complete OPath engine (Longhorn Specs) by
Jeff Lanning
.
Added ExecuteScalar and GetDataSet methods to the Transaction class.
Added defaultNamespace for types that do not include the Namespace.
Breaking Change: ExecuteCommand/Update/Delete returns int (not bool).
Bug Fixes: Enum support, ObjectSet indexer, two types with the same name.
Bug Fixes: Exceptions and Parameter are now marked Serializable also.
And a special thanks to
Jeff Lanning
for help with both OPath and Generics.
Posted by
PaulWilson
|
8 comment(s)
Tuesday, May 17, 2005 9:35 PM
Wally McClure Releases .NET PodCast -- Guess Who is Interviewed
Wally McClure
has released his first
.NET PodCast
-- including lots of good SQL 2005 stuff from Wally. Oh yea, he's also interviewed me for this PodCast -- although I wish my allergies hadn't been so bad since I sound terrible.
Posted by
PaulWilson
|
5 comment(s)
Friday, May 13, 2005 5:14 PM
Preparing for the Atlanta Code Camp
I'm scheduled first thing in the morning to present an "Introduction to O/R Mapping" at the
Atlanta Code Camp
. I've given many presentations to my teams in the past, but this will be my first public presentation -- so wish me the best. Will I make a good trainer -- or should I stick to designing and implementing solutions for clients -- we'll find out tomorrow. :) Of course, as luck would have it, my allergies are acting up in a major way yesterday and today -- just like every May -- so hopefully I'll feel better. By the way, since code camps are supposed to be free code only, I'll be using
NHibernate
for my set of examples -- I've actually got a nice little reference app with both an NHibernate implementation and a
WilsonORMapper
implementation. It demos just about every type of relationship and key type, as well as making use of a lot of inheritance (supported in v4.0 of my mapper, currently in beta). I'll post both versions in the coming week or so, when mine gets out of beta -- I think the NHibernate crowd will appreciate it since I've failed to find a good example app in my search. Maybe I'll also share some of my experiences working with NHibernate, which isn't bad at all -- of course I still like mine better. :) Finally, for all those who have asked, I've added a Wiki to my
WilsonDotNet
site where anyone can view it but only subscribers can edit it -- maybe I'll share some information about why I did it the way I have soon also.
Posted by
PaulWilson
|
5 comment(s)
Tuesday, May 03, 2005 4:10 PM
Nullable Types are NOT Integrated in .NET v2.0
Nullable value types have been added to .NET v2.0, but they have NOT really been integrated. The C# team has done a good job incorporating support for nullable types into the syntax, but the
VB team
has done nothing, which once again leaves VB behind the curve in features. But that is not what this post is about -- this post is about the fact that nullable types have NOT been integrated into the rest of the .NET framework -- and obvious places at that.
(1) Reading Data: Given a data reader, you can't just assign a value to a nullable type! This one just seems incomprehensible -- nullables obviously already exist in the database, and the .NET SqlTypes support them already, so this seems to be a key integration point. But alas, you simply can NOT assign a value from your data reader to a nullable type. Instead, you still have to explicitly test for DBNull, and handle that case separately:
int? nullInt;
if (dataReader.IsDBNull(index)) { nullInt = null; }
else { nullInt = dataReader.GetInt32(index); }
Note that
Julia Lerman
observed this before -- see her comments for more viewpoints.
(2) ConvertType: C# does at least support casts to/from regular types and nullable types, and it even gives you a handy way to convert nulls to a default by using the ?? operator, but just try to do any generic type conversions with Convert.ChangeType -- not supported! Again this seems like an obvious integration point, if nullable types are to be "builtin", but once again the new nullable types just feel like an afterthought -- and NOT integrated.
(3) WinForm Controls: The official story is that the data grids support nullable types, but what happens when you try to use a NumericUpDown or a DateTimePicker -- not supported! That's right, once again you'll find that you still have no real integration for nulls, and you'll have to continue resorting to magic values or checkboxes and manual conversions. These controls seem like another obvious place where there should be support for nullables.
All of this lack of integration makes me wonder what the point of nullable types really is? We could always create our
own structs
that supported the concept of null very similarly, but they lacked the builtin syntax support that C# is including, not to mention they failed to work with data-binding in grids, but the new nullable types simply aren't much better. The one thing they have going for them is that they will at least be a "standard" nullable.
Note that none of these issues prevented me from adding support for nullable types to my
O/R Mapper
, but I just thought I'd pass along what I observed since I do think the support I discovered was very disappointing.
Posted by
PaulWilson
|
21 comment(s)
More Posts