Posts

Showing posts from December, 2008

Nhibernate Fluent => hbm => SQL Schema

What luck for rulers that men do not think.  - Adolf Hitler More experimentation with NHibernate and we’re getting very close to Nirvana. The concept is (once again) – let’s develop our domain model first (similar to the “contract first” paradigm with SOA and WebServices) , create the mappings, and then create the database schema for the persistence mechanism (SQL Server, whatever) last. The Fluent.NHibernate project   API allows you to map entities in NHibernate in a more expressive and more testable manner than you are typically able to do. What it does is to give you a clear path to take your POCO s (Plain Old CLR Objects) –- without any of the “glop”  attributes or dependencies – just standalone objects – and turn them into NHibernate  .hbm XML Mapping files. This is very cool because it means your objects can be marked [Serializable] and you can send them over the wire via WCF, etc. without the – “[VendorNameHere] Baggage?” getting in your way, because they don’t really have

IIS / ASP.NET Recycling “Deadlock Detected”

I like long walks, especially when they are taken by people who annoy me.    - Noel Coward For some time I’ve been working on an ASP.NET web site issue where almost like clockwork, once an hour, the app recycles and then once again about six minutes later, it recycles again. It took a long time to find it, but it turns out that “we’re our own worst enemy”. No, it wasn’t some external process like Task Scheduler on the box, running once per hour and hogging threads. It was me having so much fun doing FireAndForget pattern RPC server pings on every search that I was shooting myself in the foot! This is what happens when we put in some new cool “thing” and then six months later, when we start to see problems, we can’t remember what we did! The ASP.NET “Deadlock detected” shows up in your Application Event log. It’s kind of cryptic, but here’s the general cause: You have a Threadpool per AppDomain. You may have a number of different operations going on (including just serving pages)

Referencing a non-Silverlight Assembly in a Silverlight Project

“Bailout? Hey! I’m having trouble paying my bills. How about it?” -- Me This one comes up a lot, and the bottom line is, you can’t do it. But - I think it is important to understand why it won't work: You cannot reuse non-Silverlight assemblies since the desktop CLR and Silverlight CLR are based on two different Frameworks. They are similar, but they aren’t “the same”. The BCL’s (Base Class Libraries) that are referenced in each type of project may have similar names but they are completely physically different files . But you can reuse the original code if it's compatible and available to you in source code form. In Visual Studio, you can create a new Silverlight class library project, then right click to add an existing item. You can click the arrow on the right side of the Add Button, and choose "Add As Link". This will not copy the .cs file to your new project, so when you modify the .cs file in one place, the other place will be automatically updated. You

Silverlight 2 / Visual Studio 2008 “The project type is not supported” error.

  Recently I managed to discombobulate my Visual Studio 2008 Installation, and had to remove and reinstall the little booger. Everything went pretty much OK except after reapplying the Silverlight_Tools.exe (the combined developer installer), I tried to load an existing Silverlight 2.0 RTM project and got “The project type is not supported by this installation” dialog. I’m like, “Huh? The installation went perfectly with no errors”.  One fix I found that seems to work perfectly is to run “Devenv /setup”. For some reason this resets all the package loads and Silverlight Tools will be happy ever after. In my short happy life as a .NET developer, I’ve seen several products where MSIEXEC ends up just sitting there in memory at the end of an install session, all dressed up with no place to go, and it just hasn’t quite finished the job. While I’m on this subject, it might be appropriate for a quick review of all the DEVENV.EXE switches (the full documentation is here , along with al

LINQ To SQL / Entity Framework / NHibernate ORM Top-Down, Objects First

People demand freedom of speech as a compensation for the freedom of thought which they seldom use . – Soren Kirkegaard In the process of stumbling through LINQ To SQL to see if I would be able to represent a SQL Server database schema I created to provide storage for a hierarchical well-defined XML Schema for a commonly used utility object, I came to the realization that I was indeed doing everything completely backwards ! What I am saying is this:  ORM should be done by focusing on the OBJECTS FIRST, not the Database Schema! Unfortunately, most of the tools we have are data-centric, not object-centric.  Scott Allen has a post that clearly describes the debacle . To my knowledge, there will not be any plain old CLR objects (POCOs) in Entity Framework. LINQ to SQL doesn’t yet have all the mapping capability to really separate the object model from the underlying database schema – and of course, you can use it with SQL Server only. Now, this situation may improve in t

One morning, I shot a Chevrolet in my pajamas…

Government does not solve problems; it subsidizes the m. – Ronald Reagan The White House said today that "The legislation crafted in recent days aimed at helping the ailing U.S. automakers is an effective and responsible approach".  I strongly disagree. It was hard enough to get policymakers to finally utter the word "recession." The Treasury just issued 4 week T-Bills at ZERO percent interest, for the first time in history. In the secondary markets, T-Bills were trading at a premium (meaning negative yields). You want to talk about deflation? People are so fearful that they’re willing to let the US Treasury hold their money and earn no interest at all.  The next challenge may be to get them to say "nationalization"  -- because that’s exactly what’s happening, baby! That's pretty much what the government takeover of big chunks of the economy amounts to, in my opinion. Welcome to the USSRofA, Comrade! Actions taken by the Democratic-led Congress