Wednesday, October 29, 2008

Error: Unable to create the Web site 'http://wsttest/MobilePricing/'. You are not authorized to perform the current operation.

  • Attempting to re-publish an existing Web Site from Visual Studio 2008.
  • Get the above error.
  • Don't understand the cause of the issue as yet


  • Delete the entire Web Site from IIS Manager (not Explorer) on the Server
  • Re-publish 


  • As usual, always grateful to learn if anybody knows the root cause of this problem.

Monday, October 20, 2008

How to Repair Visual SourceSafe Database

  • Visual SourceSafe reports a broken chain and recommends running a fix.
  • But, the backup folder is not empty (because it just wrote an analysis log to it) so the fix won’t run.
  • So, you delete the contents of the backup folder and re-run the fix.
  • But, the database is in use (users are logged in) so the fix won’t run.
  • So, you politely ask all the users to stop being productive for 5 minutes, while you run the fix.
  • But, even with all users logged out, the stupid Analyzer still reports that files are locked and the fix won’t run. 


  • No (Owen, Mindscape, et al), you don’t have to upgrade/delete Visual SourceSafe!
  • Go to Computer Management, System Tools, Shared Folders, Open Files
  • Find and delete these three locks (being held open by Windows):
  • \VSS\data\names.dat
  • \VSS\data\rights.dat
  • \VSS\data\status.dat 


  • Here’s the command line to run the fix:
  • "C:\Program Files\Microsoft Visual SourceSafe\analyze.exe" -F -V3 -D "e:\vss\data"

Thursday, October 16, 2008

Profile Storage Space Issues

Both Martin and I are experiencing blow-outs of our profile space (currently around 120MB), mainly due to Visual Studio 2008.  We can handle it with the handy little Registry snippet which grants us unlimited space.  However, logging in and out on the network is taking longer each time.

I wonder if now is a good time to think about and/or investigate the option of running Virtual Machines and moving Visual Studio onto there.  I personally don’t have the time to look into this.  What are other people’s opinions?

  • Norman replied:
    • My profile is sitting on 45Mb and I am running VS2008 (VS2005 and VS2003 as well).  I am wondering if it is SP1 for VS2008 that is storing a lot more in the d:\Documents and Settings...? 
    • I am a bit wary of the extra complexity of using VMs and think a better option maybe some further tweaks so that VS2008 stores its settings in a different location than d:\Documents and Settings\... .  I think most of it is set in the Registry as the options below only cover a small subset of where it stores its stuff
    • Totally agree we need to do something.  Recently I had to test Brochure Template on an EDS Machine in Auckland logging in using my T number.  As you can imagine very slow and could not log out (no rights to tweak the Registry).
  • Martin replied:
    • Where is the official source to state the current size of your profile?  I was looking at System properties.. Advanced.. User Profiles.. and my roaming profile was 585MB!  Is this the same profile EDS tracks?  I've culled mine back to 100MB now..
    • I've cut that back dramatically by deleting the ReflectedSchemas and ReflectedTypeLibs that VS likes to generate all the time.
    • But it is only a temporary fix, though I plan to write a script to run when I want to log off or shut down that will automatically delete them every time.
    • Those project and template locations tend to not have much in them unless you are creating your own user templates.
    • The best solution would be to exclude certain folders from our profile.  The only thing stopping that from happening is getting EDS to set it up for us?
  • James replied:
    • I am reluctant to adopt Martin’s idea, as I believe those Reflected Schemas are what IntelliSense generate each time you invoke them, so I don’t want to constantly have to be waiting for IntelliSense every day. 
    • Does anybody in the community have any (useful) suggestions?
  • Mike (manager) replied:
    • Move those files out of profile space onto hard drive;
    • Create shortcuts in the profile space to the actual files.
  • Conclusion:
    • I did move those files out;
    • But shortcuts didn't work;
    • But in the ReflectedSchemas folder is a file "entries.xml" (same for ReflectedTypes folder);
    • if you edit this to point to the new location of the real files, then Visual Studio will happily use them;
    • New .xsd files will still be created in your profile as you develop, but a periodic sweep (manually) should fix that.

