Rockford Lhotka's Blog

Home | | CSLA .NET

 Tuesday, July 31, 2007

Srinivas Surampalli, a fellow Magenic consultant, just wrote the following article:

Using XML with Stored Procedures Effectively in SQL Server 2005

One common question that comes up relative to CSLA data access is how to efficiently save an object graph where there's a parent with children or even grandchildren.

The typical answer is to make an INSERT/UPDATE/DELETE call for the parent and each child. This article shows a different approach, where you could put the business object data into a DTO object graph, serialize that object graph into XML and make a single database call.

What surprised me, looking at the article's code, is that the SQL in the stored procedure is so straightforward.

As always, you should test different approaches to find the one that works best for your application, based on performance, maintainability and other requirements.

Tuesday, July 31, 2007 8:15:00 AM (Central Standard Time, UTC-06:00)  #    Disclaimer
 Thursday, July 26, 2007

Visual Studio 2008 Beta 2, along with Microsoft .NET 3.5 Beta 2, is available for download. Here's Soma's official announcement.

I find that downloading such huge sets of files requires a bit of help. My recommendation: Free Download Manager. This tool is awesome - indispensable in fact - if you do any downloads beyond small text files :) It does queued downloads, resumed downloads and throttling. Perhaps best of all, it does multi-threaded downloads, so it maximizes the use of your bandwidth when running at full throttle.

Update: Apparently there are some things you must do/fix before using VS 2008!! Read ScottGu's blog post about it!

Update 2: According to Juval Lowy, the svcutil.exe program in Beta 2 is broken. A workaround is to copy an older (Beta 1?) version of svcutil.exe over the top of the Beta 2 version.  Instead, Justin Smith says that you need to run "sn.exe -Vr svcutil.exe" - apparently then you don't need to copy an older verison over the new one.

Thursday, July 26, 2007 3:21:37 PM (Central Standard Time, UTC-06:00)  #    Disclaimer

Every time I go to override the Text property in a Windows Forms UserControl I have to go find this one little attribute that I can never remember...

It is easy enough to remember to make the property Browsable(true), but it is that other attribute that's hard to remember: DesignerSerializationVisibility(DesignerSerializationVisibility.Visible).

This web page not only answers the question, but includes a nice summary of all the System.ComponentModel attributes. 

At least next time I know I can search my own blog to find the answer :)

Thursday, July 26, 2007 8:47:34 AM (Central Standard Time, UTC-06:00)  #    Disclaimer
 Wednesday, July 25, 2007

Today I received a letter from a large (the largest?) US bank, offering me a special discount rate on charges made to my credit card.

To my knowledge, I have no account at this bank at all, including no such credit card. That’s never good!

So I called the number on the letter to find out what’s going on. Of course I got to the bank’s credit card service center, where they asked me my credit card number, let’s pick up there:

“That’s why I’m calling. I don’t have such a credit card” said I.

“I can look it up using your social security number” said she.

And this is when my brain finally kicked in. I had dialed the number from the suspicious letter!! While the letter looked authentic, and the automated answering system on their end sounded authentic, how did I actually know I was talking to this large bank?

“I’m not sure I want to provide that” I answered.

“Can I have you spell your name then?” she asked.

I did that, as my name is easily found, and the letter already had that. She then confirmed that I had an account with them, and asked “Can you confirm your birth date?”

“Umm, I’m not sure I want to provide that either. I need to look on the web site and see if your phone numbers match.”

“OK, can I put you on hold?”


So I did. I went to their web site, clicked “Contact Us” and found different phone numbers. In the meantime she came back on the line.

“Did you find what you needed?” she asked.

“No, the numbers don’t match.”

“Well you have reached ____, and we do have an account in your name. If you provide your birthdate I can give you the account details.”

“Yeah, see that’s the problem. You can confirm my identity, but there’s nothing you can give me that can confirm your identity. I’m going to have to call the number on the web site to be sure.”

“This really is ____” she said in an exasperated tone.

“Well, I can’t be sure” I replied.

“Then do what you need to” she said, and hung up rather abruptly.

So I did call the number from the web site. I did have an account there. Some credit card I haven’t used since the middle of 2000. I was able to find that out without even talking to a human: their automated system handled the whole process, including my canceling the card.

But it sure goes to show just how complex bi-directional authentication can be. Makes a person really appreciate the work done to design Kerberos, SSL, Windows Card Services and all the other authentication schemes out there we take for granted every day…

Wednesday, July 25, 2007 2:45:17 PM (Central Standard Time, UTC-06:00)  #    Disclaimer
 Thursday, July 12, 2007

Bil Simser tagged me with this meme, thanks Bil.

As I tend to do with these things, I'll answer, but I'm not going to pass it on.

Apparently the idea is to list 5 things that'll make me a better developer over the next 6 months. The problem is, I'm not sure being a better developer is my primary focus just at the moment. But here's my list:

Keep my head above water

Microsoft has recently, and continues into the foreseeable future, to come out with new technology releases at a ridiculous pace. By "head above water" all I really mean is that I want, at least, to have a general clue about the purpose and real capabilities of all the stuff they are throwing at us. Not just the marketing hype, but what it really means. This, to me, has always been one of my primary strengths: the ability to grok most of the technologies available, and to figure out how they fit into some overarching architecture/worldview/philosophy.

But the current rate of change, and the amount of redundancy (ADO.NET, DataSets, LINQ, ADO.NET EF all solving the same problem? Come on!) makes this increasingly challenging. So over the next 6 months I'll be reading, talking to experts (and anyone else with something to offer) and experimenting in the hopes of keeping my head above water.


I used to learn new technologies by writing games - specifically MUDs and then low-end MMORPGs (well, I wrote and rewrote parts of one that never really came together). Someday I'd like to get back to doing that.

But in the meantime, I have CSLA .NET, and it has grown enough over the years that it affords me the opportunity to explore most of the key technologies I really want to learn. Having just released version 3.0, I got to dig into the plumbing behind WPF data binding, and explore the details around how WCF supports client/server (which it does well btw). Now my sights are turned toward two targets: .NET 3.5 and Silverlight.

The new language features, and of course lINQ itself, are key areas of focus for CSLA .NET 3.5. Fun stuff, no doubts there!

And if Silverlight 1.1 gets just a few more features (most notably data binding to objects), I believe I can create a CSLA Light that will provide a meaningful subset of CSLA .NET functionality within the Silverlight environment. If that pans out, it will be quite exciting :)


Working for Magenic is great! I really enjoy the company and the people I work with. Over the next few months I'll be conciously spending more time and energy working internally with Magenic. As noted above, Microsoft's technology release schedule is grueling, and I want to make sure Magenic's consultants have the opportunity to stay on top of everything. This not only means doing some internal training, but more importantly working to build up a base of expertise and the infrastructure so other people can do some of that training (formally or informally).

It is (in my view) entirely unrealistic for one person to be an expert on everything that's going on. How can you credibly span .NET, Windows, Web, AJAX, SOA, Silverlight, SharePoint, Biztalk, SQL, Windows Server 2008 and everything else? You can't. But Magenic can, because we have a large enough pool of people that there's a decent level of expertise in all these technologies spread across the company. My challenge, then, is to coordinate that expertise such that the experts are in a position to share their knowledge with everyone else who needs it.

Of course Magenic has five offices across the country, and so there's the interesting sub-challenge of enabling the sharing of expertise across geographic distance. Actually it isn't the knowledge sharing that's such a big deal (we have great forums, etc), but it is the sharing if passion that is harder - and yet is at least as important.

Don't burn out

I've been feeling seriously burned out of late. That's not good. Part of it is due to the way travel grates on me more all the time, but most of it is that I haven't spent time doing truly exploratory things for a very long time now. CSLA has become quite consuming, and so my spare time goes into the framework, when I could be working on a .NET MUD engine or something really fun like that (I have these cool prototypes for truly dynamic world behavior that I'd love to pull together into something real).

It is also the case that I'm terrible about taking vacations. If I vacation at home, I work. That's the primary drawback with having a home office - work is always right there. But with Smartphones and laptops with wireless and/or cell modems the "office" can go almost anywhere, so even with a traditional office, escape is almost impossible.