ORM 102: A Comparison of Two ORMs

This is part 2 of a 2 part series of articles:

  • In part 1, I introduced the concepts of Object Relational Mappers, and demonstrated the integration of a popular Open Source ORM called SubSonic into the Visual Studio Integrated Development Environment (IDE).
  • In part 2, I shall be integrating a Kiwi ORM, LightSpeed, into Visual Studio, and comparing the products on functionality.

Who Should Read This Article

  • You are starting out developing, or have been developing for a while and wondered about ORM.
  • You are classically trained in Entity Relational Modelling and know you need to get your head around Object Oriented Design.
  • You have a BCOM and want to understand what all those BSc’s are talking about.

What Is Covered in This Article

  1. How Do I Use LightSpeed?
  2. How Do These Two ORMs Compare?
  3. What about LINQ?
  4. Summary

How Do I Use LightSpeed?

What Do I Need?

How Do I Integrate LightSpeed into Visual Studio?

  • After you have downloaded it, install it. 

What is LightSpeed?

LightSpeed is a commercially-available ORM created by MindScape, a NZ company.  Unlike SubSonic, LightSpeed is a fully supported product. 

How Do I Generate DAL Classes?

  1. From Visual Studio, create new Web Application Project (e.g. http://localhost/AdventureWorks/
  2. Add VB Class Library Project (e.g. AdventureWorks.DataAccess)
    • Add… New Item
    • Under Data, select LightSpeed Model.  Click Add.
    • From the new designer that opens up, go to the Server Explorer
    • Point, click and drag tables (up to 8) from the Server Explorer to the LightSpeed Model designer.
    • Right-mouse-click, select Arrange, to arrange the class definitions into a classic hierarchy.
    • Click Save
  3. Add New File… Application Configuration
    • Add a configuration section for a LightSpeed Context:
         <section name=”lightSpeedContexts” type=”Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection, Mindscape.LightSpeed” />
    • Add a configuration string section (not shown here).
    • Add a LightSpeed Context section:
         <add name=”default”
                  pluralizeTableNames=”false” />
    • Click Save
  4. Add New Item… Class
    • Call it e.g. Repository
    • Add the following code:
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using Mindscape.LightSpeed;

      namespace Demo9
         public static class Repository
            private static LightSpeedContext<ModelUnitOfWork> _context;
            public static LightSpeedContext<ModelUnitOfWork> Context;
                  if (_context == null)
                     _context = new LightSpeedContext<ModelUnitOfWork>();
                     _context.ConnectionString = LightSpeedContext.Default.ConnectionString;
                     _context.PluralizeTableNames = LightSpeedContext.Default.PluralizeTableNames;
                     _context.IdentityMethod = IdentityMethod.KeyTable;
                  return _context;
    • Click Save

Consume DAL

  1. Add a Class Item to the project, call it e.g. Product
  2. Type the following code under appropriately name and parameterized methods:
    //The Add Method
       using (ModelUnitOfWork uow = Repository.Context.CreateUnitOfWork())
          Product product = new Product();
          product.Name = “LightSpeed”;
          product.Description = “Fantastic .NET O/R Mapper”;

    //The Find Method
       using (ModelUnitOfWork uow = Repository.Context.CreateUnitOfWork())
          Product product = uow.Products.Where(p => p.Name == '”LightSpeed”).First();

    //The Delete Method
       using (ModelUnitOfWork uow = Repository.Context.CreateUnitOfWork())
          Product product = uow.Products.Where(p => p.Name == '”LightSpeed”).First();

  3. Click Save
  4. Build and Run (F5)

How Do These Two ORMs Compare?






Rob Conery


Chad Myers

Open Source?






Ed. Limitation Price
Exp Up to 8 classes Free!
Std Up to 30 classes $99 USD
Pro None $299 USD
Ent. None (source!) $499 USD


NZ Made?




Generates DAL?




Mapping Files?




VS Designer?






Opinionated Convention

Config files

LINQ Support?




Focus on

Developer speed




In this two-part article, I have shown and compared the functionality of two different Object Relational Mappers.  SubSonic is an Open-Source, simple, free utility for quickly getting data classes out of the database and into .NET design environment.  LightSpeed is a commercial product, designed to optimize the developers experience through industry-standard use of LINQ and a Visual Designer to allow reverse-engineering of new class attributes back into their table columns.

In the end, you will decide which criteria is more convenient for you.  It has not been my intention to attempt to persuade you to decide one product over another.  I hope I have adequately explained the purpose and use of Object Relational Mappers in general, by showing these two specific examples.

ORMs are great time-savers for developers who have to work with existing database structures.  They cut out the necessity for 90% of stored procedures in one application I was creating, because I didn’t have to worry about the four CRUD procs.  This leaves more time to concentrate on the other 10% of stored procedures that are really necessary, because they can’t be done any other way.  One example that comes to mind is this: suppose you had to count the number of purchase orders that a product appeared in.  The LINQ way to do it is:

Dim prd As DAL.Product = qry.ExecuteAsCollection(Of DAL.ProductCollection).FirstOrDefault

Return prd.PurchaseOrderDetailRecords.Count


However, the problem with this way of doing it is that the line prd.PurchaseOrderDetailRecords.Count, in order to succeed, must first go and get all Purchase Order Detail records.  This is hugely inefficient for a mere count.  The better way to do this is to create a Stored Proc which accepts the Product ID and only returns the integer count.

About the Author

James Hippolite started programming in 1983 on an Apple IIe, at the age of 14. After graduating with a bachelor degree in Information Systems from Victoria University of Wellington in New Zealand in 1990, he started working with small systems relational databases, like dBase, Paradox, FoxPro and finally Microsoft Access.

In 1991 he founded Mana Information Systems, a company for SME who couldn’t afford their own IT departments. As the lead developer, he developed small to medium WinForms applications using SQL Server, Visual Basic and latterly ASP.  In 2003 James developed in C# his first .NET web application, an internal metrics reporting tool for his new employer, Telecom New Zealand, utilising SQL Server stored procedures and .NET classes.

Due to the absolute ease of use of ORMs, James finally converted to their use in 2008. James is slow adopter of technology, which is no reflection upon his Microsoft Certified Trainer status.  He has contributed lectures on Microsoft Certification and SQL Server Reporting Services to the .NET community.

He lives in Wellington and is currently employed full time in a large corporate and loving the regular hours that non-consultants enjoy.

ORM101: An Introduction to Object Relational Mappers

I gave a presentation at the Wellington Dot Net User Group last night. I have been asked to supply my notes.

Steps for downloading and installing:

  1. Download
  2. Install
  3. Add External Tool command to Tools menu
    • Title: SubSonic DAL
    • Command: SubCommander/sonic.exe
    • Arguments: generate /out Generated /lang VB
    • Initial directory: ($ProjectDir) Use
    • Output window Prompt for arguments
  4. Add Subsonic Toolbar Customise Add External Tool 1

Steps to Generating DAL classes:

  1. Open new Web Application Project (AdventureWorks)
    1. Open IIS Manager
    2. Enable Directory Security, Integrated Windows Authentication
  2. Add VB Class Library Project (AdventureWorks.DataAccess)
    1. Ensure Project Root Namespace = “AdventureWorks”
    2. Add Reference to Subsonic.dll, System.Configuration, System.Web
    3. Delete Class1.vb
    4. Edit app.config
    5. Add section reference to
    6. Add a connection string for each one of your providers
    7. Define Subsonic Service Provider(s) (one per database):
    8. Add Generated folder to DataAccess folder (or project)
    9. Execute Subsonic
  3. Add Existing Item(s)
  4. Build

Using in Web Project:

  1. Add a Business Logic Layer (Class Library)
    • Add References to SubSonic.dll, AdventureWorks.DataAccess
    • Rename Class1 as Product
    • Define the class as Public, decorated with
    • Define methods as Public, decorated with
    • Save and Compile
  2. Add a Grid to a Web Page
    • Add Reference to Subsonic.dll
    • Add SubsonicSection to web.config
    • Add SubsonicProvider to web.config
    • Add ConnectionString to web.config. Highlight difference in user ID.
    • Set Default.aspx as Start Page
  3. Build and Run (F5)

Tuesday, October 14, 2008

Hansel Minutes: Subsonic with Rob Conery

Code generator for DAL:

  1. Head over to Codeplex
  2. Download Subsonic 2.1
  3. Install.  No GAC.  No add-ins.
  4. Settings in web.config
  5. Uses ActiveRecord pattern; 80% of the projects are light-weight, doesn’t use Enterprise patterns
  6. “I want the developer to go home early”
  7. Industry strength: can it scale?  No?
  8. nHibernate is excellent at; caching; future query;
  9. Generally, start with DB; build out your model;
  10. Migrations can generate database for you.  (Define class in .NET code first.)
  11. Command line tool that can (Sonic.exe AKA Subcommander) generate DAL.
  12. Use typical repository pattern (returns IList of )
  13. Generates ANSI-SQL for multiple Database Standards
  14. LLBLGEN Pro: pocket book constraint; blows doors over Subsonic’s functionality; but it’s edge-case stuff;
  15. nHibernate: complex to implement;
  16. Subsonic: for people who aren’t into the tinkering of creating a web site; pragmatic
  17. example: Subsonic Starter Site (Dot Net Nuke ultra-light); no longer supported

.NET Rocks #380 Franz Bouma on ORM!

Frans Bouma started programming in 1986 on a Toshiba MSX-1, at the age of 16. After graduating with a bachelor degree in Computer Science from the 'Hogeschool Enschede' in the Netherlands in 1994, he started working with 4GL systems and post-relational databases, like uniVerse. In 1996 he founded Solutions Design, a company for database driven web-application development. As the lead developer, he developed medium to large enterprise web applications using SqlServer, AS400, COM+, VC++, Visual Basic and Asp. In 2001 Solution Design produced a content management system completely based on Microsoft technologies like SqlServer 2000, COM+, VC++, VB6 and asp. In 2002 Frans developed in C# his first .NET application, the open source LLBLGen code generator for SqlServer stored procedures and .NET classes. Due to the worldwide success of LLBLGen, Frans designed and developed in 2003 for Solutions Design the O/R mapper and code generator LLBLGen Pro, which is currently one of the market-leading data-access solutions for .NET, C# and VB.NET. Frans received for his community efforts the MVP reward for C# in 2004, 2005, 2006 and 2007 and works full time on LLBLGen Pro enhancements. In 2006, HnD, a full featured support system/forum system for ASP.NET 2.0 was released as open source (GPL), written and designed by Frans Bouma.


  • Kathleen Dollard is a fan
  • Long time on the market
  • Customers with Databases with over 2000 tables


  • Started well
  • In the back seat now
  • Enabled a lot of interest in ORM and Data Access in general
  • People like it for:
    • Working with objects
    • Using a system to persist data to the database
  • A lot of people start with it, but ultimately don’t like it because it’s a great start but after a while you see the limitations:
    • Their editor, their designer cannot do model refreshment: this is very important when the DB schema has changed.
    • Only for SQL Server
    • In the runtime framework, it doesn’t have a real good “eager loading,” is inefficient in returning data in 1 to many to many relationships
    • Only okay for small applications
    • It is a stepping stone.  To what?  Link2Entities? 

Linq2Entities = Entity Framework?

  • You cannot define everything you can do in the XML from within the designer
    • E.g. multiple mappings for an entity
    • People using the designer only will not be aware they can do this
    • You have to work visually, so you cannot type textually the entity you want to define; it’s really fragmented and cumbersome to use.
  • Not a challenge to LLBLGen Pro
  • Data Access Solutions – the landscape has changed a lot; but possibly not enough to make Microsoft a significant force in the ORM world.
  • Trying to read a database with 1000 tables took over 12 hours to perform!
  • Designer isn’t up to par
  • Trying to be one fit for all
  • Released too soon
  • Will version 2 resolve these problems?  And will this break backwards compatibility with version 1?
    • Microsoft usually are good at not breaking backwards compatibility
    • I don’t foresee version 2 being a problem
  • It missed the Visual Studio 2008 cut-off.  Therefore, is it doomed?
  • MS has to hope that people will install Service Pack 2.


  • much better than XQUERY & XML Path
  • XML literals in VB is fantastic

Most programmers are already using ADO.NET and have to think hard, why do I need/want to change?

  • The change is bigger to go to an ORM than to upgrade from VS2005 to VS2008
  • ADO.NET data services

ORM is bigger than one product; it’s the next big productivity tool.

  • Nhibernate
  • Entity Framework 

Microsoft (Danny Simmons) said “Entity Framework is not an ORM”.  The Entity-Data Model is the product; you can add ORMS on top of this.

  • But this doesn’t make sense because EDM is just meta-data.  Every ORM has meta-data.
  • Thinks Steve Forte meant Microsoft needed some kind of a common model (schema) across multiple products.

There’s a part to play by the SQL Server team

  • There are problems in entities that SQL Server has too, like replication
  • What is an entity?
  • You have to have the same definition at both ends (designer and runtime)
  • The data model = the meta data format
  • The entity model = a layer above and abstraction level 

What does Franz want to see?

  • He sees their runtime frameworks directly compete
  • He doesn’t see their designers competing, because his will work on other frameworks 

The Alt.Net vote of “no confidence” against the Entity Framework

  • a petition
  • most of them are consultants
  • when they are forced to work with the Entity Framework, they are forced with limitations
  • they want the Entity Framework to work the way they do
    • lazy loading
    • true poke
  • strong language didn’t get many signatures
  • there are project leaders who want to use Entity Framework for whatever reason 

Large consultancy firms are in trouble because they want to standardise, but the Microsoft Entity Framework limitations won’t allow them to.

  • the framework won’t do everything you might want to do
  • therefore don’t use it

Are they far apart?

  • a data access layer
  • a runtime

The latest version of LLBLGEN Pro

  • Version 2.6
  • LINQ provider = 8 months work
  • Couple of maintenance fixes and updates
  • It mainly brings flexibility;
    • Native API was optimized for compiling, but resulted in convoluted code
    • More extensibility points 

My Speakers Profile

James Hippolite started programming in 1983 on an Apple IIe, at the age of 14. After graduating with a bachelor degree in Information Systems from Victoria University of Wellington in New Zealand in 1990, he started working with small systems relational databases, like dBase, Paradox, FoxPro and finally Microsoft Access. In 1991 he founded Mana Information Systems, a company for SME who couldn’t afford their own IT departments. As the lead developer, he developed small to medium WinForms applications using SQL Server, Visual Basic and latterly ASP.  In 2003 James developed in C# his first .NET web application, an internal metrics reporting tool for his new employer, Telecom New Zealand, utilising SQL Server stored procedures and .NET classes. Due to the worldwide success of SubSonic, James converted in 2008 to this O/R mapper, which is currently one of the market-leading data-access solutions for .NET, C# and VB.NET. James has been a trainer and contributed lectures on Microsoft Certification and SQL Server Reporting Services to the .NET community.  James has received for his community efforts no MVP reward yet.