Except... In August I'm spending a full week (nearly 10 days) in or near the Boundary Waters in far northern Minnesota. No meaningful cell coverage, no Starbucks or anywhere like it that would have wireless. Just untold miles and miles of wilderness, canoing, camping and fishing. Yea!

Remember the passion

Have you ever played that "what if" game? The one where you ask youself what job you'd do if you didn't do your current job?

I always draw a blank. If I had to do something else it would actually be work, rather than what I do now, which is to get paid for my hobby.

This, by the way, is what bothers me most about outsourcing, or even the software factory concept. It is true that economic needs shift over time, and steel workers needed to get new skills to find new jobs (as an example). I suppose it is possible that many of those steel workers had a burning passion for their job. That working with steel was their hobby as well as their job. But I doubt it. Most people I know view work as work: as a way to make money so they can do what they really want to do in their off hours. On the other hand, most developers I know view work as fun - and a way to make money while having fun.

Economists are often dismissive toward us, saying that if our jobs go offshore that we can just learn new skills and find different jobs. What they fail to understand is that we'd be doing far more than switching jobs: we'd be giving up an entire way of life. We'd be moving from a world of creative inspiration to a world of soul-crushing tedium. Yes, I realize I'm probably being very condenscending toward people with "normal" jobs, but this is how I see the world... (Then again, maybe economists do realize the deep love we have for what we do, and they envy us and so feel no remorse in talking about the destruction of our way of life?)

In any case, I love aspects of technology (especially building distributed and/or quasi-autonomous systems). And I love teaching about development. These things have been my passion since long before I officially started my career (when I was just a teenager, I was teaching elementary school kids how to use those new-fangled computers (Apples with no floating point support)). And I love writing - I really am what JMS describes as an "author" (one cursed to write because they can't not write). I can't imagine not doing most of the things I do today.

I think that's the key: remember the passion. Remember the fun. Yes, work hard, but more importantly code well, and perhaps above all: have fun!

Thursday, July 12, 2007 10:38:00 AM (Central Standard Time, UTC-06:00)  #    Disclaimer
 Tuesday, July 10, 2007

CSLA .NET Version 3.0 is now available for download! Listen to the official announcement on .NET Rocks!

CSLA .NET 3.0 includes numerous enhancements and features of value to all CSLA .NET users, and of course version 3.0 adds support for Microsoft .NET 3.0 features like WCF and WPF.

You can use CSLA .NET 3.0 on either Microsoft .NET 2.0 or Microsoft .NET 3.0.

Features for everyone

CSLA .NET 3.0 includes enhancements useful to all CSLA .NET 2.1.4 users, including these highlights:

Validation rules

  • PropertyFriendlyName – specify a friendly name to use when displaying broken rule text
  • Format – specify a format mask to use when displaying broken rule numeric values
  • StringMinLength – new validation rule method
  • DecoratedRuleArgs – useful for code generation of AddBusinessRules() methods
  • Fix bug with stopProcessing and rule priorities
  • RegEx – rule method now supports options for dealing with null values


  • New CanExecuteMethod() functionality, similar to CanReadProperty() and CanWriteProperty()

Undo and Data binding

  • If edit levels get out of sync an exception is thrown, making debugging of Windows Forms data binding much easier


  • Cleaned up and rearranged interfaces to provide more consistency – making it easier to create UI frameworks on top of CSLA business layers


  • Added TryParse() method
  • Fix bug with CompareTo() method

SortedBindingList and FilteredBindingList

  • Allow access to underlying source list


  • Fix some bugs where ListChanged/CollectionChanged events were raised when they shouldn't have been. The result is that some data binding scenarios now work where they didn't, and in other cases performance is improved.


  • Reworked data binding code to address all known issues

See the change log for a complete list of changes.

Again, CSLA .NET 3.0 can be used without Microsoft .NET 3.0. If you want to build CSLA .NET 3.0 without installing the Microsoft .NET 3.0 runtime, you must define the NET20 symbol in project properties.

Microsoft .NET 3.0 Features

Of course the primary focus of CSLA .NET 3.0 is support for Microsoft .NET 3.0. Highlights include:


  • WcfProxy – a data portal channel that uses WCF. You can transparently move from any existing data portal channel to WCF by using this new proxy.
  • DataContract – support for using the WCF DataContract and DataMember attributes in your business classes
  • WPF
    • CslaDataProvider – a data provider control that can create, fetch, save and cancel edits on a CSLA .NET business object. In some cases this can lead to code-less data entry forms!
    • Validator – a control that provides Windows Forms ErrorProvider-like behavior to WPF forms that are data bound to CSLA .NET objects.
    • Authorizer – a control that provides Windows Forms AuthorizeReadWrite-like behaviors to WPF forms that are data bound to CSLA .NET objects.
    • ObjectStatus – a control that exposes IsValid, IsSavable and other properties from a CSLA .NET business object so they can be used by XAML data binding.
    • IdentityConverter – a value converter that can be used to work around an issue with data binding and refreshing the UI.

The Csla solution is a Visual Studio 2005 solution. You can open and build the solution in Visual Studio 2005 if you have the Microsoft .NET 3.0 runtime installed on your workstation. Or you can use the NET20 symbol to allow compilation without the Microsoft .NET 3.0 runtime.

The Csla solution automatically upgrades when opened in Visual Studio 2008, and you can build the solution in Visual Studio 2008 if you are using that environment.


  • Added new WPF UI with equivalent functionality to PTWin.

Note that this project is built using Visual Studio 2008 (Orcas) Beta 1.


  • Added new Workflow UI to illustrate how a workflow can use CSLA .NET business objects

Note that this project is built using Visual Studio 2008 (Orcas) Beta 1.

ProjectTracker\PTWcfClient and PTWcfService

  • Added a WCF service illustrating how to expose CSLA .NET objects through WCF/SOA
  • Added a WCF client app illustrating how to call a WCF service

Note that these projects are built using Visual Studio 2008 (Orcas) Beta 1.


  • Added a WCF host for the data portal

Note that this project is built using Visual Studio 2005 with the WCF extensions installed.

The ProjectTracker solution includes WcfHost, but does not include the other new projects. The reason for this is that the ProjectTracker solution is still a Visual Studio 2005 solution, while these other projects are built using Visual Studio 2008. The ProjectTracker solution upgrades automatically when opened in Visual Studio 2008, and in that environment you can add the remaining projects to the solution.


Migrating from version 2.1.4 to 3.0 should be relatively painless.

The only place you may encounter issues is that version 3.0 throws an exception if your edit levels get out of sync when using n-level undo. This may highlight pre-existing bugs in your UI code (especially in Windows Forms apps) that you should resolve. Look at the ProjectTracker\PTWin code for examples of the correct way to interact with Windows Forms data binding.

Migrating from 2.0.x to 3.0 has the same challenges as moving from 2.0 to 2.1. Version 2.1 introduced some significant, but important, changes to the handling of validation and authorization rules that can impact your business object code. See the CSLA .NET Version 2.1 Handbook for detailed information about version 2.1.

Migrating from 1.x to 3.0 will require some effort. There are many new features in 2.1 and 3.0 as compared to 1.x, and taking advantage of those features requires changes to your business objects and your UI code. You can look at the Expert C#/VB 2005 Business Objects books and the CSLA .NET Version 2.1 Handbook to get details around the scope of the changes.


I plan to write an ebook showing how to use the new features and enhancements in CSLA .NET 3.0. This ebook should be available in the third quarter of 2007 (probably September).

I’m working on CSLA .NET 3.5, based on Microsoft .NET 3.5 and focused on LINQ and various other new .NET features. Look for this in the first quarter of 2008.

I am also planning to update my Expert Business Objects books for Visual Studio 2008 and CSLA .NET version 3.5. This will probably come out in the second quarter of 2008.

You can see the roadmap here.

Tuesday, July 10, 2007 8:56:10 AM (Central Standard Time, UTC-06:00)  #    Disclaimer
On this page....
Feed your aggregator (RSS 2.0)
April, 2019 (2)
January, 2019 (1)
December, 2018 (1)
November, 2018 (1)
October, 2018 (1)
September, 2018 (3)
August, 2018 (3)
June, 2018 (4)
May, 2018 (1)
April, 2018 (3)
March, 2018 (4)
December, 2017 (1)
November, 2017 (2)
October, 2017 (1)
September, 2017 (3)
August, 2017 (1)
July, 2017 (1)
June, 2017 (1)
May, 2017 (1)
April, 2017 (2)
March, 2017 (1)
February, 2017 (2)
January, 2017 (2)
December, 2016 (5)
November, 2016 (2)
August, 2016 (4)
July, 2016 (2)
June, 2016 (4)
May, 2016 (3)
April, 2016 (4)
March, 2016 (1)
February, 2016 (7)
January, 2016 (4)
December, 2015 (4)
November, 2015 (2)
October, 2015 (2)
September, 2015 (3)
August, 2015 (3)
July, 2015 (2)
June, 2015 (2)
May, 2015 (1)
February, 2015 (1)
January, 2015 (1)
October, 2014 (1)
August, 2014 (2)
July, 2014 (3)
June, 2014 (4)
May, 2014 (2)
April, 2014 (6)
March, 2014 (4)
February, 2014 (4)
January, 2014 (2)
December, 2013 (3)
October, 2013 (3)
August, 2013 (5)
July, 2013 (2)
May, 2013 (3)
April, 2013 (2)
March, 2013 (3)
February, 2013 (7)
January, 2013 (4)
December, 2012 (3)
November, 2012 (3)
October, 2012 (7)
September, 2012 (1)
August, 2012 (4)
July, 2012 (3)
June, 2012 (5)
May, 2012 (4)
April, 2012 (6)
March, 2012 (10)
February, 2012 (2)
January, 2012 (2)
December, 2011 (4)
November, 2011 (6)
October, 2011 (14)
September, 2011 (5)
August, 2011 (3)
June, 2011 (2)
May, 2011 (1)
April, 2011 (3)
March, 2011 (6)
February, 2011 (3)
January, 2011 (6)
December, 2010 (3)
November, 2010 (8)
October, 2010 (6)
September, 2010 (6)
August, 2010 (7)
July, 2010 (8)
June, 2010 (6)
May, 2010 (8)
April, 2010 (13)
March, 2010 (7)
February, 2010 (5)
January, 2010 (9)
December, 2009 (6)
November, 2009 (8)
October, 2009 (11)
September, 2009 (5)
August, 2009 (5)
July, 2009 (10)
June, 2009 (5)
May, 2009 (7)
April, 2009 (7)
March, 2009 (11)
February, 2009 (6)
January, 2009 (9)
December, 2008 (5)
November, 2008 (4)
October, 2008 (7)
September, 2008 (8)
August, 2008 (11)
July, 2008 (11)
June, 2008 (10)
May, 2008 (6)
April, 2008 (8)
March, 2008 (9)
February, 2008 (6)
January, 2008 (6)
December, 2007 (6)
November, 2007 (9)
October, 2007 (7)
September, 2007 (5)
August, 2007 (8)
July, 2007 (6)
June, 2007 (8)
May, 2007 (7)
April, 2007 (9)
March, 2007 (8)
February, 2007 (5)
January, 2007 (9)
December, 2006 (4)
November, 2006 (3)
October, 2006 (4)
September, 2006 (9)
August, 2006 (4)
July, 2006 (9)
June, 2006 (4)
May, 2006 (10)
April, 2006 (4)
March, 2006 (11)
February, 2006 (3)
January, 2006 (13)
December, 2005 (6)
November, 2005 (7)
October, 2005 (4)
September, 2005 (9)
August, 2005 (6)
July, 2005 (7)
June, 2005 (5)
May, 2005 (4)
April, 2005 (7)
March, 2005 (16)
February, 2005 (17)
January, 2005 (17)
December, 2004 (13)
November, 2004 (7)
October, 2004 (14)
September, 2004 (11)
August, 2004 (7)
July, 2004 (3)
June, 2004 (6)
May, 2004 (3)
April, 2004 (2)
March, 2004 (1)
February, 2004 (5)

Powered by: newtelligence dasBlog 2.0.7226.0

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

© Copyright 2019, Marimer LLC

Send mail to the author(s) E-mail

Sign